--- a/event.c +++ b/event.c @@ -973,6 +973,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; @@ -1008,6 +1009,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) @@ -1090,6 +1092,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); @@ -1297,9 +1300,9 @@ static int print_event(struct nl_msg *ms case NL80211_CMD_ASSOC_COMEBACK: /* 147 */ parse_assoc_comeback(tb, gnlh->cmd); break; +#endif 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 @@ -525,6 +525,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) { @@ -541,6 +542,7 @@ next: printf("\n"); } } +#endif } } @@ -606,6 +608,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; @@ -617,6 +620,7 @@ next: cipher_name(ciphers[i])); } } +#endif if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) @@ -634,9 +638,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]) { bool have_combinations = false; @@ -650,6 +656,7 @@ next: 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) @@ -747,6 +754,7 @@ next: printf("\t\t * wake up on TCP connection\n"); } } +#endif if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) printf("\tDevice supports roaming.\n"); @@ -785,6 +793,7 @@ next: } } +#ifdef IW_FULL if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); @@ -849,6 +858,7 @@ next: if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR) printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n"); } +#endif if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) printf("\tDevice supports T-DLS.\n"); @@ -979,6 +989,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) { @@ -990,6 +1001,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 @@ -1333,6 +1333,9 @@ 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]); +#ifndef IW_FULL + return; +#endif 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); @@ -1832,17 +1835,25 @@ static void print_ie(const struct ie_pri static const struct ie_print ieprinters[] = { [EID_SSID] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), }, + [EID_BSS_LOAD] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), }, + [EID_HT_CAPABILITY] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, + [EID_RSN] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, + [EID_HT_OPERATION] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, + [EID_SECONDARY_CH_OFFSET] = { "Secondary Channel Offset", + print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, + [EID_MESH_ID] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, + [EID_VHT_CAPABILITY] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, + [EID_VHT_OPERATION] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, +#ifdef IW_FULL [EID_SUPP_RATES] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [EID_DS_PARAMS] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, [EID_TIM] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, [EID_IBSS_TIM_PARAMS] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), }, [EID_COUNTRY] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), }, - [EID_BSS_LOAD] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), }, [EID_POWER_CONSTRAINT] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), }, [EID_TPC_REPORT] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), }, [EID_ERP_INFO] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), }, - [EID_HT_CAPABILITY] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, [EID_ERP_D4_0] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, [EID_AP_CHAN_REPORT] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), }, @@ -1852,18 +1863,11 @@ static const struct ie_print ieprinters[ print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, [EID_OVERLAP_BSS_SCAN_PARAM] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, - [EID_HT_OPERATION] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, - [EID_SECONDARY_CH_OFFSET] = { "Secondary Channel Offset", - print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, - [EID_VHT_CAPABILITY] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, - [EID_VHT_OPERATION] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, - [EID_RSN] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, [EID_EXT_SUPP_RATES] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [EID_RM_ENABLED_CAPABILITIES] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), }, [EID_MESH_CONFIG] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, - [EID_MESH_ID] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, [EID_EXT_CAPABILITY] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), }, [EID_INTERWORKING] = { "802.11u Interworking", print_interworking, @@ -1878,6 +1882,7 @@ static const struct ie_print ieprinters[ print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), }, [EID_S1G_CAPABILITY] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), }, [EID_S1G_OPERATION] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), }, +#endif }; static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, @@ -2213,8 +2218,10 @@ static void print_wifi_wps(const uint8_t static const struct ie_print wifiprinters[] = { [1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), }, +#ifdef IW_FULL [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, @@ -2377,6 +2384,10 @@ static void print_vendor(unsigned char l return; } +#ifdef IW_FULL + return; +#endif + if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) { if (data[3] < ARRAY_SIZE(wfa_printers) && wfa_printers[data[3]].name && @@ -2576,6 +2587,7 @@ static void print_capa_non_dmg(__u16 cap printf(" ESS"); if (capa & WLAN_CAPABILITY_IBSS) printf(" IBSS"); +#ifdef IW_FULL if (capa & WLAN_CAPABILITY_CF_POLLABLE) printf(" CfPollable"); if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST) @@ -2604,6 +2616,7 @@ static void print_capa_non_dmg(__u16 cap printf(" DelayedBACK"); if (capa & WLAN_CAPABILITY_IMM_BACK) printf(" ImmediateBACK"); +#endif } static int print_bss_handler(struct nl_msg *msg, void *arg) @@ -2694,8 +2707,10 @@ static int print_bss_handler(struct nl_m else printf("\tfreq: %d\n", freq); +#ifdef IW_FULL if (freq > 45000) is_dmg = true; +#endif } if (bss[NL80211_BSS_BEACON_INTERVAL]) printf("\tbeacon interval: %d TUs\n", @@ -2889,6 +2904,7 @@ static int handle_stop_sched_scan(struct return 0; } +#ifdef IW_FULL COMMAND(scan, sched_start, SCHED_SCAN_OPTIONS, NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan, @@ -2899,3 +2915,4 @@ COMMAND(scan, sched_start, COMMAND(scan, sched_stop, "", NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan, "Stop an ongoing scheduled scan."); +#endif --- a/util.c +++ b/util.c @@ -153,6 +153,7 @@ static const char *commands[NL80211_CMD_ static char cmdbuf[100]; +#ifdef IW_FULL const char *command_name(enum nl80211_commands cmd) { if (cmd <= NL80211_CMD_MAX && commands[cmd]) @@ -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) { @@ -313,6 +315,9 @@ int parse_keys(struct nl_msg *msg, char char keybuf[13]; int pos = 0; +#ifndef IW_FULL + return 1; +#endif if (!*argc) return 1; --- a/Makefile +++ b/Makefile @@ -25,6 +25,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil VERSION_OBJS := $(filter-out version.o, $(_OBJS)) OBJS := $(VERSION_OBJS) version.o +OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm +ifdef IW_FULL + CFLAGS += -DIW_FULL +else + OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS)) +endif ALL = iw ifeq ($(NO_PKG_CONFIG),) --- a/station.c +++ b/station.c @@ -847,10 +847,12 @@ static int handle_station_set_plink(stru nla_put_failure: return -ENOBUFS; } +#ifdef IW_FULL COMMAND_ALIAS(station, set, " plink_action ", NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink, "Set mesh peer link action for this station (peer).", select_station_cmd, station_set_plink); +#endif static int handle_station_set_vlan(struct nl80211_state *state, struct nl_msg *msg, @@ -945,11 +947,13 @@ static int handle_station_set_mesh_power nla_put_failure: return -ENOBUFS; } +#ifdef IW_FULL COMMAND_ALIAS(station, set, " mesh_power_mode " "", NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_mesh_power_mode, "Set link-specific mesh power mode for this station", select_station_cmd, station_set_mesh_power_mode); +#endif static int handle_station_set_airtime_weight(struct nl80211_state *state, struct nl_msg *msg, --- a/interface.c +++ b/interface.c @@ -673,9 +673,11 @@ static int handle_interface_wds_peer(str nla_put_failure: return -ENOBUFS; } +#ifdef IW_FULL COMMAND(set, peer, "", NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer, "Set interface WDS peer."); +#endif static int set_mcast_rate(struct nl80211_state *state, struct nl_msg *msg, @@ -765,6 +767,7 @@ static int handle_chan(struct nl80211_st return handle_chanfreq(state, msg, true, argc, argv, id); } +#ifdef IW_FULL SECTION(switch); COMMAND(switch, freq, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]\n" @@ -1059,3 +1062,4 @@ nla_put_failure: COMMAND(set, epcs, "", NL80211_CMD_EPCS_CFG, 0, CIB_NETDEV, handle_set_epcs, "Enable/Disable EPCS support"); +#endif --- a/phy.c +++ b/phy.c @@ -394,6 +394,7 @@ err_out: free(cac_trigger_argv); return err; } +#ifdef IW_FULL TOPLEVEL(cac, PARSE_CHAN_ARGS("channel ") "\n" PARSE_FREQ_ARGS("freq ", ""), 0, 0, CIB_NETDEV, handle_cac, NULL); @@ -410,6 +411,7 @@ COMMAND(cac, background, NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background, "Start background channel availability check (CAC) looking to look for\n" "radars on the given channel."); +#endif static int handle_fragmentation(struct nl80211_state *state, struct nl_msg *msg,