summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-06-22 10:59:34 +0000
committerrwatson <rwatson@FreeBSD.org>2009-06-22 10:59:34 +0000
commit3c02410d55d9cfe0cb4dcbfad5eef376463d8e08 (patch)
tree45a4f946feeb75c5ed5e8dcc028809c6966e1ba1 /sys/net/if.c
parent0b01d8c2101aa4512c45bd77f2c3fee5137b4595 (diff)
downloadFreeBSD-src-3c02410d55d9cfe0cb4dcbfad5eef376463d8e08.zip
FreeBSD-src-3c02410d55d9cfe0cb4dcbfad5eef376463d8e08.tar.gz
Add a new function, ifa_ifwithaddr_check(), which rather than returning
a pointer to an ifaddr matching the passed socket address, returns a boolean indicating whether one was present. In the (near) future, ifa_ifwithaddr() will return a referenced ifaddr rather than a raw ifaddr pointer, and the new wrapper will allow callers that care only about the boolean condition to avoid having to free that reference. MFC after: 3 weeks
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index bc13501..eb5e519 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1466,8 +1466,8 @@ ifa_free(struct ifaddr *ifa)
* Locate an interface based on a complete address.
*/
/*ARGSUSED*/
-struct ifaddr *
-ifa_ifwithaddr(struct sockaddr *addr)
+static struct ifaddr *
+ifa_ifwithaddr_internal(struct sockaddr *addr)
{
INIT_VNET_NET(curvnet);
struct ifnet *ifp;
@@ -1500,6 +1500,20 @@ done:
return (ifa);
}
+struct ifaddr *
+ifa_ifwithaddr(struct sockaddr *addr)
+{
+
+ return (ifa_ifwithaddr_internal(addr));
+}
+
+int
+ifa_ifwithaddr_check(struct sockaddr *addr)
+{
+
+ return (ifa_ifwithaddr_internal(addr) != NULL);
+}
+
/*
* Locate an interface based on the broadcast address.
*/
OpenPOWER on IntegriCloud