summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2001-04-04 06:03:45 +0000
committeritojun <itojun@openbsd.org>2001-04-04 06:03:45 +0000
commita78c7ca70843c5b175133e658faa5ee81e55d359 (patch)
tree458086d6df280d544930f96eb61c8939d9c9e4e6
parentdo not check ip_mtudisc on IPv6 TCP. (diff)
downloadwireguard-openbsd-a78c7ca70843c5b175133e658faa5ee81e55d359.tar.xz
wireguard-openbsd-a78c7ca70843c5b175133e658faa5ee81e55d359.zip
make sure rcvif is not bogus, on call to icmp6_reflect.
-rw-r--r--sys/netinet6/icmp6.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 3a3612b47ae..99f1df22bf4 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.38 2001/03/30 11:08:58 itojun Exp $ */
+/* $OpenBSD: icmp6.c,v 1.39 2001/04/04 06:03:45 itojun Exp $ */
/* $KAME: icmp6.c,v 1.205 2001/03/21 07:48:57 itojun Exp $ */
/*
@@ -398,6 +398,15 @@ icmp6_error(m, type, code, param)
icmp6->icmp6_code = code;
icmp6->icmp6_pptr = htonl((u_int32_t)param);
+ /*
+ * icmp6_reflect() is designed to be in the input path.
+ * icmp6_error() can be called from both input and outut path,
+ * and if we are in output path rcvif could contain bogus value.
+ * clear m->m_pkthdr.rcvif for safety, we should have enough scope
+ * information in ip header (nip6).
+ */
+ m->m_pkthdr.rcvif = NULL;
+
icmp6stat.icp6s_outhist[type]++;
icmp6_reflect(m, sizeof(struct ip6_hdr)); /*header order: IPv6 - ICMPv6*/