iw: reduce size even more (~12k after gzip)
[openwrt/openwrt.git] / package / network / utils / iw / patches / 200-reduce_size.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -15,8 +15,8 @@ CFLAGS += -Wall -Wundef -Wstrict-prototy
4 OBJS = iw.o genl.o event.o info.o phy.o \
5 interface.o ibss.o station.o survey.o util.o ocb.o \
6 mesh.o mpath.o mpp.o scan.o reg.o version.o \
7 - reason.o status.o connect.o link.o offch.o ps.o cqm.o \
8 - bitrate.o wowlan.o coalesce.o roc.o p2p.o vendor.o
9 + reason.o status.o link.o offch.o ps.o cqm.o \
10 + bitrate.o vendor.o
11 OBJS += sections.o
12
13 OBJS-$(HWSIM) += hwsim.o
14 --- a/info.c
15 +++ b/info.c
16 @@ -219,6 +219,7 @@ next:
17 }
18 }
19
20 +#if 0
21 if (tb_band[NL80211_BAND_ATTR_RATES]) {
22 printf("\t\tBitrates (non-HT):\n");
23 nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
24 @@ -235,6 +236,7 @@ next:
25 printf("\n");
26 }
27 }
28 +#endif
29 }
30 }
31
32 @@ -291,6 +293,7 @@ next:
33 printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
34 }
35
36 +#if 0
37 if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
38 int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
39 int i;
40 @@ -302,6 +305,7 @@ next:
41 cipher_name(ciphers[i]));
42 }
43 }
44 +#endif
45
46 if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
47 tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
48 @@ -321,11 +325,13 @@ next:
49 printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
50 }
51
52 +#if 0
53 if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
54 printf("\tsoftware interface modes (can always be added):\n");
55 nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
56 printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
57 }
58 +#endif
59
60 if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
61 struct nlattr *nl_combi;
62 @@ -422,6 +428,7 @@ broken_combination:
63 printf("\tinterface combinations are not supported\n");
64 }
65
66 +#if 0
67 if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
68 printf("\tSupported commands:\n");
69 nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
70 @@ -518,6 +525,7 @@ broken_combination:
71 printf("\t\t * wake up on TCP connection\n");
72 }
73 }
74 +#endif
75
76 if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
77 printf("\tDevice supports roaming.\n");
78 @@ -554,6 +562,7 @@ broken_combination:
79 }
80 }
81
82 +#if 0
83 if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
84 unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
85
86 @@ -612,6 +621,7 @@ broken_combination:
87 if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)
88 printf("\tDevice supports TDLS channel switching\n");
89 }
90 +#endif
91
92 if (tb_msg[NL80211_ATTR_EXT_FEATURES]) {
93 struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES];
94 @@ -669,6 +679,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
95 "List all wireless devices and their capabilities.");
96 TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
97
98 +#if 0
99 static int handle_commands(struct nl80211_state *state,
100 struct nl_cb *cb, struct nl_msg *msg,
101 int argc, char **argv, enum id_input id)
102 @@ -681,6 +692,7 @@ static int handle_commands(struct nl8021
103 }
104 TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
105 "list all known commands and their decimal & hex value");
106 +#endif
107
108 static int print_feature_handler(struct nl_msg *msg, void *arg)
109 {
110 --- a/event.c
111 +++ b/event.c
112 @@ -298,6 +298,7 @@ static int print_event(struct nl_msg *ms
113 int rem_nst;
114 __u16 status;
115
116 + return;
117 if (args->time || args->reltime) {
118 unsigned long long usecs, previous;
119
120 @@ -764,8 +765,10 @@ static int print_events(struct nl80211_s
121
122 return __do_listen_events(state, 0, NULL, &args);
123 }
124 +#if 0
125 TOPLEVEL(event, "[-t] [-r] [-f]", 0, 0, CIB_NONE, print_events,
126 "Monitor events from the kernel.\n"
127 "-t - print timestamp\n"
128 "-r - print relative timstamp\n"
129 "-f - print full frame for auth/assoc etc.");
130 +#endif
131 --- a/scan.c
132 +++ b/scan.c
133 @@ -1080,6 +1080,7 @@ static void print_ht_op(const uint8_t ty
134 printf("\t\t * secondary channel offset: %s\n",
135 ht_secondary_offset[data[1] & 0x3]);
136 printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
137 + return;
138 printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
139 printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
140 printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
141 @@ -1311,6 +1312,13 @@ static void print_ie(const struct ie_pri
142
143 static const struct ie_print ieprinters[] = {
144 [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
145 + [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
146 + [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
147 + [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
148 + [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
149 + [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
150 + [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
151 +#if 0
152 [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
153 [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
154 [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
155 @@ -1320,14 +1328,8 @@ static const struct ie_print ieprinters[
156 [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
157 [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
158 [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
159 - [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
160 [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
161 [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
162 - [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
163 - [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
164 - [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
165 - [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
166 - [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
167 [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
168 [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
169 [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
170 @@ -1335,6 +1337,7 @@ static const struct ie_print ieprinters[
171 [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
172 [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
173 [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
174 +#endif
175 };
176
177 static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
178 @@ -1766,6 +1769,7 @@ void print_ies(unsigned char *ie, int ie
179 ieprinters[ie[0]].name &&
180 ieprinters[ie[0]].flags & BIT(ptype)) {
181 print_ie(&ieprinters[ie[0]], ie[0], ie[1], ie + 2);
182 +#if 0
183 } else if (ie[0] == 221 /* vendor */) {
184 print_vendor(ie[1], ie + 2, unknown, ptype);
185 } else if (unknown) {
186 @@ -1775,6 +1779,7 @@ void print_ies(unsigned char *ie, int ie
187 for (i=0; i<ie[1]; i++)
188 printf(" %.2x", ie[2+i]);
189 printf("\n");
190 +#endif
191 }
192 ielen -= ie[1] + 2;
193 ie += ie[1] + 2;
194 @@ -1815,6 +1820,7 @@ static void print_capa_non_dmg(__u16 cap
195 printf(" ESS");
196 if (capa & WLAN_CAPABILITY_IBSS)
197 printf(" IBSS");
198 +#if 0
199 if (capa & WLAN_CAPABILITY_CF_POLLABLE)
200 printf(" CfPollable");
201 if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
202 @@ -1843,6 +1849,7 @@ static void print_capa_non_dmg(__u16 cap
203 printf(" DelayedBACK");
204 if (capa & WLAN_CAPABILITY_IMM_BACK)
205 printf(" ImmediateBACK");
206 +#endif
207 }
208
209 static int print_bss_handler(struct nl_msg *msg, void *arg)
210 @@ -1921,8 +1928,10 @@ static int print_bss_handler(struct nl_m
211 if (bss[NL80211_BSS_FREQUENCY]) {
212 int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
213 printf("\tfreq: %d\n", freq);
214 +#if 0
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 --- a/util.c
222 +++ b/util.c
223 @@ -264,6 +264,7 @@ static const char *commands[NL80211_CMD_
224
225 static char cmdbuf[100];
226
227 +#if 0
228 const char *command_name(enum nl80211_commands cmd)
229 {
230 if (cmd <= NL80211_CMD_MAX && commands[cmd])
231 @@ -271,6 +272,7 @@ const char *command_name(enum nl80211_co
232 sprintf(cmdbuf, "Unknown command (%d)", cmd);
233 return cmdbuf;
234 }
235 +#endif
236
237 int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
238 {