]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
batman-adv: drop batman-adv specific version
authorSven Eckelmann <sven@narfation.org>
Fri, 15 May 2026 06:41:19 +0000 (08:41 +0200)
committerSven Eckelmann <sven@narfation.org>
Fri, 29 May 2026 19:15:59 +0000 (21:15 +0200)
Bumping the version number on the first pull request after each merge
window was deemed inappropriate for an in-tree component. The version
number carries little meaningful information in the context of the Linux
kernel release model, where stable and distribution might all carry
slightly different patches (without any change to the batman-adv version).

Instead, expose a UTS_RELEASE-based string to consumers of the netlink and
ethtool interfaces. To avoid recompilation for each (re)generate of
generated/utsrelease.h, init_utsname()->release is used in code which can
dynamically retrieve the version string. The MODULE_VERSION is moved to a
separate file because it doesn't support dynamic retrieval of the version
string (but constant "at compile time" string) and it is required for the
/sys/module/batman_adv/version. The latter is unfortunately still required
by userspace tools.

Link: https://lore.kernel.org/r/20210203163302.13e8a2a7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com
Link: https://lore.kernel.org/r/YnfjtpuAaH+Zkf9S@unreal
Link: https://lore.kernel.org/r/Y9faTA0rNSXg%2FsLD@nanopsycho
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/Makefile
net/batman-adv/main.c
net/batman-adv/main.h
net/batman-adv/mesh-interface.c
net/batman-adv/netlink.c
net/batman-adv/version.c [new file with mode: 0644]

index d3c4d4143c144280a7a410761ce85fdb4d0b1e71..5d7456f1240d7f4defc960e6a7ee4b0edb0e6a0b 100644 (file)
@@ -30,5 +30,6 @@ batman-adv-$(CONFIG_BATMAN_ADV_TRACING) += trace.o
 batman-adv-y += tp_meter.o
 batman-adv-y += translation-table.o
 batman-adv-y += tvlv.o
+batman-adv-y += version.o
 
 CFLAGS_trace.o := -I$(src)
index a4d33ee0fda59e22fd8c00a58d4278b53b6d7517..82bba34893788ac81e26a4003742523b11643b1c 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/sprintf.h>
 #include <linux/stddef.h>
 #include <linux/string.h>
+#include <linux/utsname.h>
 #include <linux/workqueue.h>
 #include <net/dsfield.h>
 #include <net/genetlink.h>
@@ -112,7 +113,7 @@ static int __init batadv_init(void)
        batadv_netlink_register();
 
        pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
-               BATADV_SOURCE_VERSION, BATADV_COMPAT_VERSION);
+               init_utsname()->release, BATADV_COMPAT_VERSION);
 
        return 0;
 
@@ -684,6 +685,5 @@ MODULE_LICENSE("GPL");
 
 MODULE_AUTHOR(BATADV_DRIVER_AUTHOR);
 MODULE_DESCRIPTION(BATADV_DRIVER_DESC);
-MODULE_VERSION(BATADV_SOURCE_VERSION);
 MODULE_ALIAS_RTNL_LINK("batadv");
 MODULE_ALIAS_GENL_FAMILY(BATADV_NL_NAME);
index af230b017bc179a3c33c5a0f3273e8bcdb8a50d8..f68fc8b7239cd534a366cbaf4dd1d2feb6efcad0 100644 (file)
 #define BATADV_DRIVER_DESC   "B.A.T.M.A.N. advanced"
 #define BATADV_DRIVER_DEVICE "batman-adv"
 
-#ifndef BATADV_SOURCE_VERSION
-#define BATADV_SOURCE_VERSION "2025.5"
-#endif
-
 /* B.A.T.M.A.N. parameters */
 
 #define BATADV_TQ_MAX_VALUE 255
index e7aa45bc6b7ad7c2c39ac2dee6ead4664cebf0ba..f25b861029575f548e3200609a27d229067c5064 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/stddef.h>
 #include <linux/string.h>
 #include <linux/types.h>
+#include <linux/utsname.h>
 #include <net/netlink.h>
 #include <net/rtnetlink.h>
 #include <uapi/linux/batadv_packet.h>
@@ -892,7 +893,7 @@ static void batadv_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
        strscpy(info->driver, "B.A.T.M.A.N. advanced", sizeof(info->driver));
-       strscpy(info->version, BATADV_SOURCE_VERSION, sizeof(info->version));
+       strscpy(info->version, init_utsname()->release, sizeof(info->version));
        strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
        strscpy(info->bus_info, "batman", sizeof(info->bus_info));
 }
index 78c651f634cd391938da358f87feab46099a74ef..b30f018740fcc49f08e97108c847f681c08dcd8a 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/skbuff.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
+#include <linux/utsname.h>
 #include <net/genetlink.h>
 #include <net/net_namespace.h>
 #include <net/netlink.h>
@@ -233,7 +234,7 @@ static int batadv_netlink_mesh_fill(struct sk_buff *msg,
        if (!hdr)
                return -ENOBUFS;
 
-       if (nla_put_string(msg, BATADV_ATTR_VERSION, BATADV_SOURCE_VERSION) ||
+       if (nla_put_string(msg, BATADV_ATTR_VERSION, init_utsname()->release) ||
            nla_put_string(msg, BATADV_ATTR_ALGO_NAME,
                           bat_priv->algo_ops->name) ||
            nla_put_u32(msg, BATADV_ATTR_MESH_IFINDEX, mesh_iface->ifindex) ||
diff --git a/net/batman-adv/version.c b/net/batman-adv/version.c
new file mode 100644 (file)
index 0000000..2b8006f
--- /dev/null
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <generated/utsrelease.h>
+#include <linux/module.h>
+
+/* WARNING userspace tools like batctl were relying on
+ * /sys/module/batman_adv/version to check if the module was loaded. If it
+ * isn't present, they usually error out before finishing setup of the batadv
+ * interface. It should be kept until it is unlikely that there are active
+ * installations of these "broken" versions of these tools with recent kernels.
+ */
+MODULE_VERSION(UTS_RELEASE);