[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231221154432.36353-1-matthias.may@westermo.com>
Date: Thu, 21 Dec 2023 15:44:44 +0000
From: Matthias May <Matthias.May@...termo.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: Matthias May <Matthias.May@...termo.com>,
Zefir Kurtisi
<Zefir.Kurtisi@...termo.com>
Subject: [PATCH] iw: strip NLA_FLAGS from printed bands
nl_band->nla_type might have NLA_F_NESTED (0x8000) set,
causing 'Bands' to be displayed with an according offset
when used directly.
Use the nla_type() macro instead to strip flags for
printing.
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@...termo.com>
Signed-off-by: Matthias May <matthias.may@...termo.com>
---
info.c | 2 +-
phy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/info.c b/info.c
index 317e7a3..5334436 100644
--- a/info.c
+++ b/info.c
@@ -354,7 +354,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
if (tb_msg[NL80211_ATTR_WIPHY_BANDS]) {
nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) {
if (last_band != nl_band->nla_type) {
- printf("\tBand %d:\n", nl_band->nla_type + 1);
+ printf("\tBand %d:\n", nla_type(nl_band) + 1);
band_had_freq = false;
}
last_band = nl_band->nla_type;
diff --git a/phy.c b/phy.c
index 4722125..ebd7289 100644
--- a/phy.c
+++ b/phy.c
@@ -52,7 +52,7 @@ static int print_channels_handler(struct nl_msg *msg, void *arg)
if (tb_msg[NL80211_ATTR_WIPHY_BANDS]) {
nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) {
if (ctx->last_band != nl_band->nla_type) {
- printf("Band %d:\n", nl_band->nla_type + 1);
+ printf("Band %d:\n", nla_type(nl_band) + 1);
ctx->width_40 = false;
ctx->width_80 = false;
ctx->width_160 = false;
--
2.39.2
Powered by blists - more mailing lists