iw: restore limited event monitor functionality (#20546)
[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/scan.c
111 +++ b/scan.c
112 @@ -1080,6 +1080,7 @@ static void print_ht_op(const uint8_t ty
113         printf("\t\t * secondary channel offset: %s\n",
114                 ht_secondary_offset[data[1] & 0x3]);
115         printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
116 +       return;
117         printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
118         printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
119         printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
120 @@ -1311,6 +1312,13 @@ static void print_ie(const struct ie_pri
121  
122  static const struct ie_print ieprinters[] = {
123         [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
124 +       [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
125 +       [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
126 +       [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
127 +       [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
128 +       [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
129 +       [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
130 +#if 0
131         [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
132         [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
133         [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
134 @@ -1320,14 +1328,8 @@ static const struct ie_print ieprinters[
135         [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
136         [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
137         [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
138 -       [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
139         [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
140         [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
141 -       [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
142 -       [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
143 -       [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
144 -       [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
145 -       [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
146         [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
147         [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
148         [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
149 @@ -1335,6 +1337,7 @@ static const struct ie_print ieprinters[
150         [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
151         [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
152         [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
153 +#endif
154  };
155  
156  static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
157 @@ -1766,6 +1769,7 @@ void print_ies(unsigned char *ie, int ie
158                     ieprinters[ie[0]].name &&
159                     ieprinters[ie[0]].flags & BIT(ptype)) {
160                         print_ie(&ieprinters[ie[0]], ie[0], ie[1], ie + 2);
161 +#if 0
162                 } else if (ie[0] == 221 /* vendor */) {
163                         print_vendor(ie[1], ie + 2, unknown, ptype);
164                 } else if (unknown) {
165 @@ -1775,6 +1779,7 @@ void print_ies(unsigned char *ie, int ie
166                         for (i=0; i<ie[1]; i++)
167                                 printf(" %.2x", ie[2+i]);
168                         printf("\n");
169 +#endif
170                 }
171                 ielen -= ie[1] + 2;
172                 ie += ie[1] + 2;
173 @@ -1815,6 +1820,7 @@ static void print_capa_non_dmg(__u16 cap
174                 printf(" ESS");
175         if (capa & WLAN_CAPABILITY_IBSS)
176                 printf(" IBSS");
177 +#if 0
178         if (capa & WLAN_CAPABILITY_CF_POLLABLE)
179                 printf(" CfPollable");
180         if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
181 @@ -1843,6 +1849,7 @@ static void print_capa_non_dmg(__u16 cap
182                 printf(" DelayedBACK");
183         if (capa & WLAN_CAPABILITY_IMM_BACK)
184                 printf(" ImmediateBACK");
185 +#endif
186  }
187  
188  static int print_bss_handler(struct nl_msg *msg, void *arg)
189 @@ -1921,8 +1928,10 @@ static int print_bss_handler(struct nl_m
190         if (bss[NL80211_BSS_FREQUENCY]) {
191                 int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
192                 printf("\tfreq: %d\n", freq);
193 +#if 0
194                 if (freq > 45000)
195                         is_dmg = true;
196 +#endif
197         }
198         if (bss[NL80211_BSS_BEACON_INTERVAL])
199                 printf("\tbeacon interval: %d TUs\n",
200 --- a/util.c
201 +++ b/util.c
202 @@ -264,6 +264,7 @@ static const char *commands[NL80211_CMD_
203  
204  static char cmdbuf[100];
205  
206 +#if 0
207  const char *command_name(enum nl80211_commands cmd)
208  {
209         if (cmd <= NL80211_CMD_MAX && commands[cmd])
210 @@ -271,6 +272,7 @@ const char *command_name(enum nl80211_co
211         sprintf(cmdbuf, "Unknown command (%d)", cmd);
212         return cmdbuf;
213  }
214 +#endif
215  
216  int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
217  {
218 --- a/event.c
219 +++ b/event.c
220 @@ -334,6 +334,7 @@ static int print_event(struct nl_msg *ms
221         }
222  
223         switch (gnlh->cmd) {
224 +#if 0
225         case NL80211_CMD_NEW_WIPHY:
226                 printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
227                 break;
228 @@ -368,6 +369,7 @@ static int print_event(struct nl_msg *ms
229         case NL80211_CMD_SCHED_SCAN_RESULTS:
230                 printf("got scheduled scan results\n");
231                 break;
232 +#endif
233         case NL80211_CMD_REG_CHANGE:
234                 printf("regulatory domain change: ");
235  
236 @@ -446,6 +448,7 @@ static int print_event(struct nl_msg *ms
237                 mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
238                 printf("del station %s\n", macbuf);
239                 break;
240 +#if 0
241         case NL80211_CMD_JOIN_IBSS:
242                 mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
243                 printf("IBSS %s joined\n", macbuf);
244 @@ -599,9 +602,9 @@ static int print_event(struct nl_msg *ms
245                 }
246                 printf("\n");
247                 break;
248 +#endif
249         default:
250 -               printf("unknown event %d (%s)\n",
251 -                      gnlh->cmd, command_name(gnlh->cmd));
252 +               printf("unknown event %d\n", gnlh->cmd);
253                 break;
254         }
255