summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-06-02 10:41:40 +0000
committermpi <mpi@openbsd.org>2014-06-02 10:41:40 +0000
commit6606678dc858ea2a548ed38d47ac2d6aedcbf53b (patch)
tree9e541e8e61b460d176dd765afb6b4ec0f7fff1bf
parentmove random bytes buffer to be part of mmaped pages; ok tedu@ (diff)
downloadwireguard-openbsd-6606678dc858ea2a548ed38d47ac2d6aedcbf53b.tar.xz
wireguard-openbsd-6606678dc858ea2a548ed38d47ac2d6aedcbf53b.zip
Simply use ifa_ifwithaddr() to check if the binding address is on the
system. This function checks for unicast and broadcast addresses, so there is no need to do two lookups instead of one. Inputs & ok jca@, ok mikeb@
-rw-r--r--sys/netinet/raw_ip.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index a939901d550..c2ae755f185 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.72 2014/04/21 12:22:26 henning Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.73 2014/06/02 10:41:40 mpi Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -465,9 +465,9 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
}
if (!((so->so_options & SO_BINDANY) ||
- addr->sin_addr.s_addr == 0 ||
- in_iawithaddr(addr->sin_addr, inp->inp_rtableid) ||
- in_broadcast(addr->sin_addr, NULL, inp->inp_rtableid))) {
+ addr->sin_addr.s_addr == INADDR_ANY ||
+ addr->sin_addr.s_addr == INADDR_BROADCAST ||
+ ifa_ifwithaddr(sintosa(addr), inp->inp_rtableid))) {
error = EADDRNOTAVAIL;
break;
}