]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
adjust to new ibss API
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 19 Apr 2009 15:52:14 +0000 (17:52 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Sun, 19 Apr 2009 15:52:14 +0000 (17:52 +0200)
ibss.c
nl80211.h

diff --git a/ibss.c b/ibss.c
index a9cc6fc43e5d8c303cf3d2eac6c79127617ae47f..e3bbdeb899eaa2c77336a60d86cdbd449cf7c27d 100644 (file)
--- a/ibss.c
+++ b/ibss.c
@@ -14,47 +14,41 @@ static int join_ibss(struct nl80211_state *state,
                     struct nl_msg *msg,
                     int argc, char **argv)
 {
-       int oargc;
-       char *bssid = NULL, *freq = NULL;
+       char *end;
        unsigned char abssid[6];
 
-       NLA_PUT(msg, NL80211_ATTR_SSID, strlen(argv[0]), argv[0]);
+       if (argc < 2)
+               return 1;
 
+       /* SSID */
+       NLA_PUT(msg, NL80211_ATTR_SSID, strlen(argv[0]), argv[0]);
        argv++;
        argc--;
 
-       oargc = argc;
-
-       while (argc) {
-               if (argc > 0 && strcmp(argv[0], "bssid") == 0) {
-                       bssid = argv[1];
-                       argv += 2;
-                       argc -= 2;
-               }
+       /* freq */
+       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ,
+                   strtoul(argv[0], &end, 10));
+       if (*end != '\0')
+               return 1;
+       argv++;
+       argc--;
 
-               if (argc > 0 && strcmp(argv[0], "freq") == 0) {
-                       freq = argv[1];
-                       argv += 2;
-                       argc -= 2;
-               }
-               if (oargc == argc)
-                       return 1;
-               oargc = argc;
+       if (argc && strcmp(argv[0], "fixed-freq") == 0) {
+               NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED);
+               argv++;
+               argc--;
        }
 
-       if (bssid) {
-               if (mac_addr_a2n(abssid, bssid))
+       if (argc) {
+               if (mac_addr_a2n(abssid, argv[0]))
                        return 1;
                NLA_PUT(msg, NL80211_ATTR_MAC, 6, abssid);
+               argv++;
+               argc--;
        }
 
-       if (freq) {
-               char *end;
-               NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ,
-                           strtoul(freq, &end, 10));
-               if (*end != '\0')
-                       return 1;
-       }
+       if (argc)
+               return 1;
 
        return 0;
  nla_put_failure:
@@ -70,5 +64,5 @@ static int leave_ibss(struct nl80211_state *state,
 }
 COMMAND(ibss, leave, NULL,
        NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss);
-COMMAND(ibss, join, "<SSID> [bssid <bssid>] [freq <freq in MHz>]",
+COMMAND(ibss, join, "<SSID> <freq in MHz> [fixed-freq] [<fixed bssid>]",
        NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss);
index 321bfe6985881dfc5c4f9a6ae49e84b9d6e4eb62..25ce3e42bd1022583b1deb4e683df5a907ff33a3 100644 (file)
--- a/nl80211.h
+++ b/nl80211.h
  *     %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
  *     event matches with MLME-MICHAELMICFAILURE.indication() primitive
  *
- * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID, and
- *     optionally a MAC (as BSSID) and FREQ attribute if those should be
- *     fixed rather than automatically determined. Can only be executed
- *     on a network interface that is UP, and fixed BSSID/FREQ may be
- *     rejected.
+ * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
+ *     FREQ attribute (for the initial frequency if no peer can be found)
+ *     and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
+ *     should be fixed rather than automatically determined. Can only be
+ *     executed on a network interface that is UP, and fixed BSSID/FREQ
+ *     may be rejected.
  * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
  *     determined by the network interface.
  *
@@ -467,6 +468,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
  *     cipher suites
  *
+ * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
+ *     for other networks on different channels
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -558,6 +562,9 @@ enum nl80211_attrs {
 
        NL80211_ATTR_FREQ_BEFORE,
        NL80211_ATTR_FREQ_AFTER,
+
+       NL80211_ATTR_FREQ_FIXED,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,