]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
parse net detect wowlan configuration information
authorLuciano Coelho <luciano.coelho@intel.com>
Fri, 28 Nov 2014 21:05:56 +0000 (23:05 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 12 Dec 2014 12:52:54 +0000 (13:52 +0100)
Parse the net detect information when it is reported.  This includes
the scan interval, SSIDs to match and frequencies to scan.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
wowlan.c

index 13a756c69c84ca8ab58b9495201c77a5fbcdf393..fb7d956aa4b69c2fe024f20caee9b9694e66c471 100644 (file)
--- a/wowlan.c
+++ b/wowlan.c
@@ -523,8 +523,45 @@ static int print_wowlan_handler(struct nl_msg *msg, void *arg)
                printf(" * wake up on 4-way handshake\n");
        if (trig[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
                printf(" * wake up on RF-kill release\n");
-       if (trig[NL80211_WOWLAN_TRIG_NET_DETECT])
+       if (trig[NL80211_WOWLAN_TRIG_NET_DETECT]) {
+               struct nlattr *match, *freq,
+                       *nd[NUM_NL80211_ATTR], *tb[NUM_NL80211_ATTR];
+               int rem_match;
+
                printf(" * wake up on network detection\n");
+               nla_parse(nd, NUM_NL80211_ATTR,
+                         nla_data(trig[NL80211_WOWLAN_TRIG_NET_DETECT]),
+                         nla_len(trig[NL80211_WOWLAN_TRIG_NET_DETECT]), NULL);
+
+               if (nd[NL80211_ATTR_SCHED_SCAN_INTERVAL])
+                       printf("\tscan interval: %d msecs\n",
+                              nla_get_u32(nd[NL80211_ATTR_SCHED_SCAN_INTERVAL]));
+
+               if (nd[NL80211_ATTR_SCHED_SCAN_MATCH]) {
+                       printf("\tmatches:\n");
+                       nla_for_each_nested(match,
+                                           nd[NL80211_ATTR_SCHED_SCAN_MATCH],
+                                           rem_match) {
+                               nla_parse(tb, NUM_NL80211_ATTR, nla_data(match),
+                                         nla_len(match),
+                                         NULL);
+                               printf("\t\tSSID: ");
+                               print_ssid_escaped(
+                                       nla_len(tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]),
+                                       nla_data(tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]));
+                               printf("\n");
+                       }
+               }
+               if (nd[NL80211_ATTR_SCAN_FREQUENCIES]) {
+                       printf("\tfrequencies:");
+                       nla_for_each_nested(freq,
+                                           nd[NL80211_ATTR_SCAN_FREQUENCIES],
+                                           rem_match) {
+                               printf(" %d", nla_get_u32(freq));
+                       }
+                       printf("\n");
+               }
+       }
        if (trig[NL80211_WOWLAN_TRIG_PKT_PATTERN]) {
                nla_for_each_nested(pattern,
                                    trig[NL80211_WOWLAN_TRIG_PKT_PATTERN],