200-reduce_size.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. --- a/event.c
  2. +++ b/event.c
  3. @@ -699,6 +699,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. @@ -734,6 +735,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_REG_CHANGE:
  16. printf("regulatory domain change: ");
  17. @@ -812,6 +814,7 @@ static int print_event(struct nl_msg *ms
  18. mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  19. printf("del station %s\n", macbuf);
  20. break;
  21. +#ifdef IW_FULL
  22. case NL80211_CMD_JOIN_IBSS:
  23. mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
  24. printf("IBSS %s joined\n", macbuf);
  25. @@ -989,9 +992,9 @@ static int print_event(struct nl_msg *ms
  26. parse_nan_match(tb);
  27. break;
  28. }
  29. +#endif
  30. default:
  31. - printf("unknown event %d (%s)\n",
  32. - gnlh->cmd, command_name(gnlh->cmd));
  33. + printf("unknown event %d\n", gnlh->cmd);
  34. break;
  35. }
  36. --- a/info.c
  37. +++ b/info.c
  38. @@ -205,6 +205,7 @@ next:
  39. }
  40. }
  41. +#ifdef IW_FULL
  42. if (tb_band[NL80211_BAND_ATTR_RATES]) {
  43. printf("\t\tBitrates (non-HT):\n");
  44. nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
  45. @@ -221,6 +222,7 @@ next:
  46. printf("\n");
  47. }
  48. }
  49. +#endif
  50. }
  51. }
  52. @@ -286,6 +288,7 @@ next:
  53. printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
  54. }
  55. +#ifdef IW_FULL
  56. if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
  57. int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
  58. int i;
  59. @@ -297,6 +300,7 @@ next:
  60. cipher_name(ciphers[i]));
  61. }
  62. }
  63. +#endif
  64. if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
  65. tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
  66. @@ -316,11 +320,13 @@ next:
  67. printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
  68. }
  69. +#ifdef IW_FULL
  70. if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
  71. printf("\tsoftware interface modes (can always be added):\n");
  72. nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
  73. printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
  74. }
  75. +#endif
  76. if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
  77. struct nlattr *nl_combi;
  78. @@ -417,6 +423,7 @@ broken_combination:
  79. printf("\tinterface combinations are not supported\n");
  80. }
  81. +#ifdef IW_FULL
  82. if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
  83. printf("\tSupported commands:\n");
  84. nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
  85. @@ -514,6 +521,7 @@ broken_combination:
  86. printf("\t\t * wake up on TCP connection\n");
  87. }
  88. }
  89. +#endif
  90. if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
  91. printf("\tDevice supports roaming.\n");
  92. @@ -552,6 +560,7 @@ broken_combination:
  93. }
  94. }
  95. +#ifdef IW_FULL
  96. if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
  97. unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  98. @@ -616,6 +625,7 @@ broken_combination:
  99. if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
  100. printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
  101. }
  102. +#endif
  103. if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
  104. printf("\tDevice supports T-DLS.\n");
  105. @@ -740,6 +750,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
  106. "List all wireless devices and their capabilities.");
  107. TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
  108. +#ifdef IW_FULL
  109. static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
  110. int argc, char **argv, enum id_input id)
  111. {
  112. @@ -751,6 +762,7 @@ static int handle_commands(struct nl8021
  113. }
  114. TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
  115. "list all known commands and their decimal & hex value");
  116. +#endif
  117. static int print_feature_handler(struct nl_msg *msg, void *arg)
  118. {
  119. --- a/scan.c
  120. +++ b/scan.c
  121. @@ -1197,6 +1197,9 @@ static void print_ht_op(const uint8_t ty
  122. printf("\t\t * secondary channel offset: %s\n",
  123. ht_secondary_offset[data[1] & 0x3]);
  124. printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
  125. +#ifndef IW_FULL
  126. + return;
  127. +#endif
  128. printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
  129. printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
  130. printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
  131. @@ -1524,6 +1527,14 @@ static void print_ie(const struct ie_pri
  132. static const struct ie_print ieprinters[] = {
  133. [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  134. + [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  135. + [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  136. + [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  137. + [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  138. + [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  139. + [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  140. + [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  141. +#ifdef IW_FULL
  142. [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  143. [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
  144. [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
  145. @@ -1533,21 +1544,15 @@ static const struct ie_print ieprinters[
  146. [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
  147. [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
  148. [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
  149. - [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
  150. [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
  151. [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
  152. - [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
  153. - [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
  154. - [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
  155. - [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
  156. - [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
  157. [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
  158. [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
  159. - [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
  160. [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
  161. [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
  162. [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
  163. [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
  164. +#endif
  165. };
  166. static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
  167. @@ -2026,6 +2031,7 @@ void print_ies(unsigned char *ie, int ie
  168. ieprinters[ie[0]].flags & BIT(ptype)) {
  169. print_ie(&ieprinters[ie[0]],
  170. ie[0], ie[1], ie + 2, &ie_buffer);
  171. +#ifdef IW_FULL
  172. } else if (ie[0] == 221 /* vendor */) {
  173. print_vendor(ie[1], ie + 2, unknown, ptype);
  174. } else if (unknown) {
  175. @@ -2035,6 +2041,7 @@ void print_ies(unsigned char *ie, int ie
  176. for (i=0; i<ie[1]; i++)
  177. printf(" %.2x", ie[2+i]);
  178. printf("\n");
  179. +#endif
  180. }
  181. ielen -= ie[1] + 2;
  182. ie += ie[1] + 2;
  183. @@ -2075,6 +2082,7 @@ static void print_capa_non_dmg(__u16 cap
  184. printf(" ESS");
  185. if (capa & WLAN_CAPABILITY_IBSS)
  186. printf(" IBSS");
  187. +#ifdef IW_FULL
  188. if (capa & WLAN_CAPABILITY_CF_POLLABLE)
  189. printf(" CfPollable");
  190. if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
  191. @@ -2103,6 +2111,7 @@ static void print_capa_non_dmg(__u16 cap
  192. printf(" DelayedBACK");
  193. if (capa & WLAN_CAPABILITY_IMM_BACK)
  194. printf(" ImmediateBACK");
  195. +#endif
  196. }
  197. static int print_bss_handler(struct nl_msg *msg, void *arg)
  198. @@ -2187,8 +2196,10 @@ static int print_bss_handler(struct nl_m
  199. if (bss[NL80211_BSS_FREQUENCY]) {
  200. int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
  201. printf("\tfreq: %d\n", freq);
  202. +#ifdef IW_FULL
  203. if (freq > 45000)
  204. is_dmg = true;
  205. +#endif
  206. }
  207. if (bss[NL80211_BSS_BEACON_INTERVAL])
  208. printf("\tbeacon interval: %d TUs\n",
  209. @@ -2382,6 +2393,7 @@ static int handle_stop_sched_scan(struct
  210. return 0;
  211. }
  212. +#ifdef IW_FULL
  213. COMMAND(scan, sched_start,
  214. SCHED_SCAN_OPTIONS,
  215. NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
  216. @@ -2392,3 +2404,4 @@ COMMAND(scan, sched_start,
  217. COMMAND(scan, sched_stop, "",
  218. NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
  219. "Stop an ongoing scheduled scan.");
  220. +#endif
  221. --- a/util.c
  222. +++ b/util.c
  223. @@ -289,6 +289,7 @@ static const char *commands[NL80211_CMD_
  224. static char cmdbuf[100];
  225. +#ifdef IW_FULL
  226. const char *command_name(enum nl80211_commands cmd)
  227. {
  228. if (cmd <= NL80211_CMD_MAX && commands[cmd])
  229. @@ -296,6 +297,7 @@ const char *command_name(enum nl80211_co
  230. sprintf(cmdbuf, "Unknown command (%d)", cmd);
  231. return cmdbuf;
  232. }
  233. +#endif
  234. int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
  235. {
  236. @@ -434,6 +436,9 @@ int parse_keys(struct nl_msg *msg, char
  237. char keybuf[13];
  238. int pos = 0;
  239. +#ifndef IW_FULL
  240. + return 1;
  241. +#endif
  242. if (!*argc)
  243. return 1;
  244. --- a/Makefile
  245. +++ b/Makefile
  246. @@ -31,6 +31,12 @@ OBJS-$(HWSIM) += hwsim.o
  247. OBJS += $(OBJS-y) $(OBJS-Y)
  248. +OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm
  249. +ifdef IW_FULL
  250. + CFLAGS += -DIW_FULL
  251. +else
  252. + OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS))
  253. +endif
  254. ALL = iw
  255. ifeq ($(NO_PKG_CONFIG),)
  256. --- a/station.c
  257. +++ b/station.c
  258. @@ -709,10 +709,12 @@ static int handle_station_set_plink(stru
  259. nla_put_failure:
  260. return -ENOBUFS;
  261. }
  262. +#ifdef IW_FULL
  263. COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
  264. NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
  265. "Set mesh peer link action for this station (peer).",
  266. select_station_cmd, station_set_plink);
  267. +#endif
  268. static int handle_station_set_vlan(struct nl80211_state *state,
  269. struct nl_msg *msg,
  270. @@ -807,11 +809,13 @@ static int handle_station_set_mesh_power
  271. nla_put_failure:
  272. return -ENOBUFS;
  273. }
  274. +#ifdef IW_FULL
  275. COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
  276. "<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
  277. handle_station_set_mesh_power_mode,
  278. "Set link-specific mesh power mode for this station",
  279. select_station_cmd, station_set_mesh_power_mode);
  280. +#endif
  281. static int handle_station_dump(struct nl80211_state *state,
  282. struct nl_msg *msg,
  283. --- a/interface.c
  284. +++ b/interface.c
  285. @@ -621,9 +621,11 @@ static int handle_interface_wds_peer(str
  286. nla_put_failure:
  287. return -ENOBUFS;
  288. }
  289. +#ifdef IW_FULL
  290. COMMAND(set, peer, "<MAC address>",
  291. NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
  292. "Set interface WDS peer.");
  293. +#endif
  294. static int set_mcast_rate(struct nl80211_state *state,
  295. struct nl_msg *msg,
  296. @@ -713,6 +715,7 @@ static int handle_chan(struct nl80211_st
  297. return handle_chanfreq(state, msg, true, argc, argv, id);
  298. }
  299. +#ifdef IW_FULL
  300. SECTION(switch);
  301. COMMAND(switch, freq,
  302. "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
  303. @@ -721,3 +724,4 @@ COMMAND(switch, freq,
  304. "Switch the operating channel by sending a channel switch announcement (CSA).");
  305. COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
  306. NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
  307. +#endif
  308. --- a/phy.c
  309. +++ b/phy.c
  310. @@ -359,6 +359,7 @@ static int handle_cac(struct nl80211_sta
  311. return 0;
  312. }
  313. +#ifdef IW_FULL
  314. TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  315. "freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
  316. "freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
  317. @@ -370,6 +371,7 @@ COMMAND(cac, trigger,
  318. NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_trigger,
  319. "Start or trigger a channel availability check (CAC) looking to look for\n"
  320. "radars on the given channel.");
  321. +#endif
  322. static int handle_fragmentation(struct nl80211_state *state,
  323. struct nl_msg *msg,