Merge pull request #584 from ecsv/batadv-for-19.07

openwrt-19.07: batman-adv: Merge bugfixes from 2020.1
This commit is contained in:
Simon Wunderlich 2020-07-07 09:20:00 +02:00 committed by GitHub
commit ad79a0f065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 165 additions and 2 deletions

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batctl
PKG_VERSION:=2019.2
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_HASH:=fb656208ff7d4cd8b1b422f60c9e6d8747302a347cbf6c199d7afa9b80f80ea3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@ -0,0 +1,38 @@
From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 29 Apr 2020 12:09:44 +0200
Subject: batctl: fix endianness when reading radiotap header
All radiotap header fields are specified in little endian byte-order.
Header length conversion is necessary on some platforms.
Fixes: c6fcdb6dc9a9 ("batctl: add radiotap wifi packet decapsulation support")
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batctl.git/commit/440ae55a6ef96eb73ee628f9237915cf9fb26dee
diff --git a/tcpdump.c b/tcpdump.c
index 8106a6457ac1b000f2f802e4b0a751d783540b69..72c1869eb50d25c1f6b1e1fcae42199b9337cb4e 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -15,6 +15,7 @@
#include <time.h>
#include <sys/time.h>
#include <arpa/inet.h>
+#include <endian.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
@@ -1034,10 +1035,10 @@ static int monitor_header_length(unsigned char *packet_buff, ssize_t buff_len, i
return -1;
radiotap_hdr = (struct radiotap_header*)packet_buff;
- if (buff_len <= radiotap_hdr->it_len)
+ if (buff_len <= le16toh(radiotap_hdr->it_len))
return -1;
else
- return radiotap_hdr->it_len;
+ return le16toh(radiotap_hdr->it_len);
}
return -1;

View File

@ -0,0 +1,49 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Sat, 13 Jun 2020 17:59:34 +0200
Subject: batctl: Only remove batadv interface on hardif reduction
A deletion of a hardif from a batadv meshif will also get a success reply
from the kernel when the hardif was never part of the batadv meshif. If the
batadv meshif had no attached hardifs before the removal was started, then
users are then not expecting that the batadv meshif is removed at all.
Since the delete operation is not an atomic compare-and-swap operation,
just check first the number of attached interfaces and only start the
removal of the batadv meshif when the number attached hardifs was reduced.
Fixes: 25022e0b154d ("batctl: Use rtnl to add/remove interfaces")
Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batctl.git/commit/6d49a82cf58ee5ebd6235b6ddaca46febd42f876
diff --git a/interface.c b/interface.c
index 0a694c9f41f71a3dd72ae87b79b28434f7e8918f..138a6cd45744081a04f986fe4be67901b3305b74 100644
--- a/interface.c
+++ b/interface.c
@@ -386,6 +386,7 @@ static int interface(struct state *state, int argc, char **argv)
int ret;
unsigned int ifindex;
unsigned int ifmaster;
+ unsigned int pre_cnt;
const char *long_op;
unsigned int cnt;
int rest_argc;
@@ -502,6 +503,8 @@ static int interface(struct state *state, int argc, char **argv)
goto err;
}
+ pre_cnt = count_interfaces(state->mesh_iface);
+
for (i = 1; i < rest_argc; i++) {
ifindex = if_nametoindex(rest_argv[i]);
@@ -531,7 +534,7 @@ static int interface(struct state *state, int argc, char **argv)
/* check if there is no interface left and then destroy mesh_iface */
if (!manual_mode && rest_argv[0][0] == 'd') {
cnt = count_interfaces(state->mesh_iface);
- if (cnt == 0)
+ if (cnt == 0 && pre_cnt > 0)
destroy_interface(state->mesh_iface);
}

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2019.2
PKG_RELEASE:=7
PKG_RELEASE:=8
PKG_HASH:=70c3f6a6cf88d2b25681a76768a52ed92d9fe992ba8e358368b6a8088757adc8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@ -0,0 +1,76 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Mon, 25 Nov 2019 10:46:50 +0100
Subject: batman-adv: Revert "disable ethtool link speed detection when auto negotiation off"
The commit d60b8fc69ef2 ("batman-adv: disable ethtool link speed detection
when auto negotiation off") disabled the usage of ethtool's link_ksetting
when auto negotation was enabled due to invalid values when used with
tun/tap virtual net_devices. According to the patch, automatic measurements
should be used for these kind of interfaces.
But there are major flaws with this argumentation:
* automatic measurements are not implemented
* auto negotiation has nothing to do with the validity of the retrieved
values
The first point has to be fixed by a longer patch series. The "validity"
part of the second point must be addressed in the same patch series by
dropping the usage of ethtool's link_ksetting (thus always doing automatic
measurements over ethernet).
Drop the patch again to have more default values for various net_device
types/configurations. The user can still overwrite them using the
batadv_hardif's BATADV_ATTR_THROUGHPUT_OVERRIDE.
Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6e860b3d5e4147bafcda32bf9b3e769926f232c5
diff --git a/compat-include/linux/ethtool.h b/compat-include/linux/ethtool.h
index e1f39c3377febbd650a75206aafa9ae3e807762a..8dcbe02c3decf941e892af70a0a67653b010e65e 100644
--- a/compat-include/linux/ethtool.h
+++ b/compat-include/linux/ethtool.h
@@ -21,7 +21,6 @@ struct batadv_ethtool_link_ksettings {
struct {
__u32 speed;
__u8 duplex;
- __u8 autoneg;
} base;
};
@@ -42,7 +41,6 @@ batadv_ethtool_get_link_ksettings(struct net_device *dev,
return ret;
link_ksettings->base.duplex = cmd.duplex;
- link_ksettings->base.autoneg = cmd.autoneg;
link_ksettings->base.speed = ethtool_cmd_speed(&cmd);
return 0;
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 2614a9caee008539cc489b71dabdc36ac0ae3752..a39af0eefad313101812118181ec0376b21b79bb 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -120,20 +120,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
rtnl_lock();
ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
rtnl_unlock();
-
- /* Virtual interface drivers such as tun / tap interfaces, VLAN, etc
- * tend to initialize the interface throughput with some value for the
- * sake of having a throughput number to export via ethtool. This
- * exported throughput leaves batman-adv to conclude the interface
- * throughput is genuine (reflecting reality), thus no measurements
- * are necessary.
- *
- * Based on the observation that those interface types also tend to set
- * the link auto-negotiation to 'off', batman-adv shall check this
- * setting to differentiate between genuine link throughput information
- * and placeholders installed by virtual interfaces.
- */
- if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) {
+ if (ret == 0) {
/* link characteristics might change over time */
if (link_settings.base.duplex == DUPLEX_FULL)
hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;