diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-06-22 10:59:34 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-06-22 10:59:34 +0000 |
commit | 3c02410d55d9cfe0cb4dcbfad5eef376463d8e08 (patch) | |
tree | 45a4f946feeb75c5ed5e8dcc028809c6966e1ba1 /sys/netinet | |
parent | 0b01d8c2101aa4512c45bd77f2c3fee5137b4595 (diff) | |
download | FreeBSD-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/netinet')
-rw-r--r-- | sys/netinet/in_pcb.c | 2 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 252c7fb..4e30572 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -357,7 +357,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, * to any endpoint address, local or not. */ if ((inp->inp_flags & INP_BINDANY) == 0 && - ifa_ifwithaddr((struct sockaddr *)sin) == NULL) + ifa_ifwithaddr_check((struct sockaddr *)sin) == 0) return (EADDRNOTAVAIL); } laddr = sin->sin_addr; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 377e56b..0157afb 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -875,7 +875,7 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td) (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) || (addr->sin_addr.s_addr && (inp->inp_flags & INP_BINDANY) == 0 && - ifa_ifwithaddr((struct sockaddr *)addr) == NULL)) + ifa_ifwithaddr_check((struct sockaddr *)addr) == 0)) return (EADDRNOTAVAIL); INP_INFO_WLOCK(&V_ripcbinfo); |