CC: hostapd: update to version 2016-06-15
[15.05/openwrt.git] / package / network / services / hostapd / patches / 380-disable_ctrl_iface_mib.patch
1 --- a/hostapd/Makefile
2 +++ b/hostapd/Makefile
3 @@ -212,6 +212,9 @@ endif
4  ifdef CONFIG_NO_CTRL_IFACE
5  CFLAGS += -DCONFIG_NO_CTRL_IFACE
6  else
7 +ifdef CONFIG_CTRL_IFACE_MIB
8 +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
9 +endif
10  ifeq ($(CONFIG_CTRL_IFACE), udp)
11  CFLAGS += -DCONFIG_CTRL_IFACE_UDP
12  else
13 --- a/hostapd/ctrl_iface.c
14 +++ b/hostapd/ctrl_iface.c
15 @@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
16                                                       reply_size);
17         } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
18                 reply_len = hostapd_drv_status(hapd, reply, reply_size);
19 +#ifdef CONFIG_CTRL_IFACE_MIB
20         } else if (os_strcmp(buf, "MIB") == 0) {
21                 reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
22                 if (reply_len >= 0) {
23 @@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
24         } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
25                 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
26                                                         reply_size);
27 +#endif
28         } else if (os_strcmp(buf, "ATTACH") == 0) {
29                 if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
30                         reply_len = -1;
31 --- a/wpa_supplicant/Makefile
32 +++ b/wpa_supplicant/Makefile
33 @@ -872,6 +872,9 @@ ifdef CONFIG_MBO
34  OBJS += ../src/ap/mbo_ap.o
35  endif
36  ifdef CONFIG_CTRL_IFACE
37 +ifdef CONFIG_CTRL_IFACE_MIB
38 +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
39 +endif
40  OBJS += ../src/ap/ctrl_iface_ap.o
41  endif
42  
43 --- a/wpa_supplicant/ctrl_iface.c
44 +++ b/wpa_supplicant/ctrl_iface.c
45 @@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
46                         pos += ret;
47                 }
48  
49 -#ifdef CONFIG_AP
50 +#if defined(CONFIG_AP) && defined(CONFIG_CTRL_IFACE_MIB)
51                 if (wpa_s->ap_iface) {
52                         pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
53                                                             end - pos,
54 @@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
55                         reply_len = -1;
56         } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
57                 wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
58 +#ifdef CONFIG_CTRL_IFACE_MIB
59         } else if (os_strcmp(buf, "MIB") == 0) {
60                 reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
61                 if (reply_len >= 0) {
62 @@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
63                                                       reply + reply_len,
64                                                       reply_size - reply_len);
65                 }
66 +#endif
67         } else if (os_strncmp(buf, "STATUS", 6) == 0) {
68                 reply_len = wpa_supplicant_ctrl_iface_status(
69                         wpa_s, buf + 6, reply, reply_size);
70 @@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
71                 reply_len = wpa_supplicant_ctrl_iface_bss(
72                         wpa_s, buf + 4, reply, reply_size);
73  #ifdef CONFIG_AP
74 +#ifdef CONFIG_CTRL_IFACE_MIB
75         } else if (os_strcmp(buf, "STA-FIRST") == 0) {
76                 reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
77         } else if (os_strncmp(buf, "STA ", 4) == 0) {
78 @@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
79         } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
80                 reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
81                                                    reply_size);
82 +#endif
83 +#ifdef CONFIG_CTRL_IFACE_MIB
84         } else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
85                 if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15))
86                         reply_len = -1;
87         } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
88                 if (ap_ctrl_iface_sta_disassociate(wpa_s, buf + 13))
89                         reply_len = -1;
90 +#endif
91         } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
92                 if (ap_ctrl_iface_chanswitch(wpa_s, buf + 12))
93                         reply_len = -1;
94 --- a/src/ap/ctrl_iface_ap.c
95 +++ b/src/ap/ctrl_iface_ap.c
96 @@ -24,6 +24,7 @@
97  #include "ap_drv_ops.h"
98  #include "mbo_ap.h"
99  
100 +#ifdef CONFIG_CTRL_IFACE_MIB
101  
102  static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
103                                  struct sta_info *sta,
104 @@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
105         return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
106  }
107  
108 +#endif
109  
110  #ifdef CONFIG_P2P_MANAGER
111  static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
112 --- a/src/ap/ieee802_1x.c
113 +++ b/src/ap/ieee802_1x.c
114 @@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
115         return val ? "TRUE" : "FALSE";
116  }
117  
118 +#ifdef CONFIG_CTRL_IFACE_MIB
119  
120  int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
121  {
122 @@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
123         return len;
124  }
125  
126 +#endif
127  
128  #ifdef CONFIG_HS20
129  static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
130 --- a/src/ap/wpa_auth.c
131 +++ b/src/ap/wpa_auth.c
132 @@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
133         return val ? "TRUE" : "FALSE";
134  }
135  
136 +#ifdef CONFIG_CTRL_IFACE_MIB
137  
138  #define RSN_SUITE "%02x-%02x-%02x-%d"
139  #define RSN_SUITE_ARG(s) \
140 @@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
141  
142         return len;
143  }
144 -
145 +#endif
146  
147  void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth)
148  {
149 --- a/src/rsn_supp/wpa.c
150 +++ b/src/rsn_supp/wpa.c
151 @@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
152  }
153  
154  
155 +#ifdef CONFIG_CTRL_IFACE_MIB
156 +
157  #define RSN_SUITE "%02x-%02x-%02x-%d"
158  #define RSN_SUITE_ARG(s) \
159  ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
160 @@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
161  
162         return (int) len;
163  }
164 +#endif
165  #endif /* CONFIG_CTRL_IFACE */
166  
167  
168 --- a/wpa_supplicant/ap.c
169 +++ b/wpa_supplicant/ap.c
170 @@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
171  #endif /* CONFIG_WPS */
172  
173  
174 -#ifdef CONFIG_CTRL_IFACE
175 +#if defined(CONFIG_CTRL_IFACE) && defined(CONFIG_CTRL_IFACE_MIB)
176  
177  int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s,
178                             char *buf, size_t buflen)