200-reduce_size.patch 12 KB

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