Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_input.c
Show First 20 Lines • Show All 1,056 Lines • ▼ Show 20 Lines | if (!srcrt && V_ipsendredirects && | ||||
nh = ro.ro_nh; | nh = ro.ro_nh; | ||||
if (nh != NULL && ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) { | if (nh != NULL && ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) { | ||||
struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa); | struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa); | ||||
u_long src = ntohl(ip->ip_src.s_addr); | u_long src = ntohl(ip->ip_src.s_addr); | ||||
if (nh_ia != NULL && | if (nh_ia != NULL && | ||||
(src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { | (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { | ||||
if (nh->nh_flags & NHF_GATEWAY) | if (nh->nh_flags & NHF_GATEWAY && nh->gw_sa.sa_family == AF_INET) | ||||
dest.s_addr = nh->gw4_sa.sin_addr.s_addr; | dest.s_addr = nh->gw4_sa.sin_addr.s_addr; | ||||
else | else | ||||
dest.s_addr = ip->ip_dst.s_addr; | dest.s_addr = ip->ip_dst.s_addr; | ||||
/* Router requirements says to only send host redirects */ | /* Router requirements says to only send host redirects */ | ||||
type = ICMP_REDIRECT; | type = ICMP_REDIRECT; | ||||
code = ICMP_REDIRECT_HOST; | code = ICMP_REDIRECT_HOST; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 360 Lines • Show Last 20 Lines |