On Montag, 25. Juni 2018 14:31:19 CEST Omer Efrat wrote:
> Sven Eckelmann wrote:
> >Please fix the alignment:
> >
> >* Found wrong alignment at net/batman-adv/bat_v_elp.c:118, was 27 but expected 23
>
> checkpatch script doesn't catch this error.
> how do I see this?
I saw it with my eyes. But the script bracket_align.py [1] prints the actual
message.
Kind regards,
Sven
[1] https://git.open-mesh.org/build_test.git/blob/HEAD:/testhelpers/bracket_ali…
Hi all,
we have a bunch of ARM-based Linux boards running a 4.9 kernel and a we
set up a mesh with protocol version IV; this more or less works, but I'd
like to try the lastest b.a.t.m.an. release for testing.
Has anyone written a bitbake recipe for compiling the standalone version
yet?
Thanks for any pointers,
Simon
--
VoXel Interaction Design | http://www.voxel.at/
DI Dr.techn. Simon Vogl | simon(a)voxel.at
Tomaschekweg 46 | +43 650 2323 555
A-4040 Linz - Austria |
Office address: Industriezeile 35, 4020 Linz (2nd floor)
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).
Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.
This commit cleans up all usages of BIT macro with the above field
in batman-adv by changing it to BIT_ULL instead.
Signed-off-by: Omer Efrat <omer.efrat(a)tandemg.com>
---
net/batman-adv/bat_v_elp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 71c20c1..2f0de55 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -114,7 +114,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
- if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
+ if (!(sinfo.filled &
+ BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
goto default_throughput;
return sinfo.expected_throughput / 100;
--
2.7.4
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).
Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.
Note: The following patch series only does some code clean up.
The previous versions mentioned a bug fix but it appears as a mix up
with some local changes because NL80211_STA_INFO_TID_STATS value actually
equals 31.
Changes in v3:
- Better phrasing commit messages due to the above note
- Align patches to latest mac80211-next
Omer Efrat (5):
cfg80211: use BIT_ULL for NL80211_STA_INFO_* attribute types
mac80211: use BIT_ULL for NL80211_STA_INFO_* attribute types
batman-adv: use BIT_ULL for NL80211_STA_INFO_* attribute types
wireless-drivers: use BIT_ULL for NL80211_STA_INFO_ attribute types
staging: use BIT_ULL for NL80211_STA_INFO_* attribute types
drivers/net/wireless/ath/ath10k/mac.c | 4 +-
drivers/net/wireless/ath/ath6kl/cfg80211.c | 14 ++--
drivers/net/wireless/ath/wil6210/cfg80211.c | 18 ++---
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 40 +++++------
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 +-
drivers/net/wireless/marvell/libertas/cfg.c | 12 ++--
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 ++--
drivers/net/wireless/quantenna/qtnfmac/commands.c | 32 ++++-----
drivers/net/wireless/rndis_wlan.c | 4 +-
drivers/net/wireless/ti/wlcore/main.c | 2 +-
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 10 +--
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 ++--
drivers/staging/wlan-ng/cfg80211.c | 4 +-
net/batman-adv/bat_v_elp.c | 2 +-
net/mac80211/ethtool.c | 6 +-
net/mac80211/sta_info.c | 84 +++++++++++-----------
net/wireless/nl80211.c | 26 +++----
net/wireless/wext-compat.c | 10 +--
18 files changed, 151 insertions(+), 151 deletions(-)
--
2.7.4
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).
Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.
This commit cleans up all usages of BIT macro with the above field
in batman-adv by changing it to BIT_ULL instead.
Signed-off-by: Omer Efrat <omer.efrat(a)tandemg.com>
---
net/batman-adv/bat_v_elp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 71c20c1..71e6474 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -114,7 +114,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
- if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
+ if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
goto default_throughput;
return sinfo.expected_throughput / 100;
--
2.7.4
Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with NL80211_STA_INFO_* attribute types instead of BIT.
The BIT macro uses unsigned long type which some architectures handle as 32bit
and this results in compilation warnings such as:
net/mac80211/sta_info.c:2223:2: warning: left shift count >= width of type
sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
^
Signed-off-by: Omer Efrat <omer.efrat(a)tandemg.com>
---
net/batman-adv/bat_v_elp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 71c20c1..71e6474 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -114,7 +114,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
- if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
+ if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
goto default_throughput;
return sinfo.expected_throughput / 100;
--
2.7.4
Since commit 382d020fe3fa ("batman-adv: fix TT sync flag inconsistencies")
TT sync flags and TT non-sync'd flags are supposed to be stored
separately.
The previous patch missed to apply this separation on a TT entry with
only a single TT orig entry.
This is a minor fix because with only a single TT orig entry the DDoS
issue the former patch solves does not apply.
Fixes: 382d020fe3fa ("batman-adv: fix TT sync flag inconsistencies")
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
---
net/batman-adv/translation-table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 39865513..61ce3000 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1705,7 +1705,8 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
ether_addr_copy(common->addr, tt_addr);
common->vid = vid;
- common->flags = flags;
+ common->flags = flags & (~BATADV_TT_SYNC_MASK);
+
tt_global_entry->roam_at = 0;
/* node must store current time in case of roaming. This is
* needed to purge this entry out on timeout (if nobody claims
--
2.11.0
Most of the implementations behind cfg80211_get_station will not initialize
sinfo to zero before manipulating it. For example, the member "filled",
which indicates the filled in parts of this struct, is often only modified
by enabling certain bits in the bitfield while keeping the remaining bits
in their original state. A caller without a preinitialized sinfo.filled can
then no longer decide which parts of sinfo were filled in by
cfg80211_get_station (or actually the underlying implementations).
cfg80211_get_station must therefore take care that sinfo is initialized to
zero. Otherwise, the caller may tries to read information which was not
filled in and which must therefore also be considered uninitialized. In
batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
switch to non-optimal neighbors for certain destinations.
batman-adv's compat layer must take care of intializing sinfo until it is
fixed in the upstream kernel.
Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
Reported-by: Thomas Lauer <holminateur(a)gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
compat-include/net/cfg80211.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/compat-include/net/cfg80211.h b/compat-include/net/cfg80211.h
index 50031788..79c028af 100644
--- a/compat-include/net/cfg80211.h
+++ b/compat-include/net/cfg80211.h
@@ -43,6 +43,7 @@ static inline int cfg80211_get_station(struct net_device *dev,
#endif /* < KERNEL_VERSION(3, 16, 0) */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
#if !IS_ENABLED(CONFIG_CFG80211) && \
@@ -61,4 +62,21 @@ static inline int batadv_cfg80211_get_station(struct net_device *dev,
#endif /* < KERNEL_VERSION(4, 8, 0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) && IS_ENABLED(CONFIG_CFG80211)
+
+/* cfg80211 fix: https://patchwork.kernel.org/patch/10449857/ */
+static inline int batadv_cfg80211_get_station(struct net_device *dev,
+ const u8 *mac_addr,
+ struct station_info *sinfo)
+{
+ memset(sinfo, 0, sizeof(*sinfo));
+ return cfg80211_get_station(dev, mac_addr, sinfo);
+}
+
+#define cfg80211_get_station(dev, mac_addr, sinfo) \
+ batadv_cfg80211_get_station(dev, mac_addr, sinfo)
+
+#endif /* < KERNEL_VERSION(4, 18, 0) && IS_ENABLED(CONFIG_CFG80211) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_NET_CFG80211_H_ */
--
2.11.0