Index: head/sys/net/route.h =================================================================== --- head/sys/net/route.h +++ head/sys/net/route.h @@ -346,7 +346,8 @@ #define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ #define RTAX_MAX 8 /* size of array to allocate */ -typedef int rt_filter_f_t(const struct rtentry *, void *); +typedef int rt_filter_f_t(const struct rtentry *, const struct nhop_object *, + void *); struct rt_addrinfo { int rti_addrs; /* Route RTF_ flags */ Index: head/sys/net/route.c =================================================================== --- head/sys/net/route.c +++ head/sys/net/route.c @@ -143,7 +143,8 @@ static int rt_getifa_fib(struct rt_addrinfo *, u_int); static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *); -static int rt_ifdelroute(const struct rtentry *rt, void *arg); +static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *, + void *arg); static struct rtentry *rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo *info, int *perror); static void rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info); @@ -1124,6 +1125,7 @@ * * Arguments: * rt pointer to rtentry + * nh pointer to nhop * arg argument passed to rnh->rnh_walktree() - detaching interface * * Returns: @@ -1131,11 +1133,11 @@ * errno failed - reason indicated */ static int -rt_ifdelroute(const struct rtentry *rt, void *arg) +rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *nh, void *arg) { struct ifnet *ifp = arg; - if (rt->rt_ifp != ifp) + if (nh->nh_ifp != ifp) return (0); /* @@ -1203,7 +1205,7 @@ } if (info->rti_filter != NULL) { - if (info->rti_filter(rt, info->rti_filterdata) == 0) { + if (info->rti_filter(rt, rt->rt_nhop, info->rti_filterdata)==0){ /* Not matched */ *perror = ENOENT; return (NULL); Index: head/sys/net/route_temporal.c =================================================================== --- head/sys/net/route_temporal.c +++ head/sys/net/route_temporal.c @@ -51,7 +51,7 @@ * Updates time of the next nearest route expiration as a side effect. */ static int -expire_route(const struct rtentry *rt, void *arg) +expire_route(const struct rtentry *rt, const struct nhop_object *nh, void *arg) { time_t *next_callout; Index: head/sys/netinet/in_rmx.c =================================================================== --- head/sys/netinet/in_rmx.c +++ head/sys/netinet/in_rmx.c @@ -228,14 +228,15 @@ }; static int -in_ifadownkill(const struct rtentry *rt, void *xap) +in_ifadownkill(const struct rtentry *rt, const struct nhop_object *nh, + void *xap) { struct in_ifadown_arg *ap = xap; - if (rt->rt_ifa != ap->ifa) + if (nh->nh_ifa != ap->ifa) return (0); - if ((rt->rt_flags & RTF_STATIC) != 0 && ap->del == 0) + if ((nhop_get_rtflags(nh) & RTF_STATIC) != 0 && ap->del == 0) return (0); return (1); Index: head/sys/netinet6/nd6.c =================================================================== --- head/sys/netinet6/nd6.c +++ head/sys/netinet6/nd6.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -1526,14 +1527,15 @@ } static int -nd6_isdynrte(const struct rtentry *rt, void *xap) +nd6_isdynrte(const struct rtentry *rt, const struct nhop_object *nh, void *xap) { - if (rt->rt_flags == (RTF_UP | RTF_HOST | RTF_DYNAMIC)) + if (nh->nh_flags & NHF_REDIRECT) return (1); return (0); } + /* * Remove the rtentry for the given llentry, * both of which were installed by a redirect. Index: head/sys/netinet6/nd6_rtr.c =================================================================== --- head/sys/netinet6/nd6_rtr.c +++ head/sys/netinet6/nd6_rtr.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -2392,15 +2393,16 @@ } static int -rt6_deleteroute(const struct rtentry *rt, void *arg) +rt6_deleteroute(const struct rtentry *rt, const struct nhop_object *nh, + void *arg) { -#define SIN6(s) ((struct sockaddr_in6 *)s) struct in6_addr *gate = (struct in6_addr *)arg; + int nh_rt_flags; - if (rt->rt_gateway == NULL || rt->rt_gateway->sa_family != AF_INET6) + if (nh->gw_sa.sa_family != AF_INET6) return (0); - if (!IN6_ARE_ADDR_EQUAL(gate, &SIN6(rt->rt_gateway)->sin6_addr)) { + if (!IN6_ARE_ADDR_EQUAL(gate, &nh->gw6_sa.sin6_addr)) { return (0); } @@ -2409,14 +2411,15 @@ * XXX: this seems to be a bit ad-hoc. Should we consider the * 'cloned' bit instead? */ - if ((rt->rt_flags & RTF_STATIC) != 0) + nh_rt_flags = nhop_get_rtflags(nh); + if ((nh_rt_flags & RTF_STATIC) != 0) return (0); /* * We delete only host route. This means, in particular, we don't * delete default route. */ - if ((rt->rt_flags & RTF_HOST) == 0) + if ((nh_rt_flags & RTF_HOST) == 0) return (0); return (1);