Search Linux Wireless

[PATCH] iw: strip NLA_FLAGS from printed bands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
Signed-off-by: Matthias May <matthias.may@xxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux