200-reduce_size.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. @@ -1308,6 +1308,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. @@ -1818,30 +1821,31 @@ static void print_ie(const struct ie_pri
  131. static const struct ie_print ieprinters[] = {
  132. [0] = { "SSID", print_ssid, 0, 32,
  133. BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), },
  134. + [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
  135. + [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  136. + [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  137. + [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  138. + [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  139. + [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  140. + [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  141. + [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  142. +#ifdef IW_FULL
  143. [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  144. [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
  145. [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
  146. [6] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), },
  147. [7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
  148. - [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
  149. [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
  150. [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
  151. [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
  152. - [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  153. [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
  154. [51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), },
  155. [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
  156. [66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
  157. [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
  158. - [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  159. - [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  160. - [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  161. - [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  162. - [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  163. [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  164. [70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
  165. [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
  166. - [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  167. [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
  168. [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
  169. [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
  170. @@ -1850,6 +1854,7 @@ static const struct ie_print ieprinters[
  171. [214] = { "Short beacon interval", print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), },
  172. [217] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), },
  173. [232] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), },
  174. +#endif
  175. };
  176. static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
  177. @@ -2185,8 +2190,10 @@ static void print_wifi_wps(const uint8_t
  178. static const struct ie_print wifiprinters[] = {
  179. [1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), },
  180. +#ifdef IW_FULL
  181. [2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
  182. [4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
  183. +#endif
  184. };
  185. static inline void print_p2p(const uint8_t type, uint8_t len,
  186. @@ -2349,6 +2356,10 @@ static void print_vendor(unsigned char l
  187. return;
  188. }
  189. +#ifdef IW_FULL
  190. + return;
  191. +#endif
  192. +
  193. if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) {
  194. if (data[3] < ARRAY_SIZE(wfa_printers) &&
  195. wfa_printers[data[3]].name &&
  196. @@ -2483,6 +2494,7 @@ static void print_capa_non_dmg(__u16 cap
  197. printf(" ESS");
  198. if (capa & WLAN_CAPABILITY_IBSS)
  199. printf(" IBSS");
  200. +#ifdef IW_FULL
  201. if (capa & WLAN_CAPABILITY_CF_POLLABLE)
  202. printf(" CfPollable");
  203. if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
  204. @@ -2511,6 +2523,7 @@ static void print_capa_non_dmg(__u16 cap
  205. printf(" DelayedBACK");
  206. if (capa & WLAN_CAPABILITY_IMM_BACK)
  207. printf(" ImmediateBACK");
  208. +#endif
  209. }
  210. static int print_bss_handler(struct nl_msg *msg, void *arg)
  211. @@ -2601,8 +2614,10 @@ static int print_bss_handler(struct nl_m
  212. else
  213. printf("\tfreq: %d\n", freq);
  214. +#ifdef IW_FULL
  215. if (freq > 45000)
  216. is_dmg = true;
  217. +#endif
  218. }
  219. if (bss[NL80211_BSS_BEACON_INTERVAL])
  220. printf("\tbeacon interval: %d TUs\n",
  221. @@ -2796,6 +2811,7 @@ static int handle_stop_sched_scan(struct
  222. return 0;
  223. }
  224. +#ifdef IW_FULL
  225. COMMAND(scan, sched_start,
  226. SCHED_SCAN_OPTIONS,
  227. NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
  228. @@ -2806,3 +2822,4 @@ COMMAND(scan, sched_start,
  229. COMMAND(scan, sched_stop, "",
  230. NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
  231. "Stop an ongoing scheduled scan.");
  232. +#endif
  233. --- a/util.c
  234. +++ b/util.c
  235. @@ -153,6 +153,7 @@ static const char *commands[NL80211_CMD_
  236. static char cmdbuf[100];
  237. +#ifdef IW_FULL
  238. const char *command_name(enum nl80211_commands cmd)
  239. {
  240. if (cmd <= NL80211_CMD_MAX && commands[cmd])
  241. @@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co
  242. sprintf(cmdbuf, "Unknown command (%d)", cmd);
  243. return cmdbuf;
  244. }
  245. +#endif
  246. int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
  247. {
  248. @@ -313,6 +315,9 @@ int parse_keys(struct nl_msg *msg, char
  249. char keybuf[13];
  250. int pos = 0;
  251. +#ifndef IW_FULL
  252. + return 1;
  253. +#endif
  254. if (!*argc)
  255. return 1;
  256. --- a/Makefile
  257. +++ b/Makefile
  258. @@ -24,6 +24,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
  259. VERSION_OBJS := $(filter-out version.o, $(_OBJS))
  260. OBJS := $(VERSION_OBJS) version.o
  261. +OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm
  262. +ifdef IW_FULL
  263. + CFLAGS += -DIW_FULL
  264. +else
  265. + OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS))
  266. +endif
  267. ALL = iw
  268. ifeq ($(NO_PKG_CONFIG),)
  269. --- a/station.c
  270. +++ b/station.c
  271. @@ -801,10 +801,12 @@ static int handle_station_set_plink(stru
  272. nla_put_failure:
  273. return -ENOBUFS;
  274. }
  275. +#ifdef IW_FULL
  276. COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
  277. NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
  278. "Set mesh peer link action for this station (peer).",
  279. select_station_cmd, station_set_plink);
  280. +#endif
  281. static int handle_station_set_vlan(struct nl80211_state *state,
  282. struct nl_msg *msg,
  283. @@ -899,11 +901,13 @@ static int handle_station_set_mesh_power
  284. nla_put_failure:
  285. return -ENOBUFS;
  286. }
  287. +#ifdef IW_FULL
  288. COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
  289. "<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
  290. handle_station_set_mesh_power_mode,
  291. "Set link-specific mesh power mode for this station",
  292. select_station_cmd, station_set_mesh_power_mode);
  293. +#endif
  294. static int handle_station_set_airtime_weight(struct nl80211_state *state,
  295. struct nl_msg *msg,
  296. --- a/interface.c
  297. +++ b/interface.c
  298. @@ -668,9 +668,11 @@ static int handle_interface_wds_peer(str
  299. nla_put_failure:
  300. return -ENOBUFS;
  301. }
  302. +#ifdef IW_FULL
  303. COMMAND(set, peer, "<MAC address>",
  304. NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
  305. "Set interface WDS peer.");
  306. +#endif
  307. static int set_mcast_rate(struct nl80211_state *state,
  308. struct nl_msg *msg,
  309. @@ -760,6 +762,7 @@ static int handle_chan(struct nl80211_st
  310. return handle_chanfreq(state, msg, true, argc, argv, id);
  311. }
  312. +#ifdef IW_FULL
  313. SECTION(switch);
  314. COMMAND(switch, freq,
  315. "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
  316. @@ -1031,3 +1034,4 @@ COMMAND(set, tidconf, "[peer <MAC addres
  317. " $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates auto\n"
  318. " $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates limit vht-mcs-5 4:9\n"
  319. );
  320. +#endif
  321. --- a/phy.c
  322. +++ b/phy.c
  323. @@ -403,6 +403,7 @@ err_out:
  324. free(cac_trigger_argv);
  325. return err;
  326. }
  327. +#ifdef IW_FULL
  328. TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  329. "freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  330. "freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
  331. @@ -422,6 +423,7 @@ COMMAND(cac, background,
  332. NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background,
  333. "Start background channel availability check (CAC) looking to look for\n"
  334. "radars on the given channel.");
  335. +#endif
  336. static int handle_fragmentation(struct nl80211_state *state,
  337. struct nl_msg *msg,