]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
info: print out supported interface types
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 7 Aug 2008 15:18:13 +0000 (17:18 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Thu, 7 Aug 2008 15:18:13 +0000 (17:18 +0200)
info.c

diff --git a/info.c b/info.c
index 2e98e18dde84ed3d3fd7d1249faffd4145a12b5d..694a5584cf967e7d403fdc78b6a43e95649ca213 100644 (file)
--- a/info.c
+++ b/info.c
@@ -42,11 +42,23 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                [NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG },
        };
 
+       static const char *ifmodes[NL80211_IFTYPE_MAX + 1] = {
+               "unspecified",
+               "IBSS",
+               "Station",
+               "AP",
+               "AP(VLAN)",
+               "WDS",
+               "Monitor",
+               "mesh point"
+       };
+
        struct nlattr *nl_band;
        struct nlattr *nl_freq;
        struct nlattr *nl_rate;
+       struct nlattr *nl_mode;
        int bandidx = 1;
-       int rem_band, rem_freq, rem_rate;
+       int rem_band, rem_freq, rem_rate, rem_mode;
        int open;
 
        nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -101,6 +113,17 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                }
        }
 
+       if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
+               return NL_SKIP;
+
+       printf("Supported interface modes:\n");
+       nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], rem_mode) {
+               if (nl_mode->nla_type > NL80211_IFTYPE_MAX)
+                       printf("\t * Unknown mode (%d)\n", nl_mode->nla_type);
+               else
+                       printf("\t * %s\n", ifmodes[nl_mode->nla_type]);
+       }
+
        return NL_SKIP;
 }