]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add remain-on-channel
authorJohannes Berg <johannes.berg@intel.com>
Fri, 15 Jul 2011 21:13:59 +0000 (23:13 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 15 Jul 2011 21:13:59 +0000 (23:13 +0200)
Makefile
roc.c [new file with mode: 0644]

index e3ee2a87a44c1737f23cf69b49d814bd48bd0030..885e48f08f250d5ee478fd1b0a268ff458e60868 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ OBJS = iw.o genl.o event.o info.o phy.o \
        interface.o ibss.o station.o survey.o util.o \
        mesh.o mpath.o scan.o reg.o version.o \
        reason.o status.o connect.o link.o offch.o ps.o cqm.o \
-       bitrate.o wowlan.o
+       bitrate.o wowlan.o roc.o
 OBJS += sections.o
 ALL = iw
 
diff --git a/roc.c b/roc.c
new file mode 100644 (file)
index 0000000..1b29e6a
--- /dev/null
+++ b/roc.c
@@ -0,0 +1,40 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(roc);
+
+static int handle_roc_start(struct nl80211_state *state, struct nl_cb *cb,
+                           struct nl_msg *msg, int argc, char **argv)
+{
+       char *end;
+       int freq, time;
+
+       if (argc != 2)
+               return 1;
+
+       freq = strtol(argv[0], &end, 0);
+       if (!end || *end)
+               return 1;
+
+       time = strtol(argv[1], &end, 0);
+       if (!end || *end)
+               return 1;
+
+       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
+       NLA_PUT_U32(msg, NL80211_ATTR_DURATION, time);
+       return 0;
+ nla_put_failure:
+       return -ENOBUFS;
+}
+
+COMMAND(roc, start, "<freq> <time>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");