diff options
author | Vincent Gross <vgross@cvs.openbsd.org> | 2015-12-03 14:55:19 +0000 |
---|---|---|
committer | Vincent Gross <vgross@cvs.openbsd.org> | 2015-12-03 14:55:19 +0000 |
commit | 4e9316b1b328edd11be42f18f375a389874034ce (patch) | |
tree | 31a5ab43d5ddcba8954d472f626d836b5083b09b /sys/net | |
parent | 7d41bfb8b894c3be5eb96adf7ff11db11f64fd44 (diff) |
Remove broadcast matching from ifa_ifwithaddr(), use in_broadcast() where
required.
ok bluhm@ mpi@.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 9 | ||||
-rw-r--r-- | sys/net/route.c | 6 |
2 files changed, 5 insertions, 10 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 0da69d799a0..728e9a0cdd6 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.418 2015/12/03 12:22:51 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.419 2015/12/03 14:55:17 vgross Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1220,13 +1220,6 @@ ifa_ifwithaddr(struct sockaddr *addr, u_int rtableid) if (equal(addr, ifa->ifa_addr)) return (ifa); - - /* IPv6 doesn't have broadcast */ - if ((ifp->if_flags & IFF_BROADCAST) && - ifa->ifa_broadaddr && - ifa->ifa_broadaddr->sa_len != 0 && - equal(ifa->ifa_broadaddr, addr)) - return (ifa); } } return (NULL); diff --git a/sys/net/route.c b/sys/net/route.c index 5a10ec14e34..7b6b640aca3 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.285 2015/12/03 14:26:27 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.286 2015/12/03 14:55:17 vgross Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -539,7 +539,9 @@ rtredirect(struct sockaddr *dst, struct sockaddr *gateway, bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0) if (rt != NULL && (!equal(src, rt->rt_gateway) || rt->rt_ifa != ifa)) error = EINVAL; - else if (ifa_ifwithaddr(gateway, rdomain) != NULL) + else if (ifa_ifwithaddr(gateway, rdomain) != NULL || + (gateway->sa_family = AF_INET && + in_broadcast(satosin(gateway)->sin_addr, rdomain))) error = EHOSTUNREACH; if (error) goto done; |