-#include <net/if.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#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)
{
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;
" patterns=<[offset1+]<pattern1>,<[offset2+]<pattern2>,...>\n"
" ...\n"
"delay: maximum coalescing delay in msec.\n"
- "condition: 0/1 i.e. 'not match'/'match' the patterns\n"
+ "condition: 1/0 i.e. 'not match'/'match' the patterns\n"
"patterns: each pattern is given as a bytestring with '-' in\n"
"places where any byte may be present, e.g. 00:11:22:-:44 will\n"
"match 00:11:22:33:44 and 00:11:22:33:ff:44 etc. Offset and\n"
"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)
{
printf("Rule - max coalescing delay: %dmsec condition:", delay);
if (condition)
- printf("match\n");
- else
printf("not match\n");
+ else
+ printf("match\n");
if (ruleattr[NL80211_ATTR_COALESCE_RULE_PKT_PATTERN]) {
nla_for_each_nested(pattern,
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;
}