]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipv6: move the disable_ipv6_mod knob to core code
authorJakub Kicinski <kuba@kernel.org>
Sat, 7 Mar 2026 20:50:53 +0000 (17:50 -0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Mar 2026 00:53:37 +0000 (17:53 -0700)
From: Jakub Kicinski <kuba@kernel.org>

Make sure disable_ipv6_mod itself is not part of the IPv6 module,
in case core code wants to refer to it. We will remove support
for IPv6=m soon, this change helps make fixes we commit before
that less messy.

Link: https://patch.msgid.link/20260307-net-nd_tbl_fixes-v4-1-e2677e85628c@suse.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/ipv6.h
net/ipv4/af_inet.c
net/ipv6/af_inet6.c

index 443053a76dcfdf16c069ca1eca488f36a06a8ca3..a7421382a91629c5693f4b4737f7d10f566bee4f 100644 (file)
@@ -333,7 +333,12 @@ struct tcp6_timewait_sock {
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
-bool ipv6_mod_enabled(void);
+extern int disable_ipv6_mod;
+
+static inline bool ipv6_mod_enabled(void)
+{
+       return disable_ipv6_mod == 0;
+}
 
 static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
index 8036e76aa1e473ba241f1f2ec37e038dccd3b6bd..c7731e300a442fa8fcb3f4af54c8c3fe6d7e99b1 100644 (file)
 
 #include <trace/events/sock.h>
 
+/* Keep the definition of IPv6 disable here for now, to avoid annoying linker
+ * issues in case IPv6=m
+ */
+int disable_ipv6_mod;
+EXPORT_SYMBOL(disable_ipv6_mod);
+
 /* The inetsw table contains everything that inet_create needs to
  * build a new socket.
  */
index 23cc9b4cb2f122975e8601f83b36c168784b9041..4cbd45b68088a92e6af9a2d027068ec7edfcb35b 100644 (file)
@@ -86,8 +86,6 @@ struct ipv6_params ipv6_defaults = {
        .autoconf = 1,
 };
 
-static int disable_ipv6_mod;
-
 module_param_named(disable, disable_ipv6_mod, int, 0444);
 MODULE_PARM_DESC(disable, "Disable IPv6 module such that it is non-functional");
 
@@ -97,12 +95,6 @@ MODULE_PARM_DESC(disable_ipv6, "Disable IPv6 on all interfaces");
 module_param_named(autoconf, ipv6_defaults.autoconf, int, 0444);
 MODULE_PARM_DESC(autoconf, "Enable IPv6 address autoconfiguration on all interfaces");
 
-bool ipv6_mod_enabled(void)
-{
-       return disable_ipv6_mod == 0;
-}
-EXPORT_SYMBOL_GPL(ipv6_mod_enabled);
-
 static struct ipv6_pinfo *inet6_sk_generic(struct sock *sk)
 {
        const int offset = sk->sk_prot->ipv6_pinfo_offset;