Remove redundant checks for nhop validity.

Currently NH_IS_VALID() simly aliases to RT_LINK_IS_UP(), so we're
 checking the same thing twice.

In the near future the implementation of this check will be simpler,
 as there are plans to introduce control-plane interface status monitoring
 similar to ipfw interface tracker.
This commit is contained in:
Alexander V. Chernikov 2020-05-17 15:32:36 +00:00
parent cd3acfe7f3
commit 174fb9dbb1

View File

@ -407,8 +407,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
* Also check whether routing cache needs invalidation. * Also check whether routing cache needs invalidation.
*/ */
if (ro != NULL && ro->ro_nh != NULL && if (ro != NULL && ro->ro_nh != NULL &&
((!NH_IS_VALID(ro->ro_nh)) || !RT_LINK_IS_UP(ro->ro_nh->nh_ifp) || ((!NH_IS_VALID(ro->ro_nh)) || dst->sin_family != AF_INET ||
dst->sin_family != AF_INET ||
dst->sin_addr.s_addr != ip->ip_dst.s_addr)) dst->sin_addr.s_addr != ip->ip_dst.s_addr))
RO_INVALIDATE_CACHE(ro); RO_INVALIDATE_CACHE(ro);
ia = NULL; ia = NULL;
@ -480,8 +479,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0, ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0,
NHR_REF, flowid); NHR_REF, flowid);
if (ro->ro_nh == NULL || (!NH_IS_VALID(ro->ro_nh)) || if (ro->ro_nh == NULL || (!NH_IS_VALID(ro->ro_nh))) {
!RT_LINK_IS_UP(ro->ro_nh->nh_ifp)) {
#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