Index: sys/dev/cxgbe/iw_cxgbe/cm.c =================================================================== --- sys/dev/cxgbe/iw_cxgbe/cm.c +++ sys/dev/cxgbe/iw_cxgbe/cm.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -537,32 +538,29 @@ get_ifnet_from_raddr(struct sockaddr_storage *raddr, struct ifnet **ifp) { int err = 0; + struct nhop_object *nh; if (raddr->ss_family == AF_INET) { struct sockaddr_in *raddr4 = (struct sockaddr_in *)raddr; - struct nhop4_extended nh4 = {0}; - err = fib4_lookup_nh_ext(RT_DEFAULT_FIB, raddr4->sin_addr, - NHR_REF, 0, &nh4); - *ifp = nh4.nh_ifp; - if (err) - fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4); + nh = fib4_lookup(RT_DEFAULT_FIB, raddr4->sin_addr, 0, + NHR_NONE, 0); } else { struct sockaddr_in6 *raddr6 = (struct sockaddr_in6 *)raddr; - struct nhop6_extended nh6 = {0}; struct in6_addr addr6; uint32_t scopeid; memset(&addr6, 0, sizeof(addr6)); in6_splitscope((struct in6_addr *)&raddr6->sin6_addr, &addr6, &scopeid); - err = fib6_lookup_nh_ext(RT_DEFAULT_FIB, &addr6, scopeid, - NHR_REF, 0, &nh6); - *ifp = nh6.nh_ifp; - if (err) - fib6_free_nh_ext(RT_DEFAULT_FIB, &nh6); + nh = fib6_lookup(RT_DEFAULT_FIB, &addr6, scopeid, + NHR_NONE, 0); } + if (nh == NULL) + err = EHOSTUNREACH; + else + *ifp = nh->nh_ifp; CTR2(KTR_IW_CXGBE, "%s: return: %d", __func__, err); return err; } @@ -2639,9 +2637,11 @@ ref_qp(ep); ep->com.thread = curthread; + NET_EPOCH_ENTER(et); CURVNET_SET(vnet); err = get_ifnet_from_raddr(&cm_id->remote_addr, &nh_ifp); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); if (err) { Index: sys/dev/cxgbe/tom/t4_listen.c =================================================================== --- sys/dev/cxgbe/tom/t4_listen.c +++ sys/dev/cxgbe/tom/t4_listen.c @@ -1052,10 +1052,9 @@ struct l2t_entry *e; struct sockaddr_in6 sin6; struct sockaddr *dst = (void *)&sin6; + struct nhop_object *nh; if (inc->inc_flags & INC_ISIPV6) { - struct nhop6_basic nh6; - bzero(dst, sizeof(struct sockaddr_in6)); dst->sa_len = sizeof(struct sockaddr_in6); dst->sa_family = AF_INET6; @@ -1066,24 +1065,28 @@ return (e); } - if (fib6_lookup_nh_basic(RT_DEFAULT_FIB, &inc->inc6_faddr, - 0, 0, 0, &nh6) != 0) + nh = fib6_lookup(RT_DEFAULT_FIB, &inc->inc6_faddr, 0, NHR_NONE, 0); + if (nh == NULL) return (NULL); - if (nh6.nh_ifp != ifp) + if (nh->nh_ifp != ifp) return (NULL); - ((struct sockaddr_in6 *)dst)->sin6_addr = nh6.nh_addr; + if (nh->nh_flags & NHF_GATEWAY) + ((struct sockaddr_in6 *)dst)->sin6_addr = nh->gw6_sa.sin6_addr; + else + ((struct sockaddr_in6 *)dst)->sin6_addr = inc->inc6_faddr; } else { - struct nhop4_basic nh4; - dst->sa_len = sizeof(struct sockaddr_in); dst->sa_family = AF_INET; - if (fib4_lookup_nh_basic(RT_DEFAULT_FIB, inc->inc_faddr, 0, 0, - &nh4) != 0) + nh = fib4_lookup(RT_DEFAULT_FIB, inc->inc_faddr, 0, NHR_NONE, 0); + if (nh == NULL) return (NULL); - if (nh4.nh_ifp != ifp) + if (nh->nh_ifp != ifp) return (NULL); - ((struct sockaddr_in *)dst)->sin_addr = nh4.nh_addr; + if (nh->nh_flags & NHF_GATEWAY) + ((struct sockaddr_in *)dst)->sin_addr = nh->gw_sa.sin_addr; + else + ((struct sockaddr_in *)dst)->sin_addr = inc->inc_faddr; } e = t4_l2t_get(pi, ifp, dst);