hostapd: replace "argument list too long" fix with a simpler version
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 380-disable_ctrl_iface_mib.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Fri, 18 Mar 2011 02:15:52 +0000
3 Subject: [PATCH] Remove some unnecessary control interface functionality
4
5 --- a/hostapd/Makefile
6 +++ b/hostapd/Makefile
7 @@ -221,6 +221,9 @@ endif
8 ifdef CONFIG_NO_CTRL_IFACE
9 CFLAGS += -DCONFIG_NO_CTRL_IFACE
10 else
11 +ifdef CONFIG_CTRL_IFACE_MIB
12 +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
13 +endif
14 ifeq ($(CONFIG_CTRL_IFACE), udp)
15 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
16 else
17 --- a/hostapd/ctrl_iface.c
18 +++ b/hostapd/ctrl_iface.c
19 @@ -3897,6 +3897,7 @@ static int hostapd_ctrl_iface_receive_pr
20 reply_size);
21 } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
22 reply_len = hostapd_drv_status(hapd, reply, reply_size);
23 +#ifdef CONFIG_CTRL_IFACE_MIB
24 } else if (os_strcmp(buf, "MIB") == 0) {
25 reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
26 if (reply_len >= 0) {
27 @@ -3938,6 +3939,7 @@ static int hostapd_ctrl_iface_receive_pr
28 } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
29 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
30 reply_size);
31 +#endif
32 } else if (os_strcmp(buf, "ATTACH") == 0) {
33 if (hostapd_ctrl_iface_attach(hapd, from, fromlen, NULL))
34 reply_len = -1;
35 --- a/src/ap/ctrl_iface_ap.c
36 +++ b/src/ap/ctrl_iface_ap.c
37 @@ -26,6 +26,26 @@
38 #include "taxonomy.h"
39 #include "wnm_ap.h"
40
41 +static const char * hw_mode_str(enum hostapd_hw_mode mode)
42 +{
43 + switch (mode) {
44 + case HOSTAPD_MODE_IEEE80211B:
45 + return "b";
46 + case HOSTAPD_MODE_IEEE80211G:
47 + return "g";
48 + case HOSTAPD_MODE_IEEE80211A:
49 + return "a";
50 + case HOSTAPD_MODE_IEEE80211AD:
51 + return "ad";
52 + case HOSTAPD_MODE_IEEE80211ANY:
53 + return "any";
54 + case NUM_HOSTAPD_MODES:
55 + return "invalid";
56 + }
57 + return "unknown";
58 +}
59 +
60 +#ifdef CONFIG_CTRL_IFACE_MIB
61
62 static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen,
63 size_t curr_len, const u8 *mcs_set)
64 @@ -212,26 +232,6 @@ static const char * timeout_next_str(int
65 }
66
67
68 -static const char * hw_mode_str(enum hostapd_hw_mode mode)
69 -{
70 - switch (mode) {
71 - case HOSTAPD_MODE_IEEE80211B:
72 - return "b";
73 - case HOSTAPD_MODE_IEEE80211G:
74 - return "g";
75 - case HOSTAPD_MODE_IEEE80211A:
76 - return "a";
77 - case HOSTAPD_MODE_IEEE80211AD:
78 - return "ad";
79 - case HOSTAPD_MODE_IEEE80211ANY:
80 - return "any";
81 - case NUM_HOSTAPD_MODES:
82 - return "invalid";
83 - }
84 - return "unknown";
85 -}
86 -
87 -
88 static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
89 struct sta_info *sta,
90 char *buf, size_t buflen)
91 @@ -539,6 +539,7 @@ int hostapd_ctrl_iface_sta_next(struct h
92 return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
93 }
94
95 +#endif
96
97 #ifdef CONFIG_P2P_MANAGER
98 static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
99 @@ -951,12 +952,12 @@ int hostapd_ctrl_iface_status(struct hos
100 return len;
101 len += ret;
102 }
103 -
104 +#ifdef CONFIG_CTRL_IFACE_MIB
105 if (iface->conf->ieee80211n && !hapd->conf->disable_11n && mode) {
106 len = hostapd_write_ht_mcs_bitmask(buf, buflen, len,
107 mode->mcs_set);
108 }
109 -
110 +#endif /* CONFIG_CTRL_IFACE_MIB */
111 if (iface->current_rates && iface->num_rates) {
112 ret = os_snprintf(buf + len, buflen - len, "supported_rates=");
113 if (os_snprintf_error(buflen - len, ret))
114 --- a/src/ap/ieee802_1x.c
115 +++ b/src/ap/ieee802_1x.c
116 @@ -2837,6 +2837,7 @@ static const char * bool_txt(bool val)
117 return val ? "TRUE" : "FALSE";
118 }
119
120 +#ifdef CONFIG_CTRL_IFACE_MIB
121
122 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
123 {
124 @@ -3023,6 +3024,7 @@ int ieee802_1x_get_mib_sta(struct hostap
125 return len;
126 }
127
128 +#endif
129
130 #ifdef CONFIG_HS20
131 static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
132 --- a/src/ap/wpa_auth.c
133 +++ b/src/ap/wpa_auth.c
134 @@ -5583,6 +5583,7 @@ static const char * wpa_bool_txt(int val
135 return val ? "TRUE" : "FALSE";
136 }
137
138 +#ifdef CONFIG_CTRL_IFACE_MIB
139
140 #define RSN_SUITE "%02x-%02x-%02x-%d"
141 #define RSN_SUITE_ARG(s) \
142 @@ -5735,7 +5736,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
143
144 return len;
145 }
146 -
147 +#endif
148
149 void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth)
150 {
151 --- a/src/rsn_supp/wpa.c
152 +++ b/src/rsn_supp/wpa.c
153 @@ -3943,6 +3943,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
154 }
155
156
157 +#ifdef CONFIG_CTRL_IFACE_MIB
158 +
159 #define RSN_SUITE "%02x-%02x-%02x-%d"
160 #define RSN_SUITE_ARG(s) \
161 ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
162 @@ -4024,6 +4026,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
163
164 return (int) len;
165 }
166 +#endif
167 #endif /* CONFIG_CTRL_IFACE */
168
169
170 --- a/wpa_supplicant/Makefile
171 +++ b/wpa_supplicant/Makefile
172 @@ -1038,6 +1038,9 @@ ifdef CONFIG_FILS
173 OBJS += ../src/ap/fils_hlp.o
174 endif
175 ifdef CONFIG_CTRL_IFACE
176 +ifdef CONFIG_CTRL_IFACE_MIB
177 +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
178 +endif
179 OBJS += ../src/ap/ctrl_iface_ap.o
180 endif
181
182 --- a/wpa_supplicant/ap.c
183 +++ b/wpa_supplicant/ap.c
184 @@ -1520,7 +1520,7 @@ int wpas_ap_wps_nfc_report_handover(stru
185 #endif /* CONFIG_WPS */
186
187
188 -#ifdef CONFIG_CTRL_IFACE
189 +#if defined(CONFIG_CTRL_IFACE) && defined(CONFIG_CTRL_IFACE_MIB)
190
191 int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
192 char *buf, size_t buflen)
193 --- a/wpa_supplicant/ctrl_iface.c
194 +++ b/wpa_supplicant/ctrl_iface.c
195 @@ -2355,7 +2355,7 @@ static int wpa_supplicant_ctrl_iface_sta
196 pos += ret;
197 }
198
199 -#ifdef CONFIG_AP
200 +#if defined(CONFIG_AP) && defined(CONFIG_CTRL_IFACE_MIB)
201 if (wpa_s->ap_iface) {
202 pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
203 end - pos,
204 @@ -12542,6 +12542,7 @@ char * wpa_supplicant_ctrl_iface_process
205 reply_len = -1;
206 } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
207 wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
208 +#ifdef CONFIG_CTRL_IFACE_MIB
209 } else if (os_strcmp(buf, "MIB") == 0) {
210 reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
211 if (reply_len >= 0) {
212 @@ -12554,6 +12555,7 @@ char * wpa_supplicant_ctrl_iface_process
213 reply_size - reply_len);
214 #endif /* CONFIG_MACSEC */
215 }
216 +#endif
217 } else if (os_strncmp(buf, "STATUS", 6) == 0) {
218 reply_len = wpa_supplicant_ctrl_iface_status(
219 wpa_s, buf + 6, reply, reply_size);
220 @@ -13042,6 +13044,7 @@ char * wpa_supplicant_ctrl_iface_process
221 reply_len = wpa_supplicant_ctrl_iface_bss(
222 wpa_s, buf + 4, reply, reply_size);
223 #ifdef CONFIG_AP
224 +#ifdef CONFIG_CTRL_IFACE_MIB
225 } else if (os_strcmp(buf, "STA-FIRST") == 0) {
226 reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
227 } else if (os_strncmp(buf, "STA ", 4) == 0) {
228 @@ -13050,12 +13053,15 @@ char * wpa_supplicant_ctrl_iface_process
229 } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
230 reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
231 reply_size);
232 +#endif
233 +#ifdef CONFIG_CTRL_IFACE_MIB
234 } else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
235 if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15))
236 reply_len = -1;
237 } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
238 if (ap_ctrl_iface_sta_disassociate(wpa_s, buf + 13))
239 reply_len = -1;
240 +#endif
241 } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
242 if (ap_ctrl_iface_chanswitch(wpa_s, buf + 12))
243 reply_len = -1;