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