summaryrefslogtreecommitdiff
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-04-28 09:56:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-04-28 09:56:28 +0000
commit959bb9f6884c49637c3bcde1c528f737d6f881bd (patch)
tree6b60f6ed2c927369b9b628e1b106c709a243c7f7 /sys/netinet/in.c
parentd8e44e7cc59e0f8ed2759d99780e241c2d7d0277 (diff)
Make in_broadcast() rdomain aware. Mostly mechanical change.
This fixes the problem of binding sockets to broadcast IPs in other rdomains. OK henning@
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 14bf9d88394..1d795e591b0 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.64 2010/11/28 20:24:33 claudio Exp $ */
+/* $OpenBSD: in.c,v 1.65 2011/04/28 09:56:27 claudio Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -886,12 +886,13 @@ in_scrubprefix(target)
* Return 1 if the address might be a local broadcast address.
*/
int
-in_broadcast(in, ifp)
- struct in_addr in;
- struct ifnet *ifp;
+in_broadcast(struct in_addr in, struct ifnet *ifp, u_int rtableid)
{
struct ifnet *ifn, *if_first, *if_target;
struct ifaddr *ifa;
+ u_int rdomain;
+
+ rdomain = rtable_l2(rtableid);
if (in.s_addr == INADDR_BROADCAST ||
in.s_addr == INADDR_ANY)
@@ -912,6 +913,8 @@ in_broadcast(in, ifp)
* If ifp is NULL, check against all the interfaces.
*/
for (ifn = if_first; ifn != if_target; ifn = TAILQ_NEXT(ifn, if_list)) {
+ if (ifn->if_rdomain != rdomain)
+ continue;
if ((ifn->if_flags & IFF_BROADCAST) == 0)
continue;
TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list)