OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/wpa_supplicant/Makefile |
2 | +++ b/wpa_supplicant/Makefile |
||
3 | @@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS) |
||
4 | CFLAGS += -I$(abspath ../src) |
||
5 | CFLAGS += -I$(abspath ../src/utils) |
||
6 | |||
7 | +ifdef MULTICALL |
||
8 | +CFLAGS += -DMULTICALL |
||
9 | +endif |
||
10 | + |
||
11 | -include .config |
||
12 | -include $(if $(MULTICALL),../hostapd/.config) |
||
13 | |||
14 | @@ -117,6 +121,8 @@ OBJS_c += ../src/utils/common.o |
||
15 | OBJS_c += ../src/common/cli.o |
||
16 | OBJS += wmm_ac.o |
||
17 | |||
18 | +OBJS += ../src/common/wpa_ctrl.o |
||
19 | + |
||
20 | ifndef CONFIG_OS |
||
21 | ifdef CONFIG_NATIVE_WINDOWS |
||
22 | CONFIG_OS=win32 |
||
23 | --- a/wpa_supplicant/bss.c |
||
24 | +++ b/wpa_supplicant/bss.c |
||
25 | @@ -11,6 +11,7 @@ |
||
26 | #include "utils/common.h" |
||
27 | #include "utils/eloop.h" |
||
28 | #include "common/ieee802_11_defs.h" |
||
29 | +#include "common/ieee802_11_common.h" |
||
30 | #include "drivers/driver.h" |
||
31 | #include "eap_peer/eap.h" |
||
32 | #include "wpa_supplicant_i.h" |
||
3 | office | 33 | @@ -290,6 +291,10 @@ void calculate_update_time(const struct |
1 | office | 34 | static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, |
35 | struct os_reltime *fetch_time) |
||
36 | { |
||
37 | + struct ieee80211_ht_capabilities *capab; |
||
38 | + struct ieee80211_ht_operation *oper; |
||
39 | + struct ieee802_11_elems elems; |
||
40 | + |
||
41 | dst->flags = src->flags; |
||
42 | os_memcpy(dst->bssid, src->bssid, ETH_ALEN); |
||
43 | dst->freq = src->freq; |
||
3 | office | 44 | @@ -302,6 +307,15 @@ static void wpa_bss_copy_res(struct wpa_ |
1 | office | 45 | dst->est_throughput = src->est_throughput; |
46 | dst->snr = src->snr; |
||
47 | |||
48 | + memset(&elems, 0, sizeof(elems)); |
||
49 | + ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0); |
||
50 | + capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; |
||
51 | + oper = (struct ieee80211_ht_operation *) elems.ht_operation; |
||
52 | + if (capab) |
||
53 | + dst->ht_capab = le_to_host16(capab->ht_capabilities_info); |
||
54 | + if (oper) |
||
55 | + dst->ht_param = oper->ht_param; |
||
56 | + |
||
57 | calculate_update_time(fetch_time, src->age, &dst->last_update); |
||
58 | } |
||
59 | |||
60 | --- a/wpa_supplicant/bss.h |
||
61 | +++ b/wpa_supplicant/bss.h |
||
3 | office | 62 | @@ -80,6 +80,10 @@ struct wpa_bss { |
1 | office | 63 | u8 ssid[SSID_MAX_LEN]; |
64 | /** Length of SSID */ |
||
65 | size_t ssid_len; |
||
66 | + /** HT capabilities */ |
||
67 | + u16 ht_capab; |
||
68 | + /* Five octets of HT Operation Information */ |
||
69 | + u8 ht_param; |
||
70 | /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ |
||
71 | int freq; |
||
72 | /** Beacon interval in TUs (host byte order) */ |
||
73 | --- a/wpa_supplicant/main.c |
||
74 | +++ b/wpa_supplicant/main.c |
||
75 | @@ -34,7 +34,7 @@ static void usage(void) |
||
76 | "vW] [-P<pid file>] " |
||
77 | "[-g<global ctrl>] \\\n" |
||
78 | " [-G<group>] \\\n" |
||
79 | - " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] " |
||
80 | + " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>] " |
||
81 | "[-p<driver_param>] \\\n" |
||
82 | " [-b<br_ifname>] [-e<entropy file>]" |
||
83 | #ifdef CONFIG_DEBUG_FILE |
||
84 | @@ -74,6 +74,7 @@ static void usage(void) |
||
85 | " -g = global ctrl_interface\n" |
||
86 | " -G = global ctrl_interface group\n" |
||
87 | " -h = show this help text\n" |
||
88 | + " -H = connect to a hostapd instance to manage state changes\n" |
||
89 | " -i = interface name\n" |
||
90 | " -I = additional configuration file\n" |
||
91 | " -K = include keys (passwords, etc.) in debug output\n" |
||
92 | @@ -201,7 +202,7 @@ int main(int argc, char *argv[]) |
||
93 | |||
94 | for (;;) { |
||
95 | c = getopt(argc, argv, |
||
96 | - "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); |
||
97 | + "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW"); |
||
98 | if (c < 0) |
||
99 | break; |
||
100 | switch (c) { |
||
101 | @@ -248,6 +249,9 @@ int main(int argc, char *argv[]) |
||
102 | usage(); |
||
103 | exitcode = 0; |
||
104 | goto out; |
||
105 | + case 'H': |
||
106 | + iface->hostapd_ctrl = optarg; |
||
107 | + break; |
||
108 | case 'i': |
||
109 | iface->ifname = optarg; |
||
110 | break; |
||
111 | --- a/wpa_supplicant/wpa_supplicant.c |
||
112 | +++ b/wpa_supplicant/wpa_supplicant.c |
||
113 | @@ -125,6 +125,55 @@ static void wpas_update_fils_connect_par |
||
114 | #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ |
||
115 | |||
116 | |||
117 | +static int hostapd_stop(struct wpa_supplicant *wpa_s) |
||
118 | +{ |
||
119 | + const char *cmd = "STOP_AP"; |
||
120 | + char buf[256]; |
||
121 | + size_t len = sizeof(buf); |
||
122 | + |
||
123 | + if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) { |
||
124 | + wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n"); |
||
125 | + return -1; |
||
126 | + } |
||
127 | + return 0; |
||
128 | +} |
||
129 | + |
||
130 | +static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) |
||
131 | +{ |
||
132 | + char *cmd = NULL; |
||
133 | + char buf[256]; |
||
134 | + size_t len = sizeof(buf); |
||
135 | + enum hostapd_hw_mode hw_mode; |
||
136 | + u8 channel; |
||
137 | + int sec_chan = 0; |
||
138 | + int ret; |
||
139 | + |
||
140 | + if (!bss) |
||
141 | + return -1; |
||
142 | + |
||
143 | + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) { |
||
144 | + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; |
||
145 | + if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) |
||
146 | + sec_chan = 1; |
||
147 | + else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) |
||
148 | + sec_chan = -1; |
||
149 | + } |
||
150 | + |
||
151 | + hw_mode = ieee80211_freq_to_chan(bss->freq, &channel); |
||
152 | + if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d", |
||
153 | + channel, sec_chan, hw_mode) < 0) |
||
154 | + return -1; |
||
155 | + |
||
156 | + ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); |
||
157 | + free(cmd); |
||
158 | + |
||
159 | + if (ret < 0) { |
||
160 | + wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); |
||
161 | + return -1; |
||
162 | + } |
||
163 | + return 0; |
||
164 | +} |
||
165 | + |
||
166 | /* Configure default/group WEP keys for static WEP */ |
||
167 | int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) |
||
168 | { |
||
3 | office | 169 | @@ -893,12 +942,16 @@ void wpa_supplicant_set_state(struct wpa |
1 | office | 170 | |
171 | sme_sched_obss_scan(wpa_s, 1); |
||
172 | |||
173 | + if (wpa_s->hostapd) |
||
174 | + hostapd_reload(wpa_s, wpa_s->current_bss); |
||
175 | #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) |
||
176 | if (!fils_hlp_sent && ssid && ssid->eap.erp) |
||
177 | wpas_update_fils_connect_params(wpa_s); |
||
178 | #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ |
||
179 | } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || |
||
180 | state == WPA_ASSOCIATED) { |
||
181 | + if (wpa_s->hostapd) |
||
182 | + hostapd_stop(wpa_s); |
||
183 | wpa_s->new_connection = 1; |
||
184 | wpa_drv_set_operstate(wpa_s, 0); |
||
185 | #ifndef IEEE8021X_EAPOL |
||
3 | office | 186 | @@ -1920,6 +1973,8 @@ void wpa_supplicant_associate(struct wpa |
1 | office | 187 | wpa_ssid_txt(ssid->ssid, ssid->ssid_len), |
188 | ssid->id); |
||
189 | wpas_notify_mesh_group_started(wpa_s, ssid); |
||
190 | + if (wpa_s->hostapd) |
||
191 | + hostapd_reload(wpa_s, wpa_s->current_bss); |
||
192 | #else /* CONFIG_MESH */ |
||
193 | wpa_msg(wpa_s, MSG_ERROR, |
||
194 | "mesh mode support not included in the build"); |
||
3 | office | 195 | @@ -5362,6 +5417,16 @@ static int wpa_supplicant_init_iface(str |
1 | office | 196 | sizeof(wpa_s->bridge_ifname)); |
197 | } |
||
198 | |||
199 | + if (iface->hostapd_ctrl) { |
||
200 | + wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl); |
||
201 | + if (!wpa_s->hostapd) { |
||
202 | + wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n"); |
||
203 | + return -1; |
||
204 | + } |
||
205 | + if (hostapd_stop(wpa_s) < 0) |
||
206 | + return -1; |
||
207 | + } |
||
208 | + |
||
209 | /* RSNA Supplicant Key Management - INITIALIZE */ |
||
210 | eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); |
||
211 | eapol_sm_notify_portValid(wpa_s->eapol, FALSE); |
||
3 | office | 212 | @@ -5683,6 +5748,11 @@ static void wpa_supplicant_deinit_iface( |
1 | office | 213 | if (terminate) |
214 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); |
||
215 | |||
216 | + if (wpa_s->hostapd) { |
||
217 | + wpa_ctrl_close(wpa_s->hostapd); |
||
218 | + wpa_s->hostapd = NULL; |
||
219 | + } |
||
220 | + |
||
221 | if (wpa_s->ctrl_iface) { |
||
222 | wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface); |
||
223 | wpa_s->ctrl_iface = NULL; |
||
224 | --- a/wpa_supplicant/wpa_supplicant_i.h |
||
225 | +++ b/wpa_supplicant/wpa_supplicant_i.h |
||
226 | @@ -101,6 +101,11 @@ struct wpa_interface { |
||
227 | const char *ifname; |
||
228 | |||
229 | /** |
||
230 | + * hostapd_ctrl - path to hostapd control socket for notification |
||
231 | + */ |
||
232 | + const char *hostapd_ctrl; |
||
233 | + |
||
234 | + /** |
||
235 | * bridge_ifname - Optional bridge interface name |
||
236 | * |
||
237 | * If the driver interface (ifname) is included in a Linux bridge |
||
238 | @@ -513,6 +518,8 @@ struct wpa_supplicant { |
||
239 | #endif /* CONFIG_CTRL_IFACE_BINDER */ |
||
240 | char bridge_ifname[16]; |
||
241 | |||
242 | + struct wpa_ctrl *hostapd; |
||
243 | + |
||
244 | char *confname; |
||
245 | char *confanother; |
||
246 |