summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-06-12 16:15:05 +0000
committerclaudio <claudio@openbsd.org>2008-06-12 16:15:05 +0000
commitb551086dd7ba8a58c174f29fe584a6f0664239f0 (patch)
tree170f3b4731170ac82f83465f8697556da0efbcb9
parentlet usage() match SYNOPSIS; (diff)
downloadwireguard-openbsd-b551086dd7ba8a58c174f29fe584a6f0664239f0.tar.xz
wireguard-openbsd-b551086dd7ba8a58c174f29fe584a6f0664239f0.zip
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@
-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;