]> git.ipfire.org Git - thirdparty/iw.git/blame - roc.c
update interface info for non-netdev wdevs
[thirdparty/iw.git] / roc.c
CommitLineData
11596797
JB
1#include <net/if.h>
2#include <errno.h>
3#include <string.h>
4
5#include <netlink/genl/genl.h>
6#include <netlink/genl/family.h>
7#include <netlink/genl/ctrl.h>
8#include <netlink/msg.h>
9#include <netlink/attr.h>
10
11#include "nl80211.h"
12#include "iw.h"
13
14SECTION(roc);
15
16static int handle_roc_start(struct nl80211_state *state, struct nl_cb *cb,
17 struct nl_msg *msg, int argc, char **argv)
18{
19 char *end;
20 int freq, time;
21
22 if (argc != 2)
23 return 1;
24
25 freq = strtol(argv[0], &end, 0);
26 if (!end || *end)
27 return 1;
28
29 time = strtol(argv[1], &end, 0);
30 if (!end || *end)
31 return 1;
32
33 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
34 NLA_PUT_U32(msg, NL80211_ATTR_DURATION, time);
35 return 0;
36 nla_put_failure:
37 return -ENOBUFS;
38}
39
40COMMAND(roc, start, "<freq> <time>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");