lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250624125115.3926152-1-wangliang74@huawei.com>
Date: Tue, 24 Jun 2025 20:51:15 +0800
From: Wang Liang <wangliang74@...wei.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
	<pabeni@...hat.com>, <horms@...nel.org>, <dsahern@...nel.org>
CC: <yuehaibing@...wei.com>, <zhangchangzhong@...wei.com>,
	<wangliang74@...wei.com>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: [PATCH net-next] net: add sysctl ndisc_debug

Ipv6 ndisc uses ND_PRINTK to print logs. However it only works when
ND_DEBUG was set in the compilation phase. This patch adds sysctl
ndisc_debug, so we can change the print switch when system is running and
get ipv6 ndisc log to debug.

Signed-off-by: Wang Liang <wangliang74@...wei.com>
---
 include/net/ndisc.h        | 5 ++---
 net/ipv6/ndisc.c           | 3 +++
 net/ipv6/sysctl_net_ipv6.c | 7 +++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 3c88d5bc5eed..481a7fc5d5c1 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -60,12 +60,11 @@ enum {
 
 #include <net/neighbour.h>
 
-/* Set to 3 to get tracing... */
-#define ND_DEBUG 1
+extern u8 ndisc_debug;
 
 #define ND_PRINTK(val, level, fmt, ...)				\
 do {								\
-	if (val <= ND_DEBUG)					\
+	if (val <= ndisc_debug)					\
 		net_##level##_ratelimited(fmt, ##__VA_ARGS__);	\
 } while (0)
 
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index ecb5c4b8518f..be4bb72b1d61 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -83,6 +83,9 @@ static void pndisc_destructor(struct pneigh_entry *n);
 static void pndisc_redo(struct sk_buff *skb);
 static int ndisc_is_multicast(const void *pkey);
 
+u8 ndisc_debug = 1;
+EXPORT_SYMBOL_GPL(ndisc_debug);
+
 static const struct neigh_ops ndisc_generic_ops = {
 	.family =		AF_INET6,
 	.solicit =		ndisc_solicit,
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index d2cd33e2698d..c0968f0c5d00 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -247,6 +247,13 @@ static struct ctl_table ipv6_rotable[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif /* CONFIG_NETLABEL */
+	{
+		.procname	= "ndisc_debug",
+		.data		= &ndisc_debug,
+		.maxlen		= sizeof(u8),
+		.mode		= 0644,
+		.proc_handler	= proc_dou8vec_minmax
+	},
 };
 
 static int __net_init ipv6_sysctl_net_init(struct net *net)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