Index: head/sys/netinet/ip_icmp.c =================================================================== --- head/sys/netinet/ip_icmp.c +++ head/sys/netinet/ip_icmp.c @@ -764,7 +764,7 @@ struct ifnet *ifp; struct in_ifaddr *ia; struct in_addr t; - struct nhop4_extended nh_ext; + struct nhop_object *nh; struct mbuf *opts = NULL; int optlen = (ip->ip_hl << 2) - sizeof(struct ip); @@ -851,12 +851,13 @@ * When we don't have a route back to the packet source, stop here * 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); ICMPSTAT_INC(icps_noroute); goto done; } - t = nh_ext.nh_src; + t = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr; match: #ifdef MAC mac_netinet_icmp_replyinplace(m); Index: head/sys/netinet/ip_output.c =================================================================== --- head/sys/netinet/ip_output.c +++ head/sys/netinet/ip_output.c @@ -512,11 +512,10 @@ mtu = ifp->if_mtu; src = IA_SIN(ia)->sin_addr; } else { - struct nhop4_extended nh; + struct nhop_object *nh; - bzero(&nh, sizeof(nh)); - if (fib4_lookup_nh_ext(M_GETFIB(m), ip->ip_dst, 0, 0, &nh) != - 0) { + nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE, 0); + if (nh == NULL) { #if defined(IPSEC) || defined(IPSEC_SUPPORT) /* * There is no route for this packet, but it is @@ -530,8 +529,8 @@ error = EHOSTUNREACH; goto bad; } - ifp = nh.nh_ifp; - mtu = nh.nh_mtu; + ifp = nh->nh_ifp; + mtu = nh->nh_mtu; /* * We are rewriting here dst to be gw actually, contradicting * comment at the beginning of the function. However, in this @@ -540,10 +539,11 @@ * function, the dst would be rewritten by ip_output_pfil(). */ MPASS(dst == &sin); - dst->sin_addr = nh.nh_addr; - ia = nh.nh_ia; - src = nh.nh_src; - isbroadcast = (((nh.nh_flags & (NHF_HOST | NHF_BROADCAST)) == + if (nh->nh_flags & NHF_GATEWAY) + dst->sin_addr = nh->gw4_sa.sin_addr; + ia = ifatoia(nh->nh_ifa); + src = IA_SIN(ia)->sin_addr; + isbroadcast = (((nh->nh_flags & (NHF_HOST | NHF_BROADCAST)) == (NHF_HOST | NHF_BROADCAST)) || ((ifp->if_flags & IFF_BROADCAST) && in_ifaddr_broadcast(dst->sin_addr, ia)));