Index: head/sys/net/radix_mpath.h =================================================================== --- head/sys/net/radix_mpath.h +++ head/sys/net/radix_mpath.h @@ -54,7 +54,6 @@ struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *); int rt_mpath_conflict(struct rib_head *, struct rtentry *, struct sockaddr *); -void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); struct rtentry *rt_mpath_select(struct rtentry *, uint32_t); struct rtentry *rt_mpath_selectrte(struct rtentry *, uint32_t); int rt_mpath_deldup(struct rtentry *, struct rtentry *); Index: head/sys/net/radix_mpath.c =================================================================== --- head/sys/net/radix_mpath.c +++ head/sys/net/radix_mpath.c @@ -257,46 +257,6 @@ } void -rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) -{ - struct rtentry *rt, *rt_tmp; - - /* - * XXX we don't attempt to lookup cached route again; what should - * be done for sendto(3) case? - */ - if (ro->ro_nh && RT_LINK_IS_UP(ro->ro_nh->nh_ifp)) - return; - ro->ro_nh = NULL; - rt_tmp = rtalloc1_fib(&ro->ro_dst, 1, 0, fibnum); - - /* if the route does not exist or it is not multipath, don't care */ - if (rt_tmp == NULL) - return; - if (rn_mpath_next((struct radix_node *)rt_tmp) == NULL) { - ro->ro_nh = rt_tmp->rt_nhop; - nhop_ref_object(ro->ro_nh); - RT_UNLOCK(rt_tmp); - return; - } - - rt = rt_mpath_selectrte(rt_tmp, hash); - /* XXX try filling rt_gwroute and avoid unreachable gw */ - - /* gw selection has failed - there must be only zero weight routes */ - if (!rt) { - RT_UNLOCK(rt_tmp); - return; - } - if (rt_tmp != rt) { - RTFREE_LOCKED(rt_tmp); - ro->ro_nh = rt->rt_nhop; - nhop_ref_object(ro->ro_nh); - } else - RT_UNLOCK(rt_tmp); -} - -void rt_mpath_init_rnh(struct rib_head *rnh) { Index: head/sys/netinet/ip_input.c =================================================================== --- head/sys/netinet/ip_input.c +++ head/sys/netinet/ip_input.c @@ -954,6 +954,7 @@ struct sockaddr_in *sin; struct in_addr dest; struct route ro; + uint32_t flowid; int error, type = 0, code = 0, mtu = 0; NET_EPOCH_ASSERT(); @@ -978,13 +979,11 @@ sin->sin_len = sizeof(*sin); sin->sin_addr = ip->ip_dst; #ifdef RADIX_MPATH - rtalloc_mpath_fib(&ro, - ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), - M_GETFIB(m)); + flowid = ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr); #else - ro.ro_nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_REF, - m->m_pkthdr.flowid); + flowid = m->m_pkthdr.flowid; #endif + ro.ro_nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_REF, flowid); if (ro.ro_nh != NULL) { ia = ifatoia(ro.ro_nh->nh_ifa); } else Index: head/sys/netinet/ip_output.c =================================================================== --- head/sys/netinet/ip_output.c +++ head/sys/netinet/ip_output.c @@ -68,9 +68,6 @@ #include #include #include -#ifdef RADIX_MPATH -#include -#endif #include #include @@ -470,14 +467,15 @@ * layer, as this is probably required in all cases * for correct operation (as it is for ARP). */ + uint32_t flowid; #ifdef RADIX_MPATH - rtalloc_mpath_fib(ro, - ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), - fibnum); + flowid = ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr); #else - ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0, - NHR_REF, m->m_pkthdr.flowid); + flowid = m->m_pkthdr.flowid; #endif + ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0, + NHR_REF, flowid); + 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)