]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - info.c
info: macro-ify ext_feat_print()
[thirdparty/iw.git] / info.c
diff --git a/info.c b/info.c
index fbf3ee095f9c451d352f1d22e59349b46947ec2f..2381e019e30d0cf4749a0e4149fb4b9723c35042 100644 (file)
--- a/info.c
+++ b/info.c
@@ -69,13 +69,15 @@ static int ext_feature_isset(const unsigned char *ext_features, int ext_features
        return (ft_byte & BIT(ftidx % 8)) != 0;
 }
 
-static void ext_feat_print(const struct nlattr *tb,
-                          enum nl80211_ext_feature_index idx,
-                          const char *feature_name, const char *feature_desc)
+static void _ext_feat_print(const struct nlattr *tb,
+                           enum nl80211_ext_feature_index idx,
+                           const char *feature_name, const char *feature_desc)
 {
        if (ext_feature_isset(nla_data(tb), nla_len(tb),idx))
                printf("\t\t* [ %s ]: %s\n", feature_name, feature_desc);
 }
+#define ext_feat_print(tb, name, desc) \
+       _ext_feat_print(tb, NL80211_EXT_FEATURE_##name, #name, desc)
 
 static int print_phy_handler(struct nl_msg *msg, void *arg)
 {
@@ -162,7 +164,13 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                            tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
                                print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
                                               nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
+                       if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) {
+                               struct nlattr *nl_iftype;
+                               int rem_band;
 
+                               nla_for_each_nested(nl_iftype, tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band)
+                                       print_he_info(nl_iftype);
+                       }
                        if (tb_band[NL80211_BAND_ATTR_FREQS]) {
                                if (!band_had_freq) {
                                        printf("\t\tFrequencies:\n");
@@ -609,6 +617,12 @@ broken_combination:
                        printf("\tDevice supports configuring vdev MAC-addr on create.\n");
                if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)
                        printf("\tDevice supports TDLS channel switching\n");
+               if (features & NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR)
+                       printf("\tDevice supports randomizing MAC-addr in scans.\n");
+               if (features & NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR)
+                       printf("\tDevice supports randomizing MAC-addr in sched scans.\n");
+               if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
+                       printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
        }
 
        if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
@@ -619,75 +633,52 @@ broken_combination:
 
                printf("\tSupported extended features:\n");
 
-               ext_feat_print(tb, NL80211_EXT_FEATURE_VHT_IBSS,
-                              "VHT_IBSS", "VHT-IBSS");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_RRM,
-                              "RRM", "RRM");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER,
-                              "MU_MIMO_AIR_SNIFFER", "MU-MIMO sniffer");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_SCAN_START_TIME,
-                              "SCAN_START_TIME", "scan start timestamp");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_BSS_PARENT_TSF,
-                              "BSS_PARENT_TSF", "BSS last beacon/probe TSF");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_SET_SCAN_DWELL,
-                              "SET_SCAN_DWELL", "scan dwell setting");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
-                              "BEACON_RATE_LEGACY", "legacy beacon rate setting");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_BEACON_RATE_HT,
-                              "BEACON_RATE_HT", "HT beacon rate setting");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_BEACON_RATE_VHT,
-                              "BEACON_RATE_VHT", "VHT beacon rate setting");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_FILS_STA,
-                              "FILS_STA", "STA FILS (Fast Initial Link Setup)");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA,
-                              "MGMT_TX_RANDOM_TA",
+               ext_feat_print(tb, VHT_IBSS, "VHT-IBSS");
+               ext_feat_print(tb, RRM, "RRM");
+               ext_feat_print(tb, MU_MIMO_AIR_SNIFFER, "MU-MIMO sniffer");
+               ext_feat_print(tb, SCAN_START_TIME, "scan start timestamp");
+               ext_feat_print(tb, BSS_PARENT_TSF,
+                              "BSS last beacon/probe TSF");
+               ext_feat_print(tb, SET_SCAN_DWELL, "scan dwell setting");
+               ext_feat_print(tb, BEACON_RATE_LEGACY,
+                              "legacy beacon rate setting");
+               ext_feat_print(tb, BEACON_RATE_HT, "HT beacon rate setting");
+               ext_feat_print(tb, BEACON_RATE_VHT, "VHT beacon rate setting");
+               ext_feat_print(tb, FILS_STA,
+                              "STA FILS (Fast Initial Link Setup)");
+               ext_feat_print(tb, MGMT_TX_RANDOM_TA,
                               "randomized TA while not associated");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED,
