Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103044986
D25614.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D25614.diff
View Options
Index: head/sys/net/route.c
===================================================================
--- head/sys/net/route.c
+++ head/sys/net/route.c
@@ -348,7 +348,7 @@
nhops_init_rib(rh);
/* Init subscription system */
- CK_STAILQ_INIT(&rh->rnh_subscribers);
+ rib_init_subscriptions(rh);
/* Finally, set base callbacks */
rh->rnh_addaddr = rn_addroute;
@@ -382,6 +382,8 @@
rn_walktree(&rh->rmhead.head, rt_freeentry, &rh->rmhead.head);
nhops_destroy_rib(rh);
+
+ rib_destroy_subscriptions(rh);
/* Assume table is already empty */
RIB_LOCK_DESTROY(rh);
Index: head/sys/net/route/route_ctl.c
===================================================================
--- head/sys/net/route/route_ctl.c
+++ head/sys/net/route/route_ctl.c
@@ -847,3 +847,28 @@
free(rs, M_RTABLE);
}
+
+void
+rib_init_subscriptions(struct rib_head *rnh)
+{
+
+ CK_STAILQ_INIT(&rnh->rnh_subscribers);
+}
+
+void
+rib_destroy_subscriptions(struct rib_head *rnh)
+{
+ struct rib_subscription *rs;
+ struct epoch_tracker et;
+
+ NET_EPOCH_ENTER(et);
+ RIB_WLOCK(rnh);
+ while ((rs = CK_STAILQ_FIRST(&rnh->rnh_subscribers)) != NULL) {
+ CK_STAILQ_REMOVE_HEAD(&rnh->rnh_subscribers, next);
+ epoch_call(net_epoch_preempt, destroy_subscription_epoch,
+ &rs->epoch_ctx);
+ }
+ RIB_WUNLOCK(rnh);
+ NET_EPOCH_EXIT(et);
+}
+
Index: head/sys/net/route/shared.h
===================================================================
--- head/sys/net/route/shared.h
+++ head/sys/net/route/shared.h
@@ -67,6 +67,10 @@
void nhops_update_ifmtu(struct rib_head *rh, struct ifnet *ifp, uint32_t mtu);
int nhops_dump_sysctl(struct rib_head *rh, struct sysctl_req *w);
+/* subscriptions */
+void rib_init_subscriptions(struct rib_head *rnh);
+void rib_destroy_subscriptions(struct rib_head *rnh);
+
/* route */
VNET_DECLARE(uma_zone_t, rtzone); /* Routing table UMA zone. */
#define V_rtzone VNET(rtzone)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 5:21 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14755258
Default Alt Text
D25614.diff (1 KB)
Attached To
Mode
D25614: Add destructor for the rib subscription system to simplify users code.
Attached
Detach File
Event Timeline
Log In to Comment