Page MenuHomeFreeBSD

D25615.diff
No OneTemporary

D25615.diff

Index: head/sys/net/if_var.h
===================================================================
--- head/sys/net/if_var.h
+++ head/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 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 */
Index: head/sys/net/route/route_ctl.c
===================================================================
--- head/sys/net/route/route_ctl.c
+++ head/sys/net/route/route_ctl.c
@@ -79,7 +79,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
-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;
@@ -748,8 +718,6 @@
/* TODO std rt -> rt_addrinfo export */
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,
Index: head/sys/netinet6/in6_rmx.c
===================================================================
--- head/sys/netinet6/in6_rmx.c
+++ head/sys/netinet6/in6_rmx.c
@@ -150,6 +150,7 @@
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,
@@ -162,6 +163,13 @@
rt_mpath_init_rnh(rh);
#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);
}
Index: head/sys/netinet6/nd6.h
===================================================================
--- head/sys/netinet6/nd6.h
+++ head/sys/netinet6/nd6.h
@@ -385,6 +385,11 @@
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 *,
Index: head/sys/netinet6/nd6.c
===================================================================
--- head/sys/netinet6/nd6.c
+++ head/sys/netinet6/nd6.c
@@ -62,7 +62,7 @@
#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_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 @@
}
/*
- * 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 @@
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)
Index: head/sys/netinet6/nd6_rtr.c
===================================================================
--- head/sys/netinet6/nd6_rtr.c
+++ head/sys/netinet6/nd6_rtr.c
@@ -2014,10 +2014,6 @@
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;

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 16, 7:17 AM (14 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16670696
Default Alt Text
D25615.diff (6 KB)

Event Timeline