Thread (20 messages) flat view 20 messages, 2 authors, 14h ago

Re: [PATCH v5 net-next 12/15] neighbour: Namespacify neigh_tables.

From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-09-02 16:53:43

On Wed, Sep 2, 2026 at 6:29 AM Ido Schimmel [off-list ref] wrote:
On Tue, Sep 01, 2026 at 06:33:01PM +0000, Kuniyuki Iwashima wrote:
quoted
+static void neigh_table_inherit(struct net *net, struct neigh_table *tbl,
+                             int index)
+{
+     const struct neigh_table *init_tbl = init_net.neigh_tables[index];
+     bool inherit = READ_ONCE(sysctl_neigh_inherit_init_net);
+     int i;
+
+     if (net_eq(net, &init_net) || !inherit)
+             return;
+
+     tbl->gc_interval = READ_ONCE(init_tbl->gc_interval);
+     tbl->gc_thresh1 = READ_ONCE(init_tbl->gc_thresh1);
+     tbl->gc_thresh2 = READ_ONCE(init_tbl->gc_thresh2);
+     tbl->gc_thresh3 = READ_ONCE(init_tbl->gc_thresh3);
+
+     for (i = 0; i < NEIGH_VAR_DATA_MAX; i++)
+             tbl->parms.data[i] = READ_ONCE(init_tbl->parms.data[i]);
 }
[...]
quoted
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index eb35da3556f4..53e044fc53b0 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -21,6 +21,7 @@

 #include <net/ip.h>
 #include <net/sock.h>
+#include <net/neighbour.h>
 #include <net/net_ratelimit.h>
 #include <net/busy_poll.h>
 #include <net/pkt_sched.h>
@@ -53,6 +54,8 @@ EXPORT_SYMBOL(sysctl_fb_tunnels_only_for_init_net);
 int sysctl_devconf_inherit_init_net __read_mostly;
 EXPORT_SYMBOL(sysctl_devconf_inherit_init_net);

+int sysctl_neigh_inherit_init_net __read_mostly = 1;
This fails to build with CONFIG_SYSCTL=n (yes, unlikely config):
Oh, thanks for catching this !

Will squash the diff.

Thanks !

---
pw-bot: cr
quoted hunk ↗ jump to hunk
$ vng -b
/usr/bin/x86_64-linux-gnu-ld.bfd: vmlinux.o: in function `neigh_table_inherit':
/home/idosch/.virtme/net/core/neighbour.c:1920:(.text+0xc8ddd9): undefined reference to `sysctl_neigh_inherit_init_net'
make[2]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1
make[1]: *** [/data/idosch/virtme-build/Makefile:1376: vmlinux] Error 2
make: *** [Makefile:248: __sub-make] Error 2

$ grep CONFIG_SYSCTL .config
CONFIG_SYSCTL_EXCEPTION_TRACE=y
# CONFIG_SYSCTL is not set

Can be fixed with the following diff:
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 9b28f40b019a..27602bcbeb69 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1913,6 +1913,8 @@ static void neigh_table_clear(struct net *net, struct neigh_table *tbl)
        neigh_table_put(tbl);
 }

+int sysctl_neigh_inherit_init_net __read_mostly = 1;
+
 static void neigh_table_inherit(struct net *net, struct neigh_table *tbl,
                                int index)
 {
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 53e044fc53b0..23310581f494 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -54,8 +54,6 @@ EXPORT_SYMBOL(sysctl_fb_tunnels_only_for_init_net);
 int sysctl_devconf_inherit_init_net __read_mostly;
 EXPORT_SYMBOL(sysctl_devconf_inherit_init_net);

-int sysctl_neigh_inherit_init_net __read_mostly = 1;
-
 #if IS_ENABLED(CONFIG_NET_FLOW_LIMIT) || IS_ENABLED(CONFIG_RPS)
 static int dump_cpumask(void *buffer, size_t *lenp, loff_t *ppos,
                        struct cpumask *mask)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help