summaryrefslogtreecommitdiff
path: root/usr.bin/dig
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/dig')
-rw-r--r--usr.bin/dig/lib/isc/include/isc/netaddr.h20
-rw-r--r--usr.bin/dig/lib/isc/netaddr.c38
-rw-r--r--usr.bin/dig/lib/isc/sockaddr.c32
3 files changed, 14 insertions, 76 deletions
diff --git a/usr.bin/dig/lib/isc/include/isc/netaddr.h b/usr.bin/dig/lib/isc/include/isc/netaddr.h
index 44b75b73672..4084269ea9e 100644
--- a/usr.bin/dig/lib/isc/include/isc/netaddr.h
+++ b/usr.bin/dig/lib/isc/include/isc/netaddr.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netaddr.h,v 1.6 2020/09/14 08:40:44 florian Exp $ */
+/* $Id: netaddr.h,v 1.7 2020/09/15 08:13:35 florian Exp $ */
#ifndef ISC_NETADDR_H
#define ISC_NETADDR_H 1
@@ -74,22 +74,4 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size);
void
isc_netaddr_fromsockaddr(isc_netaddr_t *netaddr, const isc_sockaddr_t *source);
-int
-isc_netaddr_ismulticast(isc_netaddr_t *na);
-/*%<
- * Returns 1 if the address is a multicast address.
- */
-
-int
-isc_netaddr_islinklocal(isc_netaddr_t *na);
-/*%<
- * Returns #1 if the address is a link local address.
- */
-
-int
-isc_netaddr_issitelocal(isc_netaddr_t *na);
-/*%<
- * Returns #1 if the address is a site local address.
- */
-
#endif /* ISC_NETADDR_H */
diff --git a/usr.bin/dig/lib/isc/netaddr.c b/usr.bin/dig/lib/isc/netaddr.c
index eff6c2f5688..f22203d22dd 100644
--- a/usr.bin/dig/lib/isc/netaddr.c
+++ b/usr.bin/dig/lib/isc/netaddr.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netaddr.c,v 1.9 2020/09/14 08:40:44 florian Exp $ */
+/* $Id: netaddr.c,v 1.10 2020/09/15 08:13:35 florian Exp $ */
/*! \file */
@@ -117,39 +117,3 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
INSIST(0);
}
}
-
-int
-isc_netaddr_ismulticast(isc_netaddr_t *na) {
- switch (na->family) {
- case AF_INET:
- return (IN_MULTICAST(na->type.in.s_addr));
- case AF_INET6:
- return (IN6_IS_ADDR_MULTICAST(&na->type.in6));
- default:
- return (0); /* XXXMLG ? */
- }
-}
-
-int
-isc_netaddr_islinklocal(isc_netaddr_t *na) {
- switch (na->family) {
- case AF_INET:
- return (0);
- case AF_INET6:
- return (IN6_IS_ADDR_LINKLOCAL(&na->type.in6));
- default:
- return (0);
- }
-}
-
-int
-isc_netaddr_issitelocal(isc_netaddr_t *na) {
- switch (na->family) {
- case AF_INET:
- return (0);
- case AF_INET6:
- return (IN6_IS_ADDR_SITELOCAL(&na->type.in6));
- default:
- return (0);
- }
-}
diff --git a/usr.bin/dig/lib/isc/sockaddr.c b/usr.bin/dig/lib/isc/sockaddr.c
index f0dffff3c42..90beb4a58ec 100644
--- a/usr.bin/dig/lib/isc/sockaddr.c
+++ b/usr.bin/dig/lib/isc/sockaddr.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.c,v 1.9 2020/09/14 08:40:44 florian Exp $ */
+/* $Id: sockaddr.c,v 1.10 2020/09/15 08:13:35 florian Exp $ */
/*! \file */
@@ -255,34 +255,26 @@ isc_sockaddr_getport(const isc_sockaddr_t *sockaddr) {
int
isc_sockaddr_ismulticast(const isc_sockaddr_t *sockaddr) {
- isc_netaddr_t netaddr;
-
- if (sockaddr->type.sa.sa_family == AF_INET ||
- sockaddr->type.sa.sa_family == AF_INET6) {
- isc_netaddr_fromsockaddr(&netaddr, sockaddr);
- return (isc_netaddr_ismulticast(&netaddr));
+ switch (sockaddr->type.sa.sa_family) {
+ case AF_INET:
+ return (IN_MULTICAST(&sockaddr->type.sin.sin_addr.s_addr));
+ case AF_INET6:
+ return (IN6_IS_ADDR_MULTICAST(&sockaddr->type.sin6.sin6_addr));
+ default:
+ return (0);
}
- return (0);
}
int
isc_sockaddr_issitelocal(const isc_sockaddr_t *sockaddr) {
- isc_netaddr_t netaddr;
-
- if (sockaddr->type.sa.sa_family == AF_INET6) {
- isc_netaddr_fromsockaddr(&netaddr, sockaddr);
- return (isc_netaddr_issitelocal(&netaddr));
- }
+ if (sockaddr->type.sa.sa_family == AF_INET6)
+ return (IN6_IS_ADDR_SITELOCAL(&sockaddr->type.sin6.sin6_addr));
return (0);
}
int
isc_sockaddr_islinklocal(const isc_sockaddr_t *sockaddr) {
- isc_netaddr_t netaddr;
-
- if (sockaddr->type.sa.sa_family == AF_INET6) {
- isc_netaddr_fromsockaddr(&netaddr, sockaddr);
- return (isc_netaddr_islinklocal(&netaddr));
- }
+ if (sockaddr->type.sa.sa_family == AF_INET6)
+ return (IN6_IS_ADDR_LINKLOCAL(&sockaddr->type.sin6.sin6_addr));
return (0);
}