200-reduce_size.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. --- a/event.c
  2. +++ b/event.c
  3. @@ -973,6 +973,7 @@ static int print_event(struct nl_msg *ms
  4. }
  5. switch (gnlh->cmd) {
  6. +#ifdef IW_FULL
  7. case NL80211_CMD_NEW_WIPHY:
  8. printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
  9. break;
  10. @@ -1008,6 +1009,7 @@ static int print_event(struct nl_msg *ms
  11. case NL80211_CMD_SCHED_SCAN_RESULTS:
  12. printf("got scheduled scan results\n");
  13. break;
  14. +#endif
  15. case NL80211_CMD_WIPHY_REG_CHANGE:
  16. case NL80211_CMD_REG_CHANGE:
  17. if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
  18. @@ -1090,6 +1092,7 @@ static int print_event(struct nl_msg *ms
  19. mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  20. printf("del station %s\n", macbuf);
  21. break;
  22. +#ifdef IW_FULL
  23. case NL80211_CMD_JOIN_IBSS:
  24. mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  25. printf("IBSS %s joined\n", macbuf);
  26. @@ -1297,9 +1300,9 @@ static int print_event(struct nl_msg *ms
  27. case NL80211_CMD_ASSOC_COMEBACK: /* 147 */
  28. parse_assoc_comeback(tb, gnlh->cmd);
  29. break;
  30. +#endif
  31. default:
  32. - printf("unknown event %d (%s)\n",
  33. - gnlh->cmd, command_name(gnlh->cmd));
  34. + printf("unknown event %d\n", gnlh->cmd);
  35. break;
  36. }
  37. --- a/info.c
  38. +++ b/info.c
  39. @@ -446,6 +446,7 @@ next:
  40. }
  41. }
  42. +#ifdef IW_FULL
  43. if (tb_band[NL80211_BAND_ATTR_RATES]) {
  44. printf("\t\tBitrates (non-HT):\n");
  45. nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
  46. @@ -462,6 +463,7 @@ next:
  47. printf("\n");
  48. }
  49. }
  50. +#endif
  51. }
  52. }
  53. @@ -527,6 +529,7 @@ next:
  54. printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
  55. }
  56. +#ifdef IW_FULL
  57. if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
  58. int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
  59. int i;
  60. @@ -538,6 +541,7 @@ next:
  61. cipher_name(ciphers[i]));
  62. }
  63. }
  64. +#endif
  65. if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
  66. tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
  67. @@ -555,9 +559,11 @@ next:
  68. print_iftype_list("\tSupported interface modes", "\t\t",
  69. tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]);
  70. +#ifdef IW_FULL
  71. if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES])
  72. print_iftype_list("\tsoftware interface modes (can always be added)",
  73. "\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]);
  74. +#endif
  75. if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
  76. struct nlattr *nl_combi;
  77. @@ -647,6 +653,7 @@ broken_combination:
  78. printf("\tinterface combinations are not supported\n");
  79. }
  80. +#ifdef IW_FULL
  81. if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
  82. printf("\tSupported commands:\n");
  83. nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
  84. @@ -744,6 +751,7 @@ broken_combination:
  85. printf("\t\t * wake up on TCP connection\n");
  86. }
  87. }
  88. +#endif
  89. if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
  90. printf("\tDevice supports roaming.\n");
  91. @@ -782,6 +790,7 @@ broken_combination:
  92. }
  93. }
  94. +#ifdef IW_FULL
  95. if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
  96. unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  97. @@ -846,6 +855,7 @@ broken_combination:
  98. if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
  99. printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
  100. }
  101. +#endif
  102. if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
  103. printf("\tDevice supports T-DLS.\n");
  104. @@ -914,6 +924,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
  105. "List all wireless devices and their capabilities.");
  106. TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
  107. +#ifdef IW_FULL
  108. static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
  109. int argc, char **argv, enum id_input id)
  110. {
  111. @@ -925,6 +936,7 @@ static int handle_commands(struct nl8021
  112. }
  113. TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
  114. "list all known commands and their decimal & hex value");
  115. +#endif
  116. static int print_feature_handler(struct nl_msg *msg, void *arg)
  117. {
  118. --- a/scan.c
  119. +++ b/scan.c
  120. @@ -1309,6 +1309,9 @@ static void print_ht_op(const uint8_t ty
  121. printf("\t\t * secondary channel offset: %s\n",
  122. ht_secondary_offset[data[1] & 0x3]);
  123. printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
  124. +#ifndef IW_FULL
  125. + return;
  126. +#endif
  127. printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
  128. printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
  129. printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
  130. @@ -1808,17 +1811,25 @@ static void print_ie(const struct ie_pri
  131. static const struct ie_print ieprinters[] = {
  132. [EID_SSID] = { "SSID", print_ssid, 0, 32,
  133. BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), },
  134. + [EID_BSS_LOAD] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
  135. + [EID_HT_CAPABILITY] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  136. + [EID_RSN] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  137. + [EID_HT_OPERATION] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  138. + [EID_SECONDARY_CH_OFFSET] = { "Secondary Channel Offset",
  139. + print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  140. + [EID_MESH_ID] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  141. + [EID_VHT_CAPABILITY] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  142. + [EID_VHT_OPERATION] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  143. +#ifdef IW_FULL
  144. [EID_SUPP_RATES] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  145. [EID_DS_PARAMS] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
  146. [EID_TIM] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
  147. [EID_IBSS_TIM_PARAMS] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), },
  148. [EID_COUNTRY] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
  149. - [EID_BSS_LOAD] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
  150. [EID_POWER_CONSTRAINT] = { "Power constraint", print_powerconstraint,
  151. 1, 1, BIT(PRINT_SCAN), },
  152. [EID_TPC_REPORT] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
  153. [EID_ERP_INFO] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
  154. - [EID_HT_CAPABILITY] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  155. [EID_ERP_D4_0] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
  156. [EID_AP_CHAN_REPORT] = { "AP Channel Report", print_ap_channel_report,
  157. 1, 255, BIT(PRINT_SCAN), },
  158. @@ -1828,18 +1839,11 @@ static const struct ie_print ieprinters[
  159. print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
  160. [EID_OVERLAP_BSS_SCAN_PARAM] = { "Overlapping BSS scan params",
  161. print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
  162. - [EID_HT_OPERATION] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  163. - [EID_SECONDARY_CH_OFFSET] = { "Secondary Channel Offset",
  164. - print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  165. - [EID_VHT_CAPABILITY] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  166. - [EID_VHT_OPERATION] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  167. - [EID_RSN] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  168. [EID_EXT_SUPP_RATES] = { "Extended supported rates", print_supprates,
  169. 0, 255, BIT(PRINT_SCAN), },
  170. [EID_RM_ENABLED_CAPABILITIES] = { "RM enabled capabilities",
  171. print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
  172. [EID_MESH_CONFIG] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
  173. - [EID_MESH_ID] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  174. [EID_EXT_CAPABILITY] = { "Extended capabilities", print_capabilities,
  175. 0, 255, BIT(PRINT_SCAN), },
  176. [EID_INTERWORKING] = { "802.11u Interworking", print_interworking,
  177. @@ -1854,6 +1858,7 @@ static const struct ie_print ieprinters[
  178. print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), },
  179. [EID_S1G_CAPABILITY] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), },
  180. [EID_S1G_OPERATION] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), },
  181. +#endif
  182. };
  183. static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
  184. @@ -2189,8 +2194,10 @@ static void print_wifi_wps(const uint8_t
  185. static const struct ie_print wifiprinters[] = {
  186. [1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), },
  187. +#ifdef IW_FULL
  188. [2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
  189. [4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
  190. +#endif
  191. };
  192. static inline void print_p2p(const uint8_t type, uint8_t len,
  193. @@ -2353,6 +2360,10 @@ static void print_vendor(unsigned char l
  194. return;
  195. }
  196. +#ifdef IW_FULL
  197. + return;
  198. +#endif
  199. +
  200. if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) {
  201. if (data[3] < ARRAY_SIZE(wfa_printers) &&
  202. wfa_printers[data[3]].name &&
  203. @@ -2544,6 +2555,7 @@ static void print_capa_non_dmg(__u16 cap
  204. printf(" ESS");
  205. if (capa & WLAN_CAPABILITY_IBSS)
  206. printf(" IBSS");
  207. +#ifdef IW_FULL
  208. if (capa & WLAN_CAPABILITY_CF_POLLABLE)
  209. printf(" CfPollable");
  210. if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
  211. @@ -2572,6 +2584,7 @@ static void print_capa_non_dmg(__u16 cap
  212. printf(" DelayedBACK");
  213. if (capa & WLAN_CAPABILITY_IMM_BACK)
  214. printf(" ImmediateBACK");
  215. +#endif
  216. }
  217. static int print_bss_handler(struct nl_msg *msg, void *arg)
  218. @@ -2662,8 +2675,10 @@ static int print_bss_handler(struct nl_m
  219. else
  220. printf("\tfreq: %d\n", freq);
  221. +#ifdef IW_FULL
  222. if (freq > 45000)
  223. is_dmg = true;
  224. +#endif
  225. }
  226. if (bss[NL80211_BSS_BEACON_INTERVAL])
  227. printf("\tbeacon interval: %d TUs\n",
  228. @@ -2857,6 +2872,7 @@ static int handle_stop_sched_scan(struct
  229. return 0;
  230. }
  231. +#ifdef IW_FULL
  232. COMMAND(scan, sched_start,
  233. SCHED_SCAN_OPTIONS,
  234. NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
  235. @@ -2867,3 +2883,4 @@ COMMAND(scan, sched_start,
  236. COMMAND(scan, sched_stop, "",
  237. NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
  238. "Stop an ongoing scheduled scan.");
  239. +#endif
  240. --- a/util.c
  241. +++ b/util.c
  242. @@ -153,6 +153,7 @@ static const char *commands[NL80211_CMD_
  243. static char cmdbuf[100];
  244. +#ifdef IW_FULL
  245. const char *command_name(enum nl80211_commands cmd)
  246. {
  247. if (cmd <= NL80211_CMD_MAX && commands[cmd])
  248. @@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co
  249. sprintf(cmdbuf, "Unknown command (%d)", cmd);
  250. return cmdbuf;
  251. }
  252. +#endif
  253. int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
  254. {
  255. @@ -313,6 +315,9 @@ int parse_keys(struct nl_msg *msg, char
  256. char keybuf[13];
  257. int pos = 0;
  258. +#ifndef IW_FULL
  259. + return 1;
  260. +#endif
  261. if (!*argc)
  262. return 1;
  263. --- a/Makefile
  264. +++ b/Makefile
  265. @@ -24,6 +24,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
  266. VERSION_OBJS := $(filter-out version.o, $(_OBJS))
  267. OBJS := $(VERSION_OBJS) version.o
  268. +OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm
  269. +ifdef IW_FULL
  270. + CFLAGS += -DIW_FULL
  271. +else
  272. + OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS))
  273. +endif
  274. ALL = iw
  275. ifeq ($(NO_PKG_CONFIG),)
  276. --- a/station.c
  277. +++ b/station.c
  278. @@ -801,10 +801,12 @@ static int handle_station_set_plink(stru
  279. nla_put_failure:
  280. return -ENOBUFS;
  281. }
  282. +#ifdef IW_FULL
  283. COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
  284. NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
  285. "Set mesh peer link action for this station (peer).",
  286. select_station_cmd, station_set_plink);
  287. +#endif
  288. static int handle_station_set_vlan(struct nl80211_state *state,
  289. struct nl_msg *msg,
  290. @@ -899,11 +901,13 @@ static int handle_station_set_mesh_power
  291. nla_put_failure:
  292. return -ENOBUFS;
  293. }
  294. +#ifdef IW_FULL
  295. COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
  296. "<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
  297. handle_station_set_mesh_power_mode,
  298. "Set link-specific mesh power mode for this station",
  299. select_station_cmd, station_set_mesh_power_mode);
  300. +#endif
  301. static int handle_station_set_airtime_weight(struct nl80211_state *state,
  302. struct nl_msg *msg,
  303. --- a/interface.c
  304. +++ b/interface.c
  305. @@ -668,9 +668,11 @@ static int handle_interface_wds_peer(str
  306. nla_put_failure:
  307. return -ENOBUFS;
  308. }
  309. +#ifdef IW_FULL
  310. COMMAND(set, peer, "<MAC address>",
  311. NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
  312. "Set interface WDS peer.");
  313. +#endif
  314. static int set_mcast_rate(struct nl80211_state *state,
  315. struct nl_msg *msg,
  316. @@ -760,6 +762,7 @@ static int handle_chan(struct nl80211_st
  317. return handle_chanfreq(state, msg, true, argc, argv, id);
  318. }
  319. +#ifdef IW_FULL
  320. SECTION(switch);
  321. COMMAND(switch, freq,
  322. "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
  323. @@ -1031,3 +1034,4 @@ COMMAND(set, tidconf, "[peer <MAC addres
  324. " $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates auto\n"
  325. " $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates limit vht-mcs-5 4:9\n"
  326. );
  327. +#endif
  328. --- a/phy.c
  329. +++ b/phy.c
  330. @@ -403,6 +403,7 @@ err_out:
  331. free(cac_trigger_argv);
  332. return err;
  333. }
  334. +#ifdef IW_FULL
  335. TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  336. "freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  337. "freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
  338. @@ -422,6 +423,7 @@ COMMAND(cac, background,
  339. NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background,
  340. "Start background channel availability check (CAC) looking to look for\n"
  341. "radars on the given channel.");
  342. +#endif
  343. static int handle_fragmentation(struct nl80211_state *state,
  344. struct nl_msg *msg,