]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: print DFS states for channels if available
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Fri, 8 Feb 2013 17:16:22 +0000 (18:16 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 18 Feb 2013 22:48:11 +0000 (23:48 +0100)
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
info.c

diff --git a/info.c b/info.c
index 14db37ff916f8655bf99b77f90470e66b83a8cff..1b9e3b569a1a8d90258bfc395345eb348546b1d1 100644 (file)
--- a/info.c
+++ b/info.c
@@ -49,6 +49,20 @@ static char *cipher_name(__u32 c)
        }
 }
 
+static char *dfs_state_name(enum nl80211_dfs_state state)
+{
+       switch (state) {
+       case NL80211_DFS_USABLE:
+               return "usable";
+       case NL80211_DFS_AVAILABLE:
+               return "available";
+       case NL80211_DFS_UNAVAILABLE:
+               return "unavailable";
+       default:
+               return "unknown";
+       }
+}
+
 static int print_phy_handler(struct nl_msg *msg, void *arg)
 {
        struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
@@ -148,6 +162,18 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                        if (open)
                                printf(")");
                        printf("\n");
+
+                       if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]) {
+                               enum nl80211_dfs_state state = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]);
+                               unsigned long time;
+
+                               printf("\t\t\t  DFS state: %s", dfs_state_name(state));
+                               if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]) {
+                                       time = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]);
+                                       printf(" (for %lu sec)", time/1000);
+                               }
+                               printf("\n");
+                       }
                }
 
                printf("\t\tBitrates (non-HT):\n");