aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2001-04-20 00:17:51 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2001-04-20 00:17:51 +0000
commitf0a77f9e125b53290c6a482f17be4b0e254c32bb (patch)
tree76172be99e9a4a7cec3fc5812f45ade190919987
parentd8859683939151f394e5233be9e054621b7aca33 (diff)
downloadsrc-f0a77f9e125b53290c6a482f17be4b0e254c32bb.tar.gz
src-f0a77f9e125b53290c6a482f17be4b0e254c32bb.zip
MFC 1.23->1.24:
- Fix to receive icmp6 echo reply within the host itself to ff02::1. - Fix to receive icmp6 echo reply to link-local of itself. Approved by: jkh
Notes
Notes: svn path=/stable/4/; revision=75721
-rw-r--r--sys/netinet6/ip6_input.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 9845c667f857..2ac747593295 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -409,8 +409,39 @@ ip6_input(m)
if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) != 0) {
if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) {
struct in6_ifaddr *ia6;
+#ifndef FAKE_LOOPBACK_IF
+ int deliverifid;
- if ((ia6 = in6ifa_ifpwithaddr(m->m_pkthdr.rcvif,
+ /*
+ * Get a "real" delivered interface, which should be
+ * embedded in the second 16 bits of the destination
+ * address. We can probably trust the value, but we
+ * add validation for the value just for safety.
+ */
+ deliverifid = ntohs(ip6->ip6_dst.s6_addr16[1]);
+ if (deliverifid > 0 && deliverifid <= if_index) {
+ deliverifp = ifindex2ifnet[deliverifid];
+
+ /*
+ * XXX: fake the rcvif to the real interface.
+ * Since m_pkthdr.rcvif should be lo0 (or a
+ * variant), it would confuse scope handling
+ * code later.
+ */
+ m->m_pkthdr.rcvif = deliverifp;
+ }
+ else {
+ /*
+ * Last resort; just use rcvif.
+ * XXX: the packet would be discarded by the
+ * succeeding check.
+ */
+ deliverifp = m->m_pkthdr.rcvif;
+ }
+#else
+ deliverifp = m->m_pkthdr.rcvif;
+#endif
+ if ((ia6 = in6ifa_ifpwithaddr(deliverifp,
&ip6->ip6_dst)) != NULL) {
ia6->ia_ifa.if_ipackets++;
ia6->ia_ifa.if_ibytes += m->m_pkthdr.len;
@@ -423,7 +454,6 @@ ip6_input(m)
goto bad;
}
ours = 1;
- deliverifp = m->m_pkthdr.rcvif;
goto hbhcheck;
}
}