diff options
author | 2014-10-28 11:02:38 +0000 | |
---|---|---|
committer | 2014-10-28 11:02:38 +0000 | |
commit | 63c2dc41be148512d6bacc892c7a9815c282fbfb (patch) | |
tree | 151c6f2355b793e6a4116c8dc896b47ecb7b0f7b | |
parent | Fix pipex(4) to return multicast packets to the caller so that npppd can (diff) | |
download | wireguard-openbsd-63c2dc41be148512d6bacc892c7a9815c282fbfb.tar.xz wireguard-openbsd-63c2dc41be148512d6bacc892c7a9815c282fbfb.zip |
Select a proper source address when the bound address is
INADDR_BROADCAST the same as INADDR_ANY.
ok mpi
-rw-r--r-- | sys/netinet/in_pcb.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 6a6cb1c12bd..d8e1f74ef13 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.160 2014/10/14 09:52:26 mpi Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.161 2014/10/28 11:02:38 yasuoka Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -799,10 +799,11 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, struct in_ifaddr *ia = NULL; /* - * If the source address is not specified but the socket(if any) - * is already bound, use the bound address. + * If the socket(if any) is already bound, use that bound address + * unless it is INADDR_ANY or INADDR_BROADCAST. */ - if (laddr && laddr->s_addr != INADDR_ANY) { + if (laddr && laddr->s_addr != INADDR_ANY && + laddr->s_addr != INADDR_BROADCAST) { *insrc = laddr; return (0); } |