3 @@ -27,6 +27,7 @@ static int join_ibss(struct nl80211_stat
4 char *value = NULL, *sptr = NULL;
11 @@ -44,6 +45,12 @@ static int join_ibss(struct nl80211_stat
15 + if (argc && parse_channel_type(argv[0], &htval)) {
16 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, htval);
21 if (argc && strcmp(argv[0], "fixed-freq") == 0) {
22 NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED);
24 @@ -134,7 +141,7 @@ COMMAND(ibss, leave, NULL,
25 NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
26 "Leave the current IBSS cell.");
28 - "<SSID> <freq in MHz> [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
29 + "<SSID> <freq in MHz> [HT20|HT40+|HT40-] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
30 " [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
32 NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
35 @@ -133,6 +133,7 @@ int parse_hex_mask(char *hexmask, unsign
36 unsigned char *parse_hex(char *hex, size_t *outlen);
38 int parse_keys(struct nl_msg *msg, char **argv, int argc);
39 +int parse_channel_type(const char *str, unsigned int *htval);
41 void print_ht_mcs(const __u8 *mcs);
42 void print_ampdu_length(__u8 exponent);
45 @@ -33,30 +33,14 @@ static int handle_freqchan(struct nl_msg
46 int argc, char **argv)
49 - static const struct {
53 - { .name = "HT20", .val = NL80211_CHAN_HT20, },
54 - { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
55 - { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
57 unsigned int htval = NL80211_CHAN_NO_HT;
61 if (!argc || argc > 2)
65 - for (i = 0; i < ARRAY_SIZE(htmap); i++) {
66 - if (strcasecmp(htmap[i].name, argv[1]) == 0) {
67 - htval = htmap[i].val;
71 - if (htval == NL80211_CHAN_NO_HT)
73 + if (argc == 2 && !parse_channel_type(argv[1], &htval)) {
80 @@ -382,6 +382,33 @@ int parse_keys(struct nl_msg *msg, char
85 + * Convert a string "HT20", "HT40+" or "HT40-" into nl80211
86 + * value. Conversion is case insensitive. Returns 1 on success, 0 on error.
89 +int parse_channel_type(const char *str, unsigned int *htval)
91 + static const struct {
95 + { .name = "HT20", .val = NL80211_CHAN_HT20, },
96 + { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
97 + { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
101 + for (i = 0; i < ARRAY_SIZE(htmap); i++) {
102 + if (strcasecmp(htmap[i].name, str) == 0) {
103 + *htval = htmap[i].val;
111 static void print_mcs_index(const __u8 *mcs)
113 unsigned int mcs_bit, prev_bit = -2, prev_cont = 0;