Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177570641
D61577.1794768045.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61577.1794768045.diff
View Options
diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c
--- a/sys/net/route/fib_algo.c
+++ b/sys/net/route/fib_algo.c
@@ -734,7 +734,11 @@
return (result == FLM_SUCCESS);
}
-static bool
+/*
+ * Fills in queue entry @ce with the change described by @rc.
+ * The caller holds the reference to the new nexthop.
+ */
+static void
fill_change_entry(struct fib_data *fd, struct fib_change_entry *ce, struct rib_cmd_info *rc)
{
int plen = 0;
@@ -755,12 +759,6 @@
ce->plen = plen;
ce->nh_old = rc->rc_nh_old;
ce->nh_new = rc->rc_nh_new;
- if (ce->nh_new != NULL) {
- if (fib_ref_nhop(fd, ce->nh_new) == 0)
- return (false);
- }
-
- return (true);
}
static bool
@@ -787,7 +785,9 @@
q->size = q_size;
}
- return (fill_change_entry(fd, &q->entries[q->count++], rc));
+ fill_change_entry(fd, &q->entries[q->count++], rc);
+
+ return (true);
}
/*
@@ -827,25 +827,12 @@
return;
}
- /*
- * Algo requested updates to be delivered in batches.
- * Add the current change to the queue and return.
- */
- if (fd->fd_batch) {
- if (immediate_sync) {
- if (!queue_rtable_change(fd, rc) || !apply_rtable_changes(fd))
- rebuild_fd(fd, "batch sync failed");
- } else {
- if (!queue_rtable_change(fd, rc))
- schedule_fd_rebuild(fd, "batch queue failed");
- }
- return;
- }
-
/*
* Maintain guarantee that every nexthop returned by the dataplane
* lookup has > 0 refcount, so can be safely referenced within current
* epoch.
+ * This is the only reference taken for the change, no matter if it
+ * is applied right away or queued for the batched update.
*/
if (rc->rc_nh_new != NULL) {
if (fib_ref_nhop(fd, rc->rc_nh_new) == 0) {
@@ -857,6 +844,21 @@
}
}
+ /*
+ * Algo requested updates to be delivered in batches.
+ * Add the current change to the queue and return.
+ */
+ if (fd->fd_batch) {
+ if (immediate_sync) {
+ if (!queue_rtable_change(fd, rc) || !apply_rtable_changes(fd))
+ rebuild_fd(fd, "batch sync failed");
+ } else {
+ if (!queue_rtable_change(fd, rc))
+ schedule_fd_rebuild(fd, "batch queue failed");
+ }
+ return;
+ }
+
result = fd->fd_flm->flm_change_rib_item_cb(rnh, rc, fd->fd_algo_data);
switch (result) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 6:40 PM (23 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41746919
Default Alt Text
D61577.1794768045.diff (2 KB)
Attached To
Mode
D61577: route/fib_algo: Fix nexthop reference leak on FLM_BATCH
Attached
Detach File
Event Timeline