Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/ip_output.c
Show First 20 Lines • Show All 506 Lines • ▼ Show 20 Lines | #endif | ||||
else | else | ||||
isbroadcast = 0; | isbroadcast = 0; | ||||
if (ro->ro_nh->nh_flags & NHF_HOST) | if (ro->ro_nh->nh_flags & NHF_HOST) | ||||
mtu = ro->ro_nh->nh_mtu; | mtu = ro->ro_nh->nh_mtu; | ||||
else | else | ||||
mtu = ifp->if_mtu; | mtu = ifp->if_mtu; | ||||
src = IA_SIN(ia)->sin_addr; | src = IA_SIN(ia)->sin_addr; | ||||
} else { | } else { | ||||
struct nhop4_extended nh; | struct nhop_object *nh; | ||||
bzero(&nh, sizeof(nh)); | nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE, 0); | ||||
if (fib4_lookup_nh_ext(M_GETFIB(m), ip->ip_dst, 0, 0, &nh) != | if (nh == NULL) { | ||||
0) { | |||||
#if defined(IPSEC) || defined(IPSEC_SUPPORT) | #if defined(IPSEC) || defined(IPSEC_SUPPORT) | ||||
/* | /* | ||||
* There is no route for this packet, but it is | * There is no route for this packet, but it is | ||||
* possible that a matching SPD entry exists. | * possible that a matching SPD entry exists. | ||||
*/ | */ | ||||
no_route_but_check_spd = 1; | no_route_but_check_spd = 1; | ||||
mtu = 0; /* Silence GCC warning. */ | mtu = 0; /* Silence GCC warning. */ | ||||
goto sendit; | goto sendit; | ||||
#endif | #endif | ||||
IPSTAT_INC(ips_noroute); | IPSTAT_INC(ips_noroute); | ||||
error = EHOSTUNREACH; | error = EHOSTUNREACH; | ||||
goto bad; | goto bad; | ||||
} | } | ||||
ifp = nh.nh_ifp; | ifp = nh->nh_ifp; | ||||
mtu = nh.nh_mtu; | mtu = nh->nh_mtu; | ||||
/* | /* | ||||
* We are rewriting here dst to be gw actually, contradicting | * We are rewriting here dst to be gw actually, contradicting | ||||
* comment at the beginning of the function. However, in this | * comment at the beginning of the function. However, in this | ||||
* case we are always dealing with on stack dst. | * case we are always dealing with on stack dst. | ||||
* In case if pfil(9) sends us back to beginning of the | * In case if pfil(9) sends us back to beginning of the | ||||
* function, the dst would be rewritten by ip_output_pfil(). | * function, the dst would be rewritten by ip_output_pfil(). | ||||
*/ | */ | ||||
MPASS(dst == &sin); | MPASS(dst == &sin); | ||||
dst->sin_addr = nh.nh_addr; | if (nh->nh_flags & NHF_GATEWAY) | ||||
ia = nh.nh_ia; | dst->sin_addr = nh->gw4_sa.sin_addr; | ||||
src = nh.nh_src; | ia = ifatoia(nh->nh_ifa); | ||||
isbroadcast = (((nh.nh_flags & (NHF_HOST | NHF_BROADCAST)) == | src = IA_SIN(ia)->sin_addr; | ||||
isbroadcast = (((nh->nh_flags & (NHF_HOST | NHF_BROADCAST)) == | |||||
(NHF_HOST | NHF_BROADCAST)) || | (NHF_HOST | NHF_BROADCAST)) || | ||||
((ifp->if_flags & IFF_BROADCAST) && | ((ifp->if_flags & IFF_BROADCAST) && | ||||
in_ifaddr_broadcast(dst->sin_addr, ia))); | in_ifaddr_broadcast(dst->sin_addr, ia))); | ||||
} | } | ||||
/* Catch a possible divide by zero later. */ | /* Catch a possible divide by zero later. */ | ||||
KASSERT(mtu > 0, ("%s: mtu %d <= 0, ro=%p (nh_flags=0x%08x) ifp=%p", | KASSERT(mtu > 0, ("%s: mtu %d <= 0, ro=%p (nh_flags=0x%08x) ifp=%p", | ||||
__func__, mtu, ro, | __func__, mtu, ro, | ||||
▲ Show 20 Lines • Show All 1,036 Lines • Show Last 20 Lines |