batctl: Merge bugfixes from 2021.0
authorSven Eckelmann <sven@narfation.org>
Thu, 28 Jan 2021 20:34:50 +0000 (21:34 +0100)
committerSven Eckelmann <sven@narfation.org>
Thu, 28 Jan 2021 20:34:50 +0000 (21:34 +0100)
* Don't stop when create_interface detected existing interface
* Fix retrieval of meshif ap_isolation

Signed-off-by: Sven Eckelmann <sven@narfation.org>
batctl/Makefile
batctl/patches/0010-batctl-Don-t-stop-when-create_interface-detected-exi.patch [new file with mode: 0644]
batctl/patches/0011-batctl-Fix-retrieval-of-meshif-ap_isolation.patch [new file with mode: 0644]

index 97be7f3645e8d4a4aa7480d1f761e6475ca68979..129015f77ee49950f32b3af160cff35fbc92c703 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=batctl
 
 PKG_VERSION:=2019.2
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 PKG_HASH:=fb656208ff7d4cd8b1b422f60c9e6d8747302a347cbf6c199d7afa9b80f80ea3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/batctl/patches/0010-batctl-Don-t-stop-when-create_interface-detected-exi.patch b/batctl/patches/0010-batctl-Don-t-stop-when-create_interface-detected-exi.patch
new file mode 100644 (file)
index 0000000..b77d3cd
--- /dev/null
@@ -0,0 +1,31 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 15 Jan 2021 23:38:31 +0100
+Subject: batctl: Don't stop when create_interface detected existing interface
+
+"batctl meshif bat0 interface add ..." should never be called in parallel.
+But when something still does this, it could be that the code first detects
+the missing meshif and then tries to create it - which fails when another
+process requested the creation of the same interface slightly before batctl
+did it.
+
+But this should not prevent batctl to add the lower interface to the
+meshif. It is not really important that the batctl process was the one
+which created it - only that it exists is important.
+
+Fixes: 25022e0b154d ("batctl: Use rtnl to add/remove interfaces")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Origin: upstream, https://git.open-mesh.org/batctl.git/commit/5d465bfd9a19c4bda20fb4e36c6e4b22c56ceb17
+
+diff --git a/interface.c b/interface.c
+index 138a6cd45744081a04f986fe4be67901b3305b74..2c6a78ad17cb716fbb7f6a1c78e0076494397b01 100644
+--- a/interface.c
++++ b/interface.c
+@@ -479,7 +479,7 @@ static int interface(struct state *state, int argc, char **argv)
+       ifmaster = if_nametoindex(state->mesh_iface);
+       if (!manual_mode && !ifmaster && rest_argv[0][0] == 'a') {
+               ret = create_interface(state->mesh_iface);
+-              if (ret < 0) {
++              if (ret < 0 && ret != -EEXIST) {
+                       fprintf(stderr,
+                               "Error - failed to create batman-adv interface: %s\n",
+                               strerror(-ret));
diff --git a/batctl/patches/0011-batctl-Fix-retrieval-of-meshif-ap_isolation.patch b/batctl/patches/0011-batctl-Fix-retrieval-of-meshif-ap_isolation.patch
new file mode 100644 (file)
index 0000000..8b77612
--- /dev/null
@@ -0,0 +1,26 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 31 Oct 2020 18:00:26 +0100
+Subject: batctl: Fix retrieval of meshif ap_isolation
+
+The batadv command to retrieve the attributes is called
+BATADV_CMD_GET_MESH. The used BATADV_CMD_SET_MESH will only return the
+current settings via the "config" multicast group which is not evaluated by
+the ap_isolation command.
+
+Fixes: c56a63a5f12a ("batctl: Support generic netlink for ap_isolation command")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Origin: upstream, https://git.open-mesh.org/batctl.git/commit/107cee536a0f8024208923f49a2a548b40bfc432
+
+diff --git a/ap_isolation.c b/ap_isolation.c
+index 36fd4d607d03768251150951ebe450740501d446..4854bcd1d6514a02786388dc014966f326818122 100644
+--- a/ap_isolation.c
++++ b/ap_isolation.c
+@@ -36,7 +36,7 @@ static int get_attrs_ap_isolation(struct nl_msg *msg, void *arg)
+ static int get_ap_isolation(struct state *state)
+ {
+-      enum batadv_nl_commands nl_cmd = BATADV_CMD_SET_MESH;
++      enum batadv_nl_commands nl_cmd = BATADV_CMD_GET_MESH;
+       if (state->selector == SP_VLAN)
+               nl_cmd = BATADV_CMD_GET_VLAN;