Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet6/icmp6.c
Show First 20 Lines • Show All 2,264 Lines • ▼ Show 20 Lines | if (ip6->ip6_hlim != 255) { | ||||
nd6log((LOG_ERR, | nd6log((LOG_ERR, | ||||
"ICMP6 redirect sent from %s rejected; " | "ICMP6 redirect sent from %s rejected; " | ||||
"hlim=%d (must be 255)\n", | "hlim=%d (must be 255)\n", | ||||
ip6_sprintf(ip6buf, &src6), ip6->ip6_hlim)); | ip6_sprintf(ip6buf, &src6), ip6->ip6_hlim)); | ||||
goto bad; | goto bad; | ||||
} | } | ||||
{ | { | ||||
/* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */ | /* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */ | ||||
struct nhop6_basic nh6; | struct nhop_object *nh; | ||||
struct in6_addr kdst; | struct in6_addr kdst; | ||||
uint32_t scopeid; | uint32_t scopeid; | ||||
in6_splitscope(&reddst6, &kdst, &scopeid); | in6_splitscope(&reddst6, &kdst, &scopeid); | ||||
if (fib6_lookup_nh_basic(ifp->if_fib, &kdst, scopeid, 0, 0,&nh6)==0){ | NET_EPOCH_ASSERT(); | ||||
if ((nh6.nh_flags & NHF_GATEWAY) == 0) { | nh = fib6_lookup(ifp->if_fib, &kdst, scopeid, 0, 0); | ||||
if (nh == NULL) { | |||||
struct in6_addr nh_addr; | |||||
nh_addr = ifatoia6(nh->nh_ifa)->ia_addr.sin6_addr; | |||||
if ((nh->nh_flags & NHF_GATEWAY) == 0) { | |||||
nd6log((LOG_ERR, | nd6log((LOG_ERR, | ||||
"ICMP6 redirect rejected; no route " | "ICMP6 redirect rejected; no route " | ||||
"with inet6 gateway found for redirect dst: %s\n", | "with inet6 gateway found for redirect dst: %s\n", | ||||
icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | ||||
goto bad; | goto bad; | ||||
} | } | ||||
/* | /* | ||||
* Embed scope zone id into next hop address, since | * Embed scope zone id into next hop address. | ||||
* fib6_lookup_nh_basic() returns address without embedded | |||||
* scope zone id. | |||||
*/ | */ | ||||
if (in6_setscope(&nh6.nh_addr, m->m_pkthdr.rcvif, NULL)) | nh_addr = nh->gw6_sa.sin6_addr; | ||||
goto freeit; | |||||
if (IN6_ARE_ADDR_EQUAL(&src6, &nh6.nh_addr) == 0) { | if (IN6_ARE_ADDR_EQUAL(&src6, &nh_addr) == 0) { | ||||
nd6log((LOG_ERR, | nd6log((LOG_ERR, | ||||
"ICMP6 redirect rejected; " | "ICMP6 redirect rejected; " | ||||
"not equal to gw-for-src=%s (must be same): " | "not equal to gw-for-src=%s (must be same): " | ||||
"%s\n", | "%s\n", | ||||
ip6_sprintf(ip6buf, &nh6.nh_addr), | ip6_sprintf(ip6buf, &nh_addr), | ||||
icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | ||||
goto bad; | goto bad; | ||||
} | } | ||||
} else { | } else { | ||||
nd6log((LOG_ERR, | nd6log((LOG_ERR, | ||||
"ICMP6 redirect rejected; " | "ICMP6 redirect rejected; " | ||||
"no route found for redirect dst: %s\n", | "no route found for redirect dst: %s\n", | ||||
icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); | ||||
▲ Show 20 Lines • Show All 499 Lines • Show Last 20 Lines |