10 static int join_ibss(struct nl80211_state
*state
,
12 int argc
, char **argv
,
16 struct chandef chandef
;
17 unsigned char abssid
[6];
18 unsigned char rates
[NL80211_MAX_SUPP_RATES
];
20 char *value
= NULL
, *sptr
= NULL
;
29 NLA_PUT(msg
, NL80211_ATTR_SSID
, strlen(argv
[0]), argv
[0]);
33 err
= parse_freqchan(&chandef
, false, argc
, argv
, &parsed
);
40 err
= put_chandef(msg
, &chandef
);
44 if (argc
&& strcmp(argv
[0], "fixed-freq") == 0) {
45 NLA_PUT_FLAG(msg
, NL80211_ATTR_FREQ_FIXED
);
51 if (mac_addr_a2n(abssid
, argv
[0]) == 0) {
52 NLA_PUT(msg
, NL80211_ATTR_MAC
, 6, abssid
);
58 if (argc
> 1 && strcmp(argv
[0], "beacon-interval") == 0) {
61 bintval
= strtoul(argv
[0], &end
, 10);
64 NLA_PUT_U32(msg
, NL80211_ATTR_BEACON_INTERVAL
, bintval
);
70 if (argc
> 1 && strcmp(argv
[0], "basic-rates") == 0) {
74 value
= strtok_r(argv
[0], ",", &sptr
);
76 while (value
&& n_rates
< NL80211_MAX_SUPP_RATES
) {
77 rate
= strtod(value
, &end
);
78 rates
[n_rates
] = rate
* 2;
80 /* filter out suspicious values */
81 if (*end
!= '\0' || !rates
[n_rates
] ||
82 rate
*2 != rates
[n_rates
])
86 value
= strtok_r(NULL
, ",", &sptr
);
89 NLA_PUT(msg
, NL80211_ATTR_BSS_BASIC_RATES
, n_rates
, rates
);
96 if (argc
> 1 && strcmp(argv
[0], "mcast-rate") == 0) {
100 rate
= strtod(argv
[0], &end
);
104 NLA_PUT_U32(msg
, NL80211_ATTR_MCAST_RATE
, (int)(rate
* 10));
112 if (strcmp(*argv
, "key") != 0 && strcmp(*argv
, "keys") != 0)
118 return parse_keys(msg
, &argv
, &argc
);
123 static int leave_ibss(struct nl80211_state
*state
,
125 int argc
, char **argv
,
130 COMMAND(ibss
, leave
, NULL
,
131 NL80211_CMD_LEAVE_IBSS
, 0, CIB_NETDEV
, leave_ibss
,
132 "Leave the current IBSS cell.");
134 "<SSID> <freq in MHz> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
135 " [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
137 NL80211_CMD_JOIN_IBSS
, 0, CIB_NETDEV
, join_ibss
,
138 "Join the IBSS cell with the given SSID, if it doesn't exist create\n"
139 "it on the given frequency. When fixed frequency is requested, don't\n"
140 "join/create a cell on a different frequency. When a fixed BSSID is\n"
141 "requested use that BSSID and do not adopt another cell's BSSID even\n"
142 "if it has higher TSF and the same SSID. If an IBSS is created, create\n"
143 "it with the specified basic-rates, multicast-rate and beacon-interval.");