-                              "MGMT_TX_RANDOM_TA_CONNECTED",
+               ext_feat_print(tb, MGMT_TX_RANDOM_TA_CONNECTED,
                               "randomized TA while associated");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
-                              "SCHED_SCAN_RELATIVE_RSSI",
+               ext_feat_print(tb, SCHED_SCAN_RELATIVE_RSSI,
                               "sched_scan for BSS with better RSSI report");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_CQM_RSSI_LIST,
-                              "CQM_RSSI_LIST",
+               ext_feat_print(tb, CQM_RSSI_LIST,
                               "multiple CQM_RSSI_THOLD records");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD,
-                              "FILS_SK_OFFLOAD",
+               ext_feat_print(tb, FILS_SK_OFFLOAD,
                               "FILS shared key authentication offload");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,
-                              "4WAY_HANDSHAKE_STA_PSK",
+               ext_feat_print(tb, 4WAY_HANDSHAKE_STA_PSK,
                               "4-way handshake with PSK in station mode");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X,
-                              "4WAY_HANDSHAKE_STA_1X",
+               ext_feat_print(tb, 4WAY_HANDSHAKE_STA_1X,
                               "4-way handshake with 802.1X in station mode");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME,
-                              "FILS_MAX_CHANNEL_TIME",
+               ext_feat_print(tb, FILS_MAX_CHANNEL_TIME,
                               "FILS max channel attribute override with dwell time");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP,
-                              "ACCEPT_BCAST_PROBE_RESP",
+               ext_feat_print(tb, ACCEPT_BCAST_PROBE_RESP,
                               "accepts broadcast probe response");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE,
-                              "OCE_PROBE_REQ_HIGH_TX_RATE",
+               ext_feat_print(tb, OCE_PROBE_REQ_HIGH_TX_RATE,
                               "probe request TX at high rate (at least 5.5Mbps)");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION,
-                              "OCE_PROBE_REQ_DEFERRAL_SUPPRESSION",
+               ext_feat_print(tb, OCE_PROBE_REQ_DEFERRAL_SUPPRESSION,
                               "probe request tx deferral and suppression");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_MFP_OPTIONAL,
-                              "MFP_OPTIONAL",
+               ext_feat_print(tb, MFP_OPTIONAL,
                               "MFP_OPTIONAL value in ATTR_USE_MFP");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
-                              "LOW_SPAN_SCAN", "low span scan");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_LOW_POWER_SCAN,
-                              "LOW_POWER_SCAN", "low power scan");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
-                              "HIGH_ACCURACY_SCAN", "high accuracy scan");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_DFS_OFFLOAD,
-                              "DFS_OFFLOAD", "DFS offload");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
-                              "CONTROL_PORT_OVER_NL80211",
+               ext_feat_print(tb, LOW_SPAN_SCAN, "low span scan");
+               ext_feat_print(tb, LOW_POWER_SCAN, "low power scan");
+               ext_feat_print(tb, HIGH_ACCURACY_SCAN, "high accuracy scan");
+               ext_feat_print(tb, DFS_OFFLOAD, "DFS offload");
+               ext_feat_print(tb, CONTROL_PORT_OVER_NL80211,
                               "control port over nl80211");
-               ext_feat_print(tb, NL80211_EXT_FEATURE_TXQS,
-                              "TXQS", "FQ-CoDel-enabled intermediate TXQs");
+               ext_feat_print(tb, TXQS, "FQ-CoDel-enabled intermediate TXQs");
+               ext_feat_print(tb, AIRTIME_FAIRNESS,
+                              "airtime fairness scheduling");
        }
 
        if (tb_msg[NL80211_ATTR_COALESCE_RULE]) {
@@ -718,7 +709,7 @@ static int handle_info(struct nl80211_state *state,
        char *feat_args[] = { "features", "-q" };
        int err;
 
-       err = handle_cmd(state, CIB_NONE, 2, feat_args);
+       err = handle_cmd(state, II_NONE, 2, feat_args);
        if (!err && nl80211_has_split_wiphy) {
                nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
                nlmsg_hdr(msg)->nlmsg_flags |= NLM_F_DUMP;