--- a/event.c +++ b/event.c @@ -43,6 +43,7 @@ static int parse_beacon_hint_chan(struct return 0; } +#ifdef IW_FULL static void print_frame(struct print_event_args *args, struct nlattr *attr) { uint8_t *frame; @@ -341,7 +342,7 @@ static void parse_vendor_event(struct nl out: printf("\n"); } - +#endif static void parse_nan_term(struct nlattr **attrs) { struct nlattr *func[NL80211_NAN_FUNC_ATTR_MAX + 1]; @@ -896,15 +897,18 @@ static void parse_ch_switch_notify(struc static int print_event(struct nl_msg *msg, void *arg) { struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); - struct nlattr *tb[NL80211_ATTR_MAX + 1], *nst; + struct nlattr *tb[NL80211_ATTR_MAX + 1]; struct print_event_args *args = arg; char ifname[100]; char macbuf[6*3]; __u8 reg_type; struct ieee80211_beacon_channel chan_before_beacon, chan_after_beacon; __u32 wiphy_idx = 0; +#ifdef IW_FULL + struct nlattr *nst; int rem_nst; __u16 status; +#endif if (args->time || args->reltime || args->ctime) { unsigned long long usecs, previous; @@ -956,6 +960,7 @@ static int print_event(struct nl_msg *ms } switch (gnlh->cmd) { +#ifdef IW_FULL case NL80211_CMD_NEW_WIPHY: printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])); break; @@ -991,6 +996,7 @@ static int print_event(struct nl_msg *ms case NL80211_CMD_SCHED_SCAN_RESULTS: printf("got scheduled scan results\n"); break; +#endif case NL80211_CMD_WIPHY_REG_CHANGE: case NL80211_CMD_REG_CHANGE: if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE) @@ -1073,6 +1079,7 @@ static int print_event(struct nl_msg *ms mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); printf("del station %s\n", macbuf); break; +#ifdef IW_FULL case NL80211_CMD_JOIN_IBSS: mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); printf("IBSS %s joined\n", macbuf); @@ -1241,6 +1248,7 @@ static int print_event(struct nl_msg *ms case NL80211_CMD_DEL_WIPHY: printf("delete wiphy\n"); break; +#endif case NL80211_CMD_PEER_MEASUREMENT_RESULT: parse_pmsr_result(tb, args); break; @@ -1272,8 +1280,7 @@ static int print_event(struct nl_msg *ms parse_ch_switch_notify(tb, gnlh->cmd); break; default: - printf("unknown event %d (%s)\n", - gnlh->cmd, command_name(gnlh->cmd)); + printf("unknown event %d\n", gnlh->cmd); break; } --- a/info.c +++ b/info.c @@ -19,6 +19,7 @@ static void print_flag(const char *name, *open = 1; } +#ifdef IW_FULL static char *cipher_name(__u32 c) { static char buf[20]; @@ -56,6 +57,7 @@ static char *cipher_name(__u32 c) return buf; } } +#endif static int ext_feature_isset(const unsigned char *ext_features, int ext_features_len, enum nl80211_ext_feature_index ftidx) @@ -96,18 +98,20 @@ static int print_phy_handler(struct nl_m [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 }, }; +#ifdef IW_FULL struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1]; static struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = { [NL80211_BITRATE_ATTR_RATE] = { .type = NLA_U32 }, [NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG }, }; - - struct nlattr *nl_band; - struct nlattr *nl_freq; struct nlattr *nl_rate; struct nlattr *nl_cmd; struct nlattr *nl_if, *nl_ftype; - int rem_band, rem_freq, rem_rate, rem_cmd, rem_ftype, rem_if; + int rem_rate, rem_cmd, rem_ftype, rem_if; +#endif + struct nlattr *nl_band; + struct nlattr *nl_freq; + int rem_band, rem_freq; int open; /* * static variables only work here, other applications need to use the @@ -215,6 +219,7 @@ next: } } +#ifdef IW_FULL if (tb_band[NL80211_BAND_ATTR_RATES]) { printf("\t\tBitrates (non-HT):\n"); nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) { @@ -231,6 +236,7 @@ next: printf("\n"); } } +#endif } } @@ -296,6 +302,7 @@ next: printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); } +#ifdef IW_FULL if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); int i; @@ -307,6 +314,7 @@ next: cipher_name(ciphers[i])); } } +#endif if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) @@ -324,9 +332,11 @@ next: print_iftype_list("\tSupported interface modes", "\t\t", tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]); +#ifdef IW_FULL if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) print_iftype_list("\tsoftware interface modes (can always be added)", "\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]); +#endif if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { struct nlattr *nl_combi; @@ -416,6 +426,7 @@ broken_combination: printf("\tinterface combinations are not supported\n"); } +#ifdef IW_FULL if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { printf("\tSupported commands:\n"); nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd) @@ -513,6 +524,7 @@ broken_combination: printf("\t\t * wake up on TCP connection\n"); } } +#endif if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) printf("\tDevice supports roaming.\n"); @@ -551,6 +563,7 @@ broken_combination: } } +#ifdef IW_FULL if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); @@ -618,6 +631,10 @@ broken_combination: if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) printf("\tDevice supports T-DLS.\n"); + if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) + printf("\tDevice supports TDLS channel switching\n"); + } +#endif if (tb_msg[NL80211_ATTR_EXT_FEATURES]) { struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES]; @@ -752,6 +769,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP "List all wireless devices and their capabilities."); TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL); +#ifdef IW_FULL static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, enum id_input id) { @@ -763,6 +781,7 @@ static int handle_commands(struct nl8021 } TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands, "list all known commands and their decimal & hex value"); +#endif static int print_feature_handler(struct nl_msg *msg, void *arg) { --- a/scan.c +++ b/scan.c @@ -568,6 +568,7 @@ static void print_ssid(const uint8_t typ #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 +#ifdef IW_FULL static void print_supprates(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -755,6 +756,7 @@ static void print_ap_channel_report(cons } printf("\n"); } +#endif static void print_cipher(const uint8_t *data) { @@ -1074,12 +1076,14 @@ static void print_rsn_ie(const char *def _print_rsn_ie(defcipher, defauth, len, data, 0); } +#ifdef IW_FULL static void print_osen_ie(const char *defcipher, const char *defauth, uint8_t len, const uint8_t *data) { printf("\n\t"); _print_rsn_ie(defcipher, defauth, len, data, 1); } +#endif static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -1097,6 +1101,7 @@ static void print_ht_capa(const uint8_t print_ht_mcs(data + 3); } +#ifdef IW_FULL static const char* ntype_11u(uint8_t t) { switch (t) { @@ -1279,6 +1284,7 @@ static void print_tx_power_envelope(cons printf("\t\t * %s: %i dBm\n", power_names[i], power_val); } } +#endif static const char *ht_secondary_offset[4] = { "no secondary", @@ -1306,6 +1312,7 @@ static void print_ht_op(const uint8_t ty printf("\t\t * secondary channel offset: %s\n", ht_secondary_offset[data[1] & 0x3]); printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]); + return; printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3); printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]); printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2); @@ -1318,6 +1325,7 @@ static void print_ht_op(const uint8_t ty printf("\t\t * PCO phase: %d\n", (data[5] & 0x8) >> 3); } +#ifdef IW_FULL static void print_capabilities(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -1495,6 +1503,7 @@ static void print_ibssatim(const uint8_t { printf(" %d TUs\n", (data[1] << 8) + data[0]); } +#endif static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -1523,6 +1532,7 @@ static void print_vht_oper(const uint8_t printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]); } +#ifdef IW_FULL static void print_supp_op_classes(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -1620,6 +1630,7 @@ static void print_obss_scan_params(const printf("\t\t * OBSS Scan Activity Threshold: %d.%02d %%\n", ((data[13] << 8) | data[12]) / 100, ((data[13] << 8) | data[12]) % 100); } +#endif static void print_secchan_offs(const uint8_t type, uint8_t len, const uint8_t *data, @@ -1631,6 +1642,7 @@ static void print_secchan_offs(const uin printf(" %d\n", data[0]); } +#ifdef IW_FULL static void print_bss_load(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) { @@ -1672,6 +1684,7 @@ static void print_mesh_conf(const uint8_ if (data[6] & 0x40) printf("\t\t\t Mesh Power Save Level\n"); } +#endif struct ie_print { const char *name; @@ -1716,6 +1729,13 @@ static void print_ie(const struct ie_pri static const struct ie_print ieprinters[] = { [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, + [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, + [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, + [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, + [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, + [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, + [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, +#ifdef IW_FULL [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, @@ -1725,17 +1745,11 @@ static const struct ie_print ieprinters[ [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), }, [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), }, [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), }, - [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, [51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), }, [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), }, [66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, - [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, - [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, - [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, - [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, - [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), }, [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, @@ -1745,8 +1759,10 @@ static const struct ie_print ieprinters[ [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), }, [111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), }, [195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), }, +#endif }; +#ifdef IW_FULL static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) { @@ -2083,6 +2099,7 @@ static const struct ie_print wifiprinter [2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), }, [4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), }, }; +#endif static inline void print_p2p(const uint8_t type, uint8_t len, const uint8_t *data, @@ -2178,6 +2195,7 @@ static inline void print_hs20_ind(const printf("\t\tUnexpected length: %i\n", len); } +#ifdef IW_FULL static void print_wifi_owe_tarns(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -2271,6 +2289,7 @@ static void print_vendor(unsigned char l printf(" %.2x", data[i]); printf("\n"); } +#endif static void print_he_capa(const uint8_t type, uint8_t len, const uint8_t *data, const struct print_ies_data *ie_buffer) @@ -2326,6 +2345,7 @@ void print_ies(unsigned char *ie, int ie ieprinters[ie[0]].flags & BIT(ptype)) { print_ie(&ieprinters[ie[0]], ie[0], ie[1], ie + 2, &ie_buffer); +#ifdef IW_FULL } else if (ie[0] == 221 /* vendor */) { print_vendor(ie[1], ie + 2, unknown, ptype); } else if (ie[0] == 255 /* extension */) { @@ -2337,6 +2357,7 @@ void print_ies(unsigned char *ie, int ie for (i=0; i 45000) is_dmg = true; +#endif } if (bss[NL80211_BSS_BEACON_INTERVAL]) printf("\tbeacon interval: %d TUs\n", --- a/util.c +++ b/util.c @@ -147,6 +147,7 @@ const char *iftype_name(enum nl80211_ift return modebuf; } +#ifdef IW_FULL static const char *commands[NL80211_CMD_MAX + 1] = { #include "nl80211-commands.inc" }; @@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co sprintf(cmdbuf, "Unknown command (%d)", cmd); return cmdbuf; } +#endif int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) {