]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - wowlan.c
iw: Print limit for maximum associated stations in AP mode
[thirdparty/iw.git] / wowlan.c
index d3b565c3958ac9dcb95a0426f8bb33ae3e675e06..778c0dbc070488ac40a6d10d81915bb7cb2f5459 100644 (file)
--- a/wowlan.c
+++ b/wowlan.c
@@ -1,4 +1,3 @@
-#include <net/if.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
@@ -160,8 +159,12 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, const char *fn)
                        tok->offset = atoi(offs);
                        memcpy(tok->token_stream, stream, stream_len);
 
-                       NLA_PUT(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
-                               sizeof(*tok) + stream_len, tok);
+                       if (nla_put(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
+                               sizeof(*tok) + stream_len, tok) < 0) {
+                               free(stream);
+                               free(tok);
+                               goto nla_put_failure;
+                       }
                        free(stream);
                        free(tok);
                } else {
@@ -177,7 +180,8 @@ static int wowlan_parse_tcp_file(struct nl_msg *msg, const char *fn)
        err = -ENOBUFS;
  close:
        fclose(f);
-       nla_nest_end(msg, tcp);
+       if (tcp)
+               nla_nest_end(msg, tcp);
        return err;
 }
 
@@ -388,9 +392,8 @@ static int print_wowlan_handler(struct nl_msg *msg, void *arg)
                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);
+               nla_parse_nested(nd, NL80211_ATTR_MAX,
+                                trig[NL80211_WOWLAN_TRIG_NET_DETECT], NULL);
 
                if (nd[NL80211_ATTR_SCHED_SCAN_INTERVAL])
                        printf("\tscan interval: %u msecs\n",
@@ -405,9 +408,8 @@ static int print_wowlan_handler(struct nl_msg *msg, void *arg)
                        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);
+                               nla_parse_nested(tb, NL80211_ATTR_MAX, match,
+                                                NULL);
                                printf("\t\tSSID: ");
                                print_ssid_escaped(
                                        nla_len(tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]),