summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-02-28 14:30:41 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-02-28 14:30:41 +0000
commite6a45ab5b0869babff96d56abec94aa10be2dcd6 (patch)
tree96db36a4042903951dfdff0b0615ef7a013c04b1 /sys
parentb1e3a30904e42517cbfed073832f4cbdd60682fc (diff)
fix ICMPv6 redirect input. the bug can result in invalid ND entry.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/icmp6.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 69a705e0a48..c056e23f04e 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.8 2000/02/28 14:05:59 itojun Exp $ */
+/* $OpenBSD: icmp6.c,v 1.9 2000/02/28 14:30:40 itojun Exp $ */
/* $KAME: icmp6.c,v 1.71 2000/02/28 09:25:42 jinmei Exp $ */
/*
@@ -1544,11 +1544,6 @@ icmp6_redirect_input(m, off)
if (!icmp6_rediraccept)
goto freeit;
- if (IN6_IS_ADDR_LINKLOCAL(&redtgt6))
- redtgt6.s6_addr16[1] = htons(ifp->if_index);
- if (IN6_IS_ADDR_LINKLOCAL(&reddst6))
- reddst6.s6_addr16[1] = htons(ifp->if_index);
-
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, icmp6len,);
nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off);
@@ -1562,6 +1557,11 @@ icmp6_redirect_input(m, off)
redtgt6 = nd_rd->nd_rd_target;
reddst6 = nd_rd->nd_rd_dst;
+ if (IN6_IS_ADDR_LINKLOCAL(&redtgt6))
+ redtgt6.s6_addr16[1] = htons(ifp->if_index);
+ if (IN6_IS_ADDR_LINKLOCAL(&reddst6))
+ reddst6.s6_addr16[1] = htons(ifp->if_index);
+
/* validation */
if (!IN6_IS_ADDR_LINKLOCAL(&src6)) {
log(LOG_ERR,