Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/icmp6.c
Show First 20 Lines • Show All 1,215 Lines • ▼ Show 20 Lines | ni6_input(struct mbuf *m, int off, struct prison *pr) | ||||
* a link-local scope multicast address which the Responder has joined. | * a link-local scope multicast address which the Responder has joined. | ||||
* [RFC4602, Section 5.] | * [RFC4602, Section 5.] | ||||
*/ | */ | ||||
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { | if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { | ||||
if (!IN6_IS_ADDR_MC_LINKLOCAL(&ip6->ip6_dst)) | if (!IN6_IS_ADDR_MC_LINKLOCAL(&ip6->ip6_dst)) | ||||
goto bad; | goto bad; | ||||
/* else it's a link-local multicast, fine */ | /* else it's a link-local multicast, fine */ | ||||
} else { /* unicast or anycast */ | } else { /* unicast or anycast */ | ||||
ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); | ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); | ||||
if (ia6 == NULL) | if (ia6 == NULL) | ||||
goto bad; /* XXX impossible */ | goto bad; /* XXX impossible */ | ||||
if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) && | if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) && | ||||
!(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { | !(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { | ||||
ifa_free(&ia6->ia_ifa); | |||||
nd6log((LOG_DEBUG, "ni6_input: ignore node info to " | nd6log((LOG_DEBUG, "ni6_input: ignore node info to " | ||||
"a temporary address in %s:%d", | "a temporary address in %s:%d", | ||||
__FILE__, __LINE__)); | __FILE__, __LINE__)); | ||||
goto bad; | goto bad; | ||||
} | } | ||||
ifa_free(&ia6->ia_ifa); | |||||
} | } | ||||
/* validate query Subject field. */ | /* validate query Subject field. */ | ||||
qtype = ntohs(ni6->ni_qtype); | qtype = ntohs(ni6->ni_qtype); | ||||
subjlen = m->m_pkthdr.len - off - sizeof(struct icmp6_nodeinfo); | subjlen = m->m_pkthdr.len - off - sizeof(struct icmp6_nodeinfo); | ||||
switch (qtype) { | switch (qtype) { | ||||
case NI_QTYPE_NOOP: | case NI_QTYPE_NOOP: | ||||
case NI_QTYPE_SUPTYPES: | case NI_QTYPE_SUPTYPES: | ||||
▲ Show 20 Lines • Show All 854 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* If the incoming packet was addressed directly to us (i.e. unicast), | * If the incoming packet was addressed directly to us (i.e. unicast), | ||||
* use dst as the src for the reply. | * use dst as the src for the reply. | ||||
* The IN6_IFF_NOTREADY case should be VERY rare, but is possible | * The IN6_IFF_NOTREADY case should be VERY rare, but is possible | ||||
* (for example) when we encounter an error while forwarding procedure | * (for example) when we encounter an error while forwarding procedure | ||||
* destined to a duplicated address of ours. | * destined to a duplicated address of ours. | ||||
*/ | */ | ||||
if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { | if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { | ||||
ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); | ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); | ||||
if (ia != NULL && !(ia->ia6_flags & | if (ia != NULL && !(ia->ia6_flags & | ||||
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) { | (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) { | ||||
src6 = ia->ia_addr.sin6_addr; | src6 = ia->ia_addr.sin6_addr; | ||||
srcp = &src6; | srcp = &src6; | ||||
if (m->m_pkthdr.rcvif != NULL) { | if (m->m_pkthdr.rcvif != NULL) { | ||||
/* XXX: This may not be the outgoing interface */ | /* XXX: This may not be the outgoing interface */ | ||||
hlim = ND_IFINFO(m->m_pkthdr.rcvif)->chlim; | hlim = ND_IFINFO(m->m_pkthdr.rcvif)->chlim; | ||||
} else | } else | ||||
hlim = V_ip6_defhlim; | hlim = V_ip6_defhlim; | ||||
} | } | ||||
if (ia != NULL) | |||||
ifa_free(&ia->ia_ifa); | |||||
} | } | ||||
if (srcp == NULL) { | if (srcp == NULL) { | ||||
int error; | int error; | ||||
struct in6_addr dst6; | struct in6_addr dst6; | ||||
uint32_t scopeid; | uint32_t scopeid; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 680 Lines • Show Last 20 Lines |