From: Ben Greear <greearb@xxxxxxxxxxxxxxx> Without this patch, a bunch of blank EHT fields are printed when iw phy info is run against an /ax phy devices. Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx> --- util.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index 8a2ba10..31b0308 100644 --- a/util.c +++ b/util.c @@ -1588,6 +1588,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) __u8 ppet[31] = { 0 }; __u16 he_phy_cap[6] = { 0 }; size_t len, mcs_len = 0, ppet_len = 0; + bool did_one = false; nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX, nla_data(nl_iftype), nla_len(nl_iftype), NULL); @@ -1595,11 +1596,8 @@ void print_eht_info(struct nlattr *nl_iftype, int band) if (!tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]) return; - printf("\t\tEHT Iftypes: "); - print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]); - printf("\n"); - if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]); if (len > sizeof(mac_cap)) len = sizeof(mac_cap); @@ -1609,6 +1607,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]); if (len > sizeof(phy_cap)) @@ -1620,6 +1619,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]); if (len > sizeof(mcs_set)) len = sizeof(mcs_set); @@ -1632,6 +1632,7 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]) { + did_one = true; len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]); if (len > sizeof(ppet)) len = sizeof(ppet); @@ -1651,6 +1652,13 @@ void print_eht_info(struct nlattr *nl_iftype, int band) len); } + if (!did_one) + return; + + printf("\t\tEHT Iftypes: "); + print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]); + printf("\n"); + __print_eht_capa(band, mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len, he_phy_cap, true); } -- 2.40.0