summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_pcb.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/in6_pcb.c')
-rw-r--r--sys/netinet6/in6_pcb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index e572712..800564c 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -163,11 +163,13 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
if (so->so_options & SO_REUSEADDR)
reuseport = SO_REUSEADDR|SO_REUSEPORT;
} else if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
- struct ifaddr *ia = NULL;
+ struct ifaddr *ia;
sin6->sin6_port = 0; /* yech... */
- if ((ia = ifa_ifwithaddr((struct sockaddr *)sin6)) == 0)
+ if ((ia = ifa_ifwithaddr((struct sockaddr *)sin6)) == NULL &&
+ (inp->inp_flags & INP_BINDANY) == 0) {
return (EADDRNOTAVAIL);
+ }
/*
* XXX: bind to an anycast address might accidentally
OpenPOWER on IntegriCloud