Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/ip_icmp.c
Show First 20 Lines • Show All 758 Lines • ▼ Show 20 Lines | |||||
icmp_reflect(struct mbuf *m) | icmp_reflect(struct mbuf *m) | ||||
{ | { | ||||
struct rm_priotracker in_ifa_tracker; | struct rm_priotracker in_ifa_tracker; | ||||
struct ip *ip = mtod(m, struct ip *); | struct ip *ip = mtod(m, struct ip *); | ||||
struct ifaddr *ifa; | struct ifaddr *ifa; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct in_ifaddr *ia; | struct in_ifaddr *ia; | ||||
struct in_addr t; | struct in_addr t; | ||||
struct nhop4_extended nh_ext; | struct nhop_object *nh; | ||||
struct mbuf *opts = NULL; | struct mbuf *opts = NULL; | ||||
int optlen = (ip->ip_hl << 2) - sizeof(struct ip); | int optlen = (ip->ip_hl << 2) - sizeof(struct ip); | ||||
NET_EPOCH_ASSERT(); | NET_EPOCH_ASSERT(); | ||||
if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || | if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || | ||||
IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) || | IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) || | ||||
IN_ZERONET(ntohl(ip->ip_src.s_addr)) ) { | IN_ZERONET(ntohl(ip->ip_src.s_addr)) ) { | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (V_reply_src[0] != '\0' && (ifp = ifunit(V_reply_src))) { | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* If the packet was transiting through us, use the address of | * If the packet was transiting through us, use the address of | ||||
* the interface that is the closest to the packet source. | * the interface that is the closest to the packet source. | ||||
* When we don't have a route back to the packet source, stop here | * When we don't have a route back to the packet source, stop here | ||||
* and drop the packet. | * and drop the packet. | ||||
*/ | */ | ||||
if (fib4_lookup_nh_ext(M_GETFIB(m), ip->ip_dst, 0, 0, &nh_ext) != 0) { | nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE, 0); | ||||
if (nh == NULL) { | |||||
m_freem(m); | m_freem(m); | ||||
ICMPSTAT_INC(icps_noroute); | ICMPSTAT_INC(icps_noroute); | ||||
goto done; | goto done; | ||||
} | } | ||||
t = nh_ext.nh_src; | t = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr; | ||||
match: | match: | ||||
#ifdef MAC | #ifdef MAC | ||||
mac_netinet_icmp_replyinplace(m); | mac_netinet_icmp_replyinplace(m); | ||||
#endif | #endif | ||||
ip->ip_src = t; | ip->ip_src = t; | ||||
ip->ip_ttl = V_ip_defttl; | ip->ip_ttl = V_ip_defttl; | ||||
if (optlen > 0) { | if (optlen > 0) { | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |