diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-07-12 11:24:23 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-07-12 11:24:23 +0000 |
commit | 4c7ba83f9db2f890811fe40838587a4d144df495 (patch) | |
tree | df8886cad41e9d4d2772fb7f3d2954732cad055b /sys | |
parent | edc37a66e34396fb480bab54650436095b9ac678 (diff) | |
download | src-4c7ba83f9db2f890811fe40838587a4d144df495.tar.gz src-4c7ba83f9db2f890811fe40838587a4d144df495.zip |
Notes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_var.h | 5 | ||||
-rw-r--r-- | sys/net/route/route_ctl.c | 34 | ||||
-rw-r--r-- | sys/netinet6/in6_rmx.c | 8 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 32 | ||||
-rw-r--r-- | sys/netinet6/nd6.h | 5 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 4 |
6 files changed, 21 insertions, 67 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 9388279aa1eb..67d95747a778 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -61,8 +61,6 @@ */ struct rtentry; /* ifa_rtrequest */ -struct nhop_object; /* ifa_rtrequest */ -struct rt_addrinfo; /* ifa_rtrequest */ struct socket; struct carp_if; struct carp_softc; @@ -551,9 +549,6 @@ struct ifaddr { struct ifnet *ifa_ifp; /* back-pointer to interface */ struct carp_softc *ifa_carp; /* pointer to CARP data */ CK_STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ - void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ - (int, struct rtentry *, struct nhop_object *, - struct rt_addrinfo *); u_short ifa_flags; /* mostly rt_flags for cloning */ #define IFA_ROUTE RTF_UP /* route installed */ #define IFA_RTSELF RTF_HOST /* loopback route to self installed */ diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a573a07178e4..ade0b2a96b24 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -79,7 +79,6 @@ struct rib_subscription { static void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, struct rib_cmd_info *rc); -static void rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info); static void destroy_subscription_epoch(epoch_context_t ctx); static struct rib_head * @@ -275,10 +274,8 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *info, if ((rn != NULL) || (rt_old != NULL)) rib_notify(rnh, RIB_NOTIFY_DELAYED, rc); - if (rt_old != NULL) { - rt_notifydelete(rt_old, info); + if (rt_old != NULL) rtfree(rt_old); - } /* * If it still failed to go into the tree, @@ -290,13 +287,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *info, return (EEXIST); } - /* - * If this protocol has something to add to this then - * allow it to do that as well. - */ - if (ifa->ifa_rtrequest) - ifa->ifa_rtrequest(RTM_ADD, rt, rt->rt_nhop, info); - RT_UNLOCK(rt); return (0); @@ -432,7 +422,6 @@ del_route(struct rib_head *rnh, struct rt_addrinfo *info, return (error); rib_notify(rnh, RIB_NOTIFY_DELAYED, rc); - rt_notifydelete(rt, info); /* * If the caller wants it, then it can have it, @@ -554,15 +543,9 @@ change_route_one(struct rib_head *rnh, struct rt_addrinfo *info, RT_LOCK(rt); /* Provide notification to the protocols.*/ - if ((nh_orig->nh_ifa != nh->nh_ifa) && nh_orig->nh_ifa->ifa_rtrequest) - nh_orig->nh_ifa->ifa_rtrequest(RTM_DELETE, rt, nh_orig, info); - rt->rt_nhop = nh; rt_setmetrics(info, rt); - if ((nh_orig->nh_ifa != nh->nh_ifa) && nh_orig->nh_ifa->ifa_rtrequest) - nh_orig->nh_ifa->ifa_rtrequest(RTM_DELETE, rt, nh_orig, info); - /* Finalize notification */ rc->rc_rt = rt; rc->rc_nh_old = nh_orig; @@ -641,19 +624,6 @@ rib_action(uint32_t fibnum, int action, struct rt_addrinfo *info, } -static void -rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info) -{ - struct ifaddr *ifa; - - /* - * give the protocol a chance to keep things in sync. - */ - ifa = rt->rt_nhop->nh_ifa; - if (ifa != NULL && ifa->ifa_rtrequest != NULL) - ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop, info); -} - struct rt_delinfo { struct rt_addrinfo info; @@ -749,8 +719,6 @@ rib_walk_del(u_int fibnum, int family, rt_filter_f_t *filter_f, void *arg, bool di.info.rti_info[RTAX_DST] = rt_key(rt); di.info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rt_notifydelete(rt, &di.info); - if (report) rt_routemsg(RTM_DELETE, rt, rt->rt_nhop->nh_ifp, 0, fibnum); diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c index 54cf0dcb23c2..5600feee8e6a 100644 --- a/sys/netinet6/in6_rmx.c +++ b/sys/netinet6/in6_rmx.c @@ -150,6 +150,7 @@ rib6_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *ma int in6_inithead(void **head, int off, u_int fibnum) { + struct epoch_tracker et; struct rib_head *rh; rh = rt_table_init(offsetof(struct sockaddr_in6, sin6_addr) << 3, @@ -163,6 +164,13 @@ in6_inithead(void **head, int off, u_int fibnum) #endif *head = (void *)rh; + NET_EPOCH_ENTER(et); + if (rib_subscribe(fibnum, AF_INET6, nd6_subscription_cb, NULL, + RIB_NOTIFY_IMMEDIATE, M_NOWAIT) == NULL) + log(LOG_ERR, "in6_inithead(): unable to subscribe to fib %u\n", + fibnum); + NET_EPOCH_EXIT(et); + return (1); } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 1438b1ccd93c..e2df8ad2aea3 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_dl.h> #include <net/if_types.h> #include <net/route.h> -#include <net/route/route_var.h> +#include <net/route/route_ctl.h> #include <net/route/nhop.h> #include <net/vnet.h> @@ -138,8 +138,6 @@ static void nd6_free_redirect(const struct llentry *); static void nd6_llinfo_timer(void *); static void nd6_llinfo_settimer_locked(struct llentry *, long); static void clear_llinfo_pqueue(struct llentry *); -static void nd6_rtrequest(int, struct rtentry *, struct nhop_object *, - struct rt_addrinfo *); static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); static int nd6_need_cache(struct ifnet *); @@ -1580,39 +1578,24 @@ nd6_free_redirect(const struct llentry *ln) } /* - * Rejuvenate this function for routing operations related - * processing. + * Updates status of the default router route. */ void -nd6_rtrequest(int req, struct rtentry *rt, struct nhop_object *nh, - struct rt_addrinfo *info) +nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg) { - struct sockaddr_in6 *gateway; struct nd_defrouter *dr; + struct nhop_object *nh; - gateway = &nh->gw6_sa; + if (rc->rc_cmd == RTM_DELETE) { + nh = rc->rc_nh_old; - switch (req) { - case RTM_ADD: - break; - - case RTM_DELETE: - /* - * Only indirect routes are interesting. - */ - if ((nh->nh_flags & NHF_GATEWAY) == 0) - return; - /* - * check for default route - */ if (nh->nh_flags & NHF_DEFAULT) { - dr = defrouter_lookup(&gateway->sin6_addr, nh->nh_ifp); + dr = defrouter_lookup(&nh->gw6_sa.sin6_addr, nh->nh_ifp); if (dr != NULL) { dr->installed = 0; defrouter_rele(dr); } } - break; } } @@ -2532,7 +2515,6 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) if (nd6_need_cache(ifp) == 0) return (0); - ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; dst = (struct sockaddr *)&ia->ia_addr; ln = lltable_alloc_entry(LLTABLE6(ifp), LLE_IFADDR, dst); if (ln == NULL) diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index b9f763ca17b8..a64c786efcc8 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -385,6 +385,11 @@ void nd6_rem_ifa_lle(struct in6_ifaddr *, int); int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, struct sockaddr_in6 *, struct route *); +struct rib_head; +struct rib_cmd_info; +void nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, + void *arg); + /* nd6_nbr.c */ void nd6_na_input(struct mbuf *, int, int); void nd6_na_output(struct ifnet *, const struct in6_addr *, diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 023fbb0e4175..1c5d219035d4 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -2014,10 +2014,6 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, struct ifaddr *ifa) u_long rtflags; int error, a_failure, fibnum, maxfib; - /* - * in6_ifinit() sets nd6_rtrequest to ifa_rtrequest for all ifaddrs. - * ifa->ifa_rtrequest = nd6_rtrequest; - */ bzero(&mask6, sizeof(mask6)); mask6.sin6_len = sizeof(mask6); mask6.sin6_addr = pr->ndpr_mask; |