aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6/ip6_input.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2001-04-05 19:45:02 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2001-04-05 19:45:02 +0000
commit7b35f61ab73bf4ce661ec03a81173652e58c3199 (patch)
tree4de02990bd99fd1370b0f54b4d9a1b604bf9019d /sys/netinet6/ip6_input.c
parent8b4fca1f63d27912ff86048c1475e8f2846ff429 (diff)
Notes
Diffstat (limited to 'sys/netinet6/ip6_input.c')
-rw-r--r--sys/netinet6/ip6_input.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 20c84a33927e..b1de716dd049 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -391,17 +391,24 @@ ip6_input(m)
if (IN6_IS_ADDR_LOOPBACK(&ip6->ip6_src) ||
IN6_IS_ADDR_LOOPBACK(&ip6->ip6_dst)) {
if (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) {
- if (ip6_forward_rt.ro_rt != NULL &&
- (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 &&
- IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &ip6_forward_rt.ro_dst.sin6_addr)) {
- struct in6_ifaddr *ia6 =
- (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa;
+ struct in6_ifaddr *ia6;
+
+ if ((ia6 = in6ifa_ifpwithaddr(m->m_pkthdr.rcvif,
+ &ip6->ip6_dst)) != NULL) {
ia6->ia_ifa.if_ipackets++;
ia6->ia_ifa.if_ibytes += m->m_pkthdr.len;
- ours = 1;
- deliverifp = m->m_pkthdr.rcvif;
- goto hbhcheck;
+ } else {
+ /*
+ * The packet is looped back, but we do not
+ * have the destination address for some
+ * reason.
+ * XXX: should we return an icmp6 error?
+ */
+ goto bad;
}
+ ours = 1;
+ deliverifp = m->m_pkthdr.rcvif;
+ goto hbhcheck;
} else {
ip6stat.ip6s_badscope++;
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
@@ -431,17 +438,23 @@ ip6_input(m)
*/
if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) != 0) {
if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) {
- if (ip6_forward_rt.ro_rt != NULL &&
- (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 &&
- IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &ip6_forward_rt.ro_dst.sin6_addr)) {
- struct in6_ifaddr *ia6 =
- (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa;
+ struct in6_ifaddr *ia6;
+
+ if ((ia6 = in6ifa_ifpwithaddr(m->m_pkthdr.rcvif,
+ &ip6->ip6_dst)) != NULL) {
ia6->ia_ifa.if_ipackets++;
ia6->ia_ifa.if_ibytes += m->m_pkthdr.len;
- ours = 1;
- deliverifp = m->m_pkthdr.rcvif;
- goto hbhcheck;
+ } else {
+ /*
+ * We do not have the link-local address
+ * specified as the destination.
+ * XXX: should we return an icmp6 error?
+ */
+ goto bad;
}
+ ours = 1;
+ deliverifp = m->m_pkthdr.rcvif;
+ goto hbhcheck;
}
}