summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2013-10-23 11:06:56 +0000
committermikeb <mikeb@openbsd.org>2013-10-23 11:06:56 +0000
commit8c385beeb8fbd18d2d79852c73a7578f756c0a72 (patch)
treebe50910ed0ac5678051bdde2cce297619f8d9250
parentInstead of comparing the lower and higher addresses of all the multicast (diff)
downloadwireguard-openbsd-8c385beeb8fbd18d2d79852c73a7578f756c0a72.tar.xz
wireguard-openbsd-8c385beeb8fbd18d2d79852c73a7578f756c0a72.zip
overwrite icmp packet type-specific nextptr field only when we're
changing it. fixes an icmp to icmpv6 translation regression found by todd and sthen. ok henning sthen
-rw-r--r--sys/net/pf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 9c5ca4257c9..254a5fd07e2 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.850 2013/10/22 15:35:57 lteo Exp $ */
+/* $OpenBSD: pf.c,v 1.851 2013/10/23 11:06:56 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -2157,7 +2157,8 @@ pf_translate_icmp_af(int af, void *arg)
/* aligns well with a icmpv4 nextmtu */
icmp6->icmp6_mtu = htonl(mtu);
/* icmpv4 pptr is a one most significant byte */
- icmp6->icmp6_pptr = htonl(ptr << 24);
+ if (ptr >= 0)
+ icmp6->icmp6_pptr = htonl(ptr << 24);
break;
case AF_INET6:
icmp4 = arg;
@@ -2249,7 +2250,8 @@ pf_translate_icmp_af(int af, void *arg)
icmp4->icmp_type = type;
icmp4->icmp_code = code;
icmp4->icmp_nextmtu = htons(mtu);
- icmp4->icmp_void = htonl(ptr);
+ if (ptr >= 0)
+ icmp4->icmp_void = htonl(ptr);
break;
}