]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - coalesce.c
iw: add scan-abort command
[thirdparty/iw.git] / coalesce.c
index 02399151bf36a7f0306e3cf0a39953653420ceb4..36dcaefcc6cb5a54cb90879f4bda9d676259a143 100644 (file)
@@ -1,4 +1,3 @@
-#include <net/if.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
@@ -9,14 +8,12 @@
 #include <netlink/msg.h>
 #include <netlink/attr.h>
 
-#include <arpa/inet.h>
-
 #include "nl80211.h"
 #include "iw.h"
 
 SECTION(coalesce);
 
-static int handle_coalesce_enable(struct nl80211_state *state, struct nl_cb *cb,
+static int handle_coalesce_enable(struct nl80211_state *state,
                                  struct nl_msg *msg, int argc, char **argv,
                                  enum id_input id)
 {
@@ -38,8 +35,10 @@ static int handle_coalesce_enable(struct nl80211_state *state, struct nl_cb *cb,
                return 1;
 
        nl_rules = nla_nest_start(msg, NL80211_ATTR_COALESCE_RULE);
-       if (!nl_rules)
+       if (!nl_rules) {
+               fclose(f);
                return -ENOBUFS;
+       }
 
        while (!feof(f)) {
                char *eol;
@@ -183,7 +182,7 @@ COMMAND(coalesce, enable, "<config-file>",
        "match '43:34:00:12' after 18 bytes of offset in Rx packet.\n");
 
 static int
-handle_coalesce_disable(struct nl80211_state *state, struct nl_cb *cb,
+handle_coalesce_disable(struct nl80211_state *state,
                        struct nl_msg *msg, int argc, char **argv,
                        enum id_input id)
 {
@@ -272,12 +271,11 @@ static int print_coalesce_handler(struct nl_msg *msg, void *arg)
        return NL_SKIP;
 }
 
-static int handle_coalesce_show(struct nl80211_state *state, struct nl_cb *cb,
+static int handle_coalesce_show(struct nl80211_state *state,
                              struct nl_msg *msg, int argc, char **argv,
                              enum id_input id)
 {
-       nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM,
-                 print_coalesce_handler, NULL);
+       register_handler(print_coalesce_handler, NULL);
 
        return 0;
 }