version 1.319, 2014/06/16 00:33:39 |
version 1.319.4.2, 2015/06/06 14:40:25 |
Line 593 ip_input(struct mbuf *m) |
|
Line 593 ip_input(struct mbuf *m) |
|
* |
* |
* Traditional 4.4BSD did not consult IFF_UP at all. |
* Traditional 4.4BSD did not consult IFF_UP at all. |
* The behavior here is to treat addresses on !IFF_UP interface |
* The behavior here is to treat addresses on !IFF_UP interface |
* as not mine. |
* or IN_IFF_NOTREADY addresses as not mine. |
*/ |
*/ |
downmatch = 0; |
downmatch = 0; |
LIST_FOREACH(ia, &IN_IFADDR_HASH(ip->ip_dst.s_addr), ia_hash) { |
LIST_FOREACH(ia, &IN_IFADDR_HASH(ip->ip_dst.s_addr), ia_hash) { |
if (in_hosteq(ia->ia_addr.sin_addr, ip->ip_dst)) { |
if (in_hosteq(ia->ia_addr.sin_addr, ip->ip_dst)) { |
|
if (ia->ia4_flags & IN_IFF_NOTREADY) |
|
continue; |
if (checkif && ia->ia_ifp != ifp) |
if (checkif && ia->ia_ifp != ifp) |
continue; |
continue; |
if ((ia->ia_ifp->if_flags & IFF_UP) != 0) |
if ((ia->ia_ifp->if_flags & IFF_UP) != 0) |
Line 613 ip_input(struct mbuf *m) |
|
Line 615 ip_input(struct mbuf *m) |
|
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 (ia->ia4_flags & IN_IFF_NOTREADY) |
|
continue; |
if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) || |
if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) || |
in_hosteq(ip->ip_dst, ia->ia_netbroadcast) || |
in_hosteq(ip->ip_dst, ia->ia_netbroadcast) || |
/* |
/* |
Line 1189 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1193 ip_forward(struct mbuf *m, int srcrt) |
|
struct sockaddr dst; |
struct sockaddr dst; |
struct sockaddr_in dst4; |
struct sockaddr_in dst4; |
} u; |
} u; |
|
uint64_t *ips; |
|
|
KASSERTMSG(cpu_softintr_p(), "ip_forward: not in the software " |
KASSERTMSG(cpu_softintr_p(), "ip_forward: not in the software " |
"interrupt handler; synchronization assumptions violated"); |
"interrupt handler; synchronization assumptions violated"); |
Line 1269 ip_forward(struct mbuf *m, int srcrt) |
|
Line 1274 ip_forward(struct mbuf *m, int srcrt) |
|
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), |
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), |
NULL, NULL); |
NULL, NULL); |
|
|
if (error) |
if (error) { |
IP_STATINC(IP_STAT_CANTFORWARD); |
IP_STATINC(IP_STAT_CANTFORWARD); |
else { |
goto error; |
uint64_t *ips = IP_STAT_GETREF(); |
} |
ips[IP_STAT_FORWARD]++; |
|
if (type) { |
ips = IP_STAT_GETREF(); |
ips[IP_STAT_REDIRECTSENT]++; |
ips[IP_STAT_FORWARD]++; |
IP_STAT_PUTREF(); |
|
} else { |
if (type) { |
IP_STAT_PUTREF(); |
ips[IP_STAT_REDIRECTSENT]++; |
if (mcopy) { |
IP_STAT_PUTREF(); |
|
goto redirect; |
|
} |
|
|
|
IP_STAT_PUTREF(); |
|
if (mcopy) { |
#ifdef GATEWAY |
#ifdef GATEWAY |
if (mcopy->m_flags & M_CANFASTFWD) |
if (mcopy->m_flags & M_CANFASTFWD) |
ipflow_create(&ipforward_rt, mcopy); |
ipflow_create(&ipforward_rt, mcopy); |
#endif |
#endif |
m_freem(mcopy); |
m_freem(mcopy); |
} |
|
SOFTNET_UNLOCK(); |
|
return; |
|
} |
|
} |
} |
|
|
|
SOFTNET_UNLOCK(); |
|
return; |
|
|
|
redirect: |
|
error: |
if (mcopy == NULL) { |
if (mcopy == NULL) { |
SOFTNET_UNLOCK(); |
SOFTNET_UNLOCK(); |
return; |
return; |
Line 1633 sysctl_net_inet_ip_setup(struct sysctllo |
|
Line 1645 sysctl_net_inet_ip_setup(struct sysctllo |
|
sysctl_net_inet_ip_stats, 0, NULL, 0, |
sysctl_net_inet_ip_stats, 0, NULL, 0, |
CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS, |
CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS, |
CTL_EOL); |
CTL_EOL); |
|
#if NARP |
|
sysctl_createv(clog, 0, NULL, NULL, |
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE, |
|
CTLTYPE_INT, "dad_count", |
|
SYSCTL_DESCR("Number of Duplicate Address Detection " |
|
"probes to send"), |
|
NULL, 0, &ip_dad_count, 0, |
|
CTL_NET, PF_INET, IPPROTO_IP, |
|
IPCTL_DAD_COUNT, CTL_EOL); |
|
#endif |
|
|
/* anonportalgo RFC6056 subtree */ |
/* anonportalgo RFC6056 subtree */ |
const struct sysctlnode *portalgo_node; |
const struct sysctlnode *portalgo_node; |