summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-06-12 16:15:06 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-06-12 16:15:06 +0000
commite728132bf6e5fed5ff16ce9474568a16419c9641 (patch)
tree30ec5b4f644644fda9a0380262d189bde4083feb /sys
parentf07f7bba874a0a8b30d08e20fe754216f54809b4 (diff)
Fix the egress group matching for IPv4. There are to ways to define a /0
network mask. For some reasons some parts set sa->sa_len to 0 to specify a /0 netmask so check fot that too. tested by david@ OK henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index fb6271fac97..2892e0e4107 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.172 2008/06/08 20:27:23 claudio Exp $ */
+/* $OpenBSD: if.c,v 1.173 2008/06/12 16:15:05 claudio Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1866,14 +1866,15 @@ if_group_routechange(struct sockaddr *dst, struct sockaddr *mask)
switch (dst->sa_family) {
case AF_INET:
if (satosin(dst)->sin_addr.s_addr == INADDR_ANY &&
- satosin(mask)->sin_addr.s_addr == INADDR_ANY)
+ mask && (mask->sa_len == 0 ||
+ satosin(mask)->sin_addr.s_addr == INADDR_ANY))
if_group_egress_build();
break;
#ifdef INET6
case AF_INET6:
if (IN6_ARE_ADDR_EQUAL(&(satosin6(dst))->sin6_addr,
- &in6addr_any) &&
- mask && IN6_ARE_ADDR_EQUAL(&(satosin6(mask))->sin6_addr,
+ &in6addr_any) && mask &&
+ IN6_ARE_ADDR_EQUAL(&(satosin6(mask))->sin6_addr,
&in6addr_any))
if_group_egress_build();
break;