]> git.ipfire.org Git - thirdparty/iw.git/blame - roc.c
iw: support setting vif MAC during creation
[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,
05514f95
JB
17 struct nl_msg *msg, int argc, char **argv,
18 enum id_input id)
11596797
JB
19{
20 char *end;
21 int freq, time;
22
23 if (argc != 2)
24 return 1;
25
26 freq = strtol(argv[0], &end, 0);
27 if (!end || *end)
28 return 1;
29
30 time = strtol(argv[1], &end, 0);
31 if (!end || *end)
32 return 1;
33
34 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
35 NLA_PUT_U32(msg, NL80211_ATTR_DURATION, time);
36 return 0;
37 nla_put_failure:
38 return -ENOBUFS;
39}
40
894d57bd 41COMMAND(roc, start, "<freq> <time in ms>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");