OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001 |
2 | From: Daniel Golle <daniel@makrotopia.org> |
||
3 | Date: Wed, 18 Apr 2018 19:24:31 +0200 |
||
4 | Subject: [PATCH 18/18] mesh: make forwarding configurable |
||
5 | |||
6 | Allow mesh_fwding to be specified in a mesh bss config, pass that |
||
7 | to the driver (only nl80211 implemented for now) and announce |
||
8 | forwarding capability accordingly. |
||
9 | |||
10 | Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
||
11 | --- |
||
12 | src/ap/ap_config.h | 2 ++ |
||
13 | src/drivers/driver.h | 2 ++ |
||
14 | src/drivers/driver_nl80211.c | 3 +++ |
||
15 | wpa_supplicant/config.c | 4 ++++ |
||
16 | wpa_supplicant/config.h | 9 +++++++++ |
||
17 | wpa_supplicant/config_file.c | 4 ++++ |
||
18 | wpa_supplicant/config_ssid.h | 5 +++++ |
||
19 | wpa_supplicant/mesh.c | 6 ++++++ |
||
20 | wpa_supplicant/mesh_mpm.c | 4 ++-- |
||
21 | wpa_supplicant/wpa_supplicant.conf | 3 +++ |
||
22 | 10 files changed, 40 insertions(+), 2 deletions(-) |
||
23 | |||
24 | --- a/src/ap/ap_config.h |
||
25 | +++ b/src/ap/ap_config.h |
||
26 | @@ -49,6 +49,7 @@ struct mesh_conf { |
||
27 | int dot11MeshRetryTimeout; /* msec */ |
||
28 | int dot11MeshConfirmTimeout; /* msec */ |
||
29 | int dot11MeshHoldingTimeout; /* msec */ |
||
30 | + int mesh_fwding; |
||
31 | }; |
||
32 | |||
33 | #define MAX_STA_COUNT 2007 |
||
34 | @@ -628,6 +629,7 @@ struct hostapd_bss_config { |
||
35 | |||
36 | #define MESH_ENABLED BIT(0) |
||
37 | int mesh; |
||
38 | + int mesh_fwding; |
||
39 | |||
40 | u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; |
||
41 | |||
42 | --- a/src/drivers/driver.h |
||
43 | +++ b/src/drivers/driver.h |
||
44 | @@ -1375,6 +1375,7 @@ struct wpa_driver_mesh_bss_params { |
||
45 | #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 |
||
46 | #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 |
||
47 | #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 |
||
48 | +#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 |
||
49 | /* |
||
50 | * TODO: Other mesh configuration parameters would go here. |
||
51 | * See NL80211_MESHCONF_* for all the mesh config parameters. |
||
52 | @@ -1384,6 +1385,7 @@ struct wpa_driver_mesh_bss_params { |
||
53 | int peer_link_timeout; |
||
54 | int max_peer_links; |
||
55 | int rssi_threshold; |
||
56 | + int forwarding; |
||
57 | u16 ht_opmode; |
||
58 | }; |
||
59 | |||
60 | --- a/src/drivers/driver_nl80211.c |
||
61 | +++ b/src/drivers/driver_nl80211.c |
||
62 | @@ -9332,6 +9332,9 @@ static int nl80211_put_mesh_config(struc |
||
63 | if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && |
||
64 | nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, |
||
65 | params->auto_plinks)) || |
||
66 | + ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && |
||
67 | + nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, |
||
68 | + params->forwarding)) || |
||
69 | ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && |
||
70 | nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, |
||
71 | params->max_peer_links)) || |
||
72 | --- a/wpa_supplicant/config.c |
||
73 | +++ b/wpa_supplicant/config.c |
||
74 | @@ -2228,6 +2228,7 @@ static const struct parse_data ssid_fiel |
||
75 | #ifdef CONFIG_MESH |
||
76 | { INT_RANGE(mode, 0, 5) }, |
||
77 | { INT_RANGE(no_auto_peer, 0, 1) }, |
||
78 | + { INT_RANGE(mesh_fwding, 0, 1) }, |
||
79 | { INT_RANGE(mesh_rssi_threshold, -255, 1) }, |
||
80 | #else /* CONFIG_MESH */ |
||
81 | { INT_RANGE(mode, 0, 4) }, |
||
82 | @@ -2779,6 +2780,7 @@ void wpa_config_set_network_defaults(str |
||
83 | ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; |
||
84 | ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; |
||
85 | ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; |
||
86 | + ssid->mesh_fwding = DEFAULT_MESH_FWDING; |
||
87 | ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; |
||
88 | #endif /* CONFIG_MESH */ |
||
89 | #ifdef CONFIG_HT_OVERRIDES |
||
90 | @@ -3996,6 +3998,7 @@ struct wpa_config * wpa_config_alloc_emp |
||
91 | config->user_mpm = DEFAULT_USER_MPM; |
||
92 | config->max_peer_links = DEFAULT_MAX_PEER_LINKS; |
||
93 | config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; |
||
94 | + config->mesh_fwding = DEFAULT_MESH_FWDING; |
||
95 | config->dot11RSNASAERetransPeriod = |
||
96 | DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; |
||
97 | config->fast_reauth = DEFAULT_FAST_REAUTH; |
||
98 | @@ -4618,6 +4621,7 @@ static const struct global_parse_data gl |
||
99 | { INT(user_mpm), 0 }, |
||
100 | { INT_RANGE(max_peer_links, 0, 255), 0 }, |
||
101 | { INT(mesh_max_inactivity), 0 }, |
||
102 | + { INT_RANGE(mesh_fwding, 0, 1), 0 }, |
||
103 | { INT(dot11RSNASAERetransPeriod), 0 }, |
||
104 | #endif /* CONFIG_MESH */ |
||
105 | { INT(disable_scan_offload), 0 }, |
||
106 | --- a/wpa_supplicant/config.h |
||
107 | +++ b/wpa_supplicant/config.h |
||
108 | @@ -18,6 +18,7 @@ |
||
109 | #define DEFAULT_USER_MPM 1 |
||
110 | #define DEFAULT_MAX_PEER_LINKS 99 |
||
111 | #define DEFAULT_MESH_MAX_INACTIVITY 300 |
||
112 | +#define DEFAULT_MESH_FWDING 1 |
||
113 | /* |
||
114 | * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, |
||
115 | * but use 1000 ms in practice to avoid issues on low power CPUs. |
||
116 | @@ -1306,6 +1307,14 @@ struct wpa_config { |
||
117 | int mesh_max_inactivity; |
||
118 | |||
119 | /** |
||
120 | + * mesh_fwding - Mesh network layer-2 forwarding |
||
121 | + * |
||
122 | + * This controls whether to enable layer-2 forwarding. |
||
123 | + * By default: 1: enabled |
||
124 | + */ |
||
125 | + int mesh_fwding; |
||
126 | + |
||
127 | + /** |
||
128 | * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame |
||
129 | * |
||
130 | * This timeout value is used in mesh STA to retransmit |
||
131 | --- a/wpa_supplicant/config_file.c |
||
132 | +++ b/wpa_supplicant/config_file.c |
||
133 | @@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL |
||
134 | #endif /* IEEE8021X_EAPOL */ |
||
135 | INT(mode); |
||
136 | INT(no_auto_peer); |
||
137 | + INT(mesh_fwding); |
||
138 | INT(frequency); |
||
139 | INT(fixed_freq); |
||
140 | #ifdef CONFIG_ACS |
||
141 | @@ -1450,6 +1451,9 @@ static void wpa_config_write_global(FILE |
||
142 | fprintf(f, "mesh_max_inactivity=%d\n", |
||
143 | config->mesh_max_inactivity); |
||
144 | |||
145 | + if (config->mesh_fwding != DEFAULT_MESH_FWDING) |
||
146 | + fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); |
||
147 | + |
||
148 | if (config->dot11RSNASAERetransPeriod != |
||
149 | DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) |
||
150 | fprintf(f, "dot11RSNASAERetransPeriod=%d\n", |
||
151 | --- a/wpa_supplicant/config_ssid.h |
||
152 | +++ b/wpa_supplicant/config_ssid.h |
||
153 | @@ -500,6 +500,11 @@ struct wpa_ssid { |
||
154 | int dot11MeshConfirmTimeout; /* msec */ |
||
155 | int dot11MeshHoldingTimeout; /* msec */ |
||
156 | |||
157 | + /** |
||
158 | + * Mesh network layer-2 forwarding |
||
159 | + */ |
||
160 | + int mesh_fwding; |
||
161 | + |
||
162 | int ht; |
||
163 | int ht40; |
||
164 | |||
165 | --- a/wpa_supplicant/mesh.c |
||
166 | +++ b/wpa_supplicant/mesh.c |
||
167 | @@ -121,6 +121,7 @@ static struct mesh_conf * mesh_config_cr |
||
168 | conf->mesh_cc_id = 0; |
||
169 | conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; |
||
170 | conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; |
||
171 | + conf->mesh_fwding = ssid->mesh_fwding; |
||
172 | conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; |
||
173 | conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; |
||
174 | conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; |
||
175 | @@ -256,6 +257,7 @@ static int wpa_supplicant_mesh_init(stru |
||
176 | bss->conf->start_disabled = 1; |
||
177 | bss->conf->mesh = MESH_ENABLED; |
||
178 | bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; |
||
179 | + bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; |
||
180 | |||
181 | if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, |
||
182 | wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { |
||
183 | @@ -534,6 +536,10 @@ int wpa_supplicant_join_mesh(struct wpa_ |
||
184 | } |
||
185 | params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; |
||
186 | |||
187 | + /* always explicitely set forwarding to on or off for now */ |
||
188 | + params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; |
||
189 | + params->conf.forwarding = ssid->mesh_fwding; |
||
190 | + |
||
191 | wpa_s->mesh_params = params; |
||
192 | if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { |
||
193 | wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); |
||
194 | --- a/wpa_supplicant/mesh_mpm.c |
||
195 | +++ b/wpa_supplicant/mesh_mpm.c |
||
196 | @@ -289,9 +289,9 @@ static void mesh_mpm_send_plink_action(s |
||
197 | info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; |
||
198 | /* TODO: Add Connected to Mesh Gate/AS subfields */ |
||
199 | wpabuf_put_u8(buf, info); |
||
200 | - /* always forwarding & accepting plinks for now */ |
||
201 | + /* set forwarding & always accepting plinks for now */ |
||
202 | wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | |
||
203 | - MESH_CAP_FORWARDING); |
||
204 | + (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); |
||
205 | } else { /* Peer closing frame */ |
||
206 | /* IE: Mesh ID */ |
||
207 | wpabuf_put_u8(buf, WLAN_EID_MESH_ID); |
||
208 | --- a/wpa_supplicant/wpa_supplicant.conf |
||
209 | +++ b/wpa_supplicant/wpa_supplicant.conf |
||
210 | @@ -153,6 +153,9 @@ ap_scan=1 |
||
211 | # This timeout value is used in mesh STA to clean up inactive stations. |
||
212 | #mesh_max_inactivity=300 |
||
213 | |||
214 | +# Enable 802.11s layer-2 routing and forwarding |
||
215 | +#mesh_fwding=1 |
||
216 | + |
||
217 | # cert_in_cb - Whether to include a peer certificate dump in events |
||
218 | # This controls whether peer certificates for authentication server and |
||
219 | # its certificate chain are included in EAP peer certificate events. This is |