]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - ap.c
update nl80211.h
[thirdparty/iw.git] / ap.c
diff --git a/ap.c b/ap.c
index bc16b77a42935f24f472c7d7e67f373da3125f4b..748576d512b8df89921c3a49ac0cde52890d776d 100644 (file)
--- a/ap.c
+++ b/ap.c
@@ -13,6 +13,8 @@ static int handle_start_ap(struct nl80211_state *state,
                           struct nl_msg *msg, int argc, char **argv,
                           enum id_input id)
 {
+       struct chandef chandef;
+       int res, parsed;
        char *end;
        int val, len;
        char buf[2304];
@@ -25,14 +27,15 @@ static int handle_start_ap(struct nl80211_state *state,
        argv++;
        argc--;
 
-       /* freq */
-       val = strtoul(argv[0], &end, 10);
-       if (*end != '\0')
-               return -EINVAL;
-
-       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, val);
-       argv++;
-       argc--;
+       /* chandef */
+       res = parse_freqchan(&chandef, false, argc, argv, &parsed, false);
+       if (res)
+               return res;
+       argc -= parsed;
+       argv += parsed;
+       res = put_chandef(msg, &chandef);
+       if (res)
+               return res;
 
        /* beacon interval */
        val = strtoul(argv[0], &end, 10);
@@ -52,9 +55,21 @@ static int handle_start_ap(struct nl80211_state *state,
        argv++;
        argc--;
 
+       if (strcmp(argv[0], "hidden-ssid") == 0) {
+               argc--;
+               argv++;
+               NLA_PUT_U32(msg, NL80211_ATTR_HIDDEN_SSID,
+                           NL80211_HIDDEN_SSID_ZERO_LEN);
+       } else if (strcmp(argv[0], "zeroed-ssid") == 0) {
+               argc--;
+               argv++;
+               NLA_PUT_U32(msg, NL80211_ATTR_HIDDEN_SSID,
+                           NL80211_HIDDEN_SSID_ZERO_CONTENTS);
+       }
+
        /* beacon head must be provided */
        if (strcmp(argv[0], "head") != 0)
-               return -1;
+               return 1;
        argv++;
        argc--;
 
@@ -95,21 +110,46 @@ static int handle_start_ap(struct nl80211_state *state,
        if (!argc)
                return 0;
 
+       /* inactivity time (optional) */
+       if (strcmp(argv[0], "inactivity-time") == 0) {
+               argv++;
+               argc--;
+
+               if (!argc)
+                       return -EINVAL;
+               len = strlen(argv[0]);
+               if (!len)
+                       return -EINVAL;
+
+               val = strtoul(argv[0], &end, 10);
+               if (*end != '\0')
+                       return -EINVAL;
+
+               NLA_PUT_U16(msg, NL80211_ATTR_INACTIVITY_TIMEOUT, val);
+               argv++;
+               argc--;
+       }
+
+       if (!argc) {
+               return 0;
+       }
+
        if (strcmp(*argv, "key") != 0 && strcmp(*argv, "keys") != 0)
                return 1;
 
        argv++;
        argc--;
 
-       return parse_keys(msg, argv, argc);
+       return parse_keys(msg, &argv, &argc);
  nla_put_failure:
        return -ENOSPC;
 }
 COMMAND(ap, start, "",
        NL80211_CMD_NEW_BEACON, 0, CIB_NETDEV, handle_start_ap,
-       "<SSID> <freq in MHz> <beacon interval in TU> <DTIM period> <head>"
-       " <beacon head in hexadecimal> [<tail> <beacon tail in hexadecimal>]"
-       " [key0:abcde d:1:6162636465]\n");
+       "<SSID> <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]"
+       " <beacon interval in TU> <DTIM period> [hidden-ssid|zeroed-ssid] head"
+       " <beacon head in hexadecimal> [tail <beacon tail in hexadecimal>]"
+       " [inactivity-time <inactivity time in seconds>] [key0:abcde d:1:6162636465]\n");
 
 static int handle_stop_ap(struct nl80211_state *state,
                          struct nl_msg *msg,