mirror of
https://github.com/openwrt/routing.git
synced 2025-12-21 21:24:32 +04:00
batctl: Merge bugfixes from 2025.3
* event: Fix direct parsing on hardif for set_hardif * avoid memory leak in print_routing_algos Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batctl
|
||||
PKG_VERSION:=2024.3
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Sun, 3 Aug 2025 08:48:40 +0200
|
||||
Subject: batctl: event: Fix direct parsing on hardif for set_hardif
|
||||
|
||||
The code to get the hard interface name for an even was accidentally
|
||||
checking for BATADV_ATTR_MESH_IFNAME instead of BATADV_ATTR_HARD_IFNAME. As
|
||||
result, the fallback code was always used when BATADV_ATTR_MESH_IFNAME
|
||||
would have not been available.
|
||||
|
||||
Luckily, at the moment, BATADV_ATTR_HARD_IFNAME is always available when
|
||||
BATADV_ATTR_MESH_IFNAME is set BATADV_CMD_SET_HARDIF events.
|
||||
|
||||
Fixes: d12322eeb361 ("batctl: event: Get ifname from netlink message")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batctl.git/commit/?id=03288f4f3060591dbc33600b4e5f6371d6a9f4ff
|
||||
|
||||
--- a/event.c
|
||||
+++ b/event.c
|
||||
@@ -320,7 +320,7 @@ static void event_parse_set_hardif(struc
|
||||
return;
|
||||
}
|
||||
|
||||
- if (attrs[BATADV_ATTR_MESH_IFNAME]) {
|
||||
+ if (attrs[BATADV_ATTR_HARD_IFNAME]) {
|
||||
hardif_name = nla_get_string(attrs[BATADV_ATTR_HARD_IFNAME]);
|
||||
} else {
|
||||
/* compatibility for Linux < 5.14/batman-adv < 2021.2 */
|
||||
@@ -0,0 +1,31 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Sun, 3 Aug 2025 08:49:12 +0200
|
||||
Subject: batctl: Avoid memory leak in print_routing_algos
|
||||
|
||||
The opts.remaining_header string is alocated before the netlink callback
|
||||
object is created. But the callback object allocation can fail and the
|
||||
function will return in this case. To fix this, either the string buffer
|
||||
must be freed in this case or the opts.remaining_header allocation can
|
||||
simply be moved to a later point.
|
||||
|
||||
Fixes: 0a14f8800dac ("batctl: Handle nl_cb_alloc errors")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batctl.git/commit/?id=9363370cee11af3687ebef028f7c4518107ea424
|
||||
|
||||
--- a/routing_algo.c
|
||||
+++ b/routing_algo.c
|
||||
@@ -96,12 +96,12 @@ static int print_routing_algos(struct st
|
||||
nl_send_auto_complete(state->sock, msg);
|
||||
nlmsg_free(msg);
|
||||
|
||||
- opts.remaining_header = strdup("Available routing algorithms:\n");
|
||||
-
|
||||
cb = nl_cb_alloc(NL_CB_DEFAULT);
|
||||
if (!cb)
|
||||
return -ENOMEM;
|
||||
|
||||
+ opts.remaining_header = strdup("Available routing algorithms:\n");
|
||||
+
|
||||
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, netlink_print_common_cb,
|
||||
&opts);
|
||||
nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, netlink_stop_callback, NULL);
|
||||
Reference in New Issue
Block a user