Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_input.c
Show First 20 Lines • Show All 601 Lines • ▼ Show 20 Lines | #endif | ||||
if (pfil_run_hooks(V_inet_pfil_head, &m, ifp, PFIL_IN, NULL) != | if (pfil_run_hooks(V_inet_pfil_head, &m, ifp, PFIL_IN, NULL) != | ||||
PFIL_PASS) | PFIL_PASS) | ||||
return; | return; | ||||
if (m == NULL) /* consumed by filter */ | if (m == NULL) /* consumed by filter */ | ||||
return; | return; | ||||
ip = mtod(m, struct ip *); | ip = mtod(m, struct ip *); | ||||
dchg = (odst.s_addr != ip->ip_dst.s_addr); | dchg = (odst.s_addr != ip->ip_dst.s_addr); | ||||
ifp = m->m_pkthdr.rcvif; | |||||
if (m->m_flags & M_FASTFWD_OURS) { | if (m->m_flags & M_FASTFWD_OURS) { | ||||
m->m_flags &= ~M_FASTFWD_OURS; | m->m_flags &= ~M_FASTFWD_OURS; | ||||
goto ours; | goto ours; | ||||
} | } | ||||
if (m->m_flags & M_IP_NEXTHOP) { | if (m->m_flags & M_IP_NEXTHOP) { | ||||
if (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { | if (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | passin: | ||||
* strong ES model) with a list of additional predicates: | * strong ES model) with a list of additional predicates: | ||||
* - if IP forwarding is disabled | * - if IP forwarding is disabled | ||||
* - the packet is not locally generated | * - the packet is not locally generated | ||||
* - the packet is not subject to 'ipfw fwd' | * - the packet is not subject to 'ipfw fwd' | ||||
* - Interface is not running CARP. If the packet got here, we already | * - Interface is not running CARP. If the packet got here, we already | ||||
* checked it with carp_iamatch() and carp_forus(). | * checked it with carp_iamatch() and carp_forus(). | ||||
*/ | */ | ||||
strong_es = V_ip_strong_es && (V_ipforwarding == 0) && | strong_es = V_ip_strong_es && (V_ipforwarding == 0) && | ||||
ifp != NULL && ((ifp->if_flags & IFF_LOOPBACK) == 0) && | ((ifp->if_flags & IFF_LOOPBACK) == 0) && | ||||
ifp->if_carp == NULL && (dchg == 0); | ifp->if_carp == NULL && (dchg == 0); | ||||
/* | /* | ||||
* Check for exact addresses in the hash bucket. | * Check for exact addresses in the hash bucket. | ||||
*/ | */ | ||||
CK_LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { | CK_LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { | ||||
if (IA_SIN(ia)->sin_addr.s_addr != ip->ip_dst.s_addr) | if (IA_SIN(ia)->sin_addr.s_addr != ip->ip_dst.s_addr) | ||||
continue; | continue; | ||||
Show All 15 Lines | passin: | ||||
/* | /* | ||||
* Check for broadcast addresses. | * Check for broadcast addresses. | ||||
* | * | ||||
* Only accept broadcast packets that arrive via the matching | * Only accept broadcast packets that arrive via the matching | ||||
* interface. Reception of forwarded directed broadcasts would | * interface. Reception of forwarded directed broadcasts would | ||||
* be handled via ip_forward() and ether_output() with the loopback | * be handled via ip_forward() and ether_output() with the loopback | ||||
* into the stack for SIMPLEX interfaces handled by ether_output(). | * into the stack for SIMPLEX interfaces handled by ether_output(). | ||||
*/ | */ | ||||
if (ifp != NULL && ifp->if_flags & IFF_BROADCAST) { | if (ifp->if_flags & IFF_BROADCAST) { | ||||
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { | CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { | ||||
if (ifa->ifa_addr->sa_family != AF_INET) | if (ifa->ifa_addr->sa_family != AF_INET) | ||||
continue; | continue; | ||||
ia = ifatoia(ifa); | ia = ifatoia(ifa); | ||||
if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == | if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == | ||||
ip->ip_dst.s_addr) { | ip->ip_dst.s_addr) { | ||||
counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); | counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); | ||||
counter_u64_add(ia->ia_ifa.ifa_ibytes, | counter_u64_add(ia->ia_ifa.ifa_ibytes, | ||||
▲ Show 20 Lines • Show All 713 Lines • Show Last 20 Lines |