mesh: Remove extra newline from the end of an error message
[mech_eap.git] / wpa_supplicant / mesh.c
1 /*
2  * WPA Supplicant - Basic mesh mode routines
3  * Copyright (c) 2013-2014, cozybit, Inc.  All rights reserved.
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8
9 #include "utils/includes.h"
10
11 #include "utils/common.h"
12 #include "utils/eloop.h"
13 #include "utils/uuid.h"
14 #include "common/ieee802_11_defs.h"
15 #include "common/wpa_ctrl.h"
16 #include "ap/sta_info.h"
17 #include "ap/hostapd.h"
18 #include "ap/ieee802_11.h"
19 #include "config_ssid.h"
20 #include "config.h"
21 #include "wpa_supplicant_i.h"
22 #include "driver_i.h"
23 #include "notify.h"
24 #include "ap.h"
25 #include "mesh_mpm.h"
26 #include "mesh_rsn.h"
27 #include "mesh.h"
28
29
30 static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s)
31 {
32         wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh);
33         wpa_s->ifmsh = NULL;
34         wpa_s->current_ssid = NULL;
35         os_free(wpa_s->mesh_rsn);
36         wpa_s->mesh_rsn = NULL;
37         /* TODO: leave mesh (stop beacon). This will happen on link down
38          * anyway, so it's not urgent */
39 }
40
41
42 void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s,
43                                       struct hostapd_iface *ifmsh)
44 {
45         if (!ifmsh)
46                 return;
47
48         if (ifmsh->mconf) {
49                 mesh_mpm_deinit(wpa_s, ifmsh);
50                 if (ifmsh->mconf->rsn_ie) {
51                         ifmsh->mconf->rsn_ie = NULL;
52                         /* We cannot free this struct
53                          * because wpa_authenticator on
54                          * hostapd side is also using it
55                          * for now just set to NULL and
56                          * let hostapd code free it.
57                          */
58                 }
59                 os_free(ifmsh->mconf);
60                 ifmsh->mconf = NULL;
61         }
62
63         /* take care of shared data */
64         hostapd_interface_deinit(ifmsh);
65         hostapd_interface_free(ifmsh);
66 }
67
68
69 static struct mesh_conf * mesh_config_create(struct wpa_ssid *ssid)
70 {
71         struct mesh_conf *conf;
72
73         conf = os_zalloc(sizeof(struct mesh_conf));
74         if (!conf)
75                 return NULL;
76
77         os_memcpy(conf->meshid, ssid->ssid, ssid->ssid_len);
78         conf->meshid_len = ssid->ssid_len;
79
80         if (ssid->key_mgmt & WPA_KEY_MGMT_SAE)
81                 conf->security |= MESH_CONF_SEC_AUTH |
82                         MESH_CONF_SEC_AMPE;
83         else
84                 conf->security |= MESH_CONF_SEC_NONE;
85
86         /* defaults */
87         conf->mesh_pp_id = MESH_PATH_PROTOCOL_HWMP;
88         conf->mesh_pm_id = MESH_PATH_METRIC_AIRTIME;
89         conf->mesh_cc_id = 0;
90         conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET;
91         conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0;
92         conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries;
93         conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout;
94         conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout;
95         conf->dot11MeshHoldingTimeout = ssid->dot11MeshHoldingTimeout;
96
97         return conf;
98 }
99
100
101 static void wpas_mesh_copy_groups(struct hostapd_data *bss,
102                                   struct wpa_supplicant *wpa_s)
103 {
104         int num_groups;
105         size_t groups_size;
106
107         for (num_groups = 0; wpa_s->conf->sae_groups[num_groups] > 0;
108              num_groups++)
109                 ;
110
111         groups_size = (num_groups + 1) * sizeof(wpa_s->conf->sae_groups[0]);
112         bss->conf->sae_groups = os_malloc(groups_size);
113         if (bss->conf->sae_groups)
114                 os_memcpy(bss->conf->sae_groups, wpa_s->conf->sae_groups,
115                           groups_size);
116 }
117
118
119 static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
120                                     struct wpa_ssid *ssid)
121 {
122         struct hostapd_iface *ifmsh;
123         struct hostapd_data *bss;
124         struct hostapd_config *conf;
125         struct mesh_conf *mconf;
126         int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
127         static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
128         size_t len;
129         int rate_len;
130
131         if (!wpa_s->conf->user_mpm) {
132                 /* not much for us to do here */
133                 wpa_msg(wpa_s, MSG_WARNING,
134                         "user_mpm is not enabled in configuration");
135                 return 0;
136         }
137
138         wpa_s->ifmsh = ifmsh = os_zalloc(sizeof(*wpa_s->ifmsh));
139         if (!ifmsh)
140                 return -ENOMEM;
141
142         ifmsh->drv_flags = wpa_s->drv_flags;
143         ifmsh->num_bss = 1;
144         ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
145                                sizeof(struct hostapd_data *));
146         if (!ifmsh->bss)
147                 goto out_free;
148
149         ifmsh->bss[0] = bss = os_zalloc(sizeof(struct hostapd_data));
150         if (!bss)
151                 goto out_free;
152
153         os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN);
154         bss->driver = wpa_s->driver;
155         bss->drv_priv = wpa_s->drv_priv;
156         bss->iface = ifmsh;
157         bss->mesh_sta_free_cb = mesh_mpm_free_sta;
158         wpa_s->assoc_freq = ssid->frequency;
159         wpa_s->current_ssid = ssid;
160
161         /* setup an AP config for auth processing */
162         conf = hostapd_config_defaults();
163         if (!conf)
164                 goto out_free;
165
166         bss->conf = *conf->bss;
167         bss->conf->start_disabled = 1;
168         bss->conf->mesh = MESH_ENABLED;
169         bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
170         bss->iconf = conf;
171         ifmsh->conf = conf;
172
173         ifmsh->bss[0]->max_plinks = wpa_s->conf->max_peer_links;
174         ifmsh->bss[0]->dot11RSNASAERetransPeriod =
175                 wpa_s->conf->dot11RSNASAERetransPeriod;
176         os_strlcpy(bss->conf->iface, wpa_s->ifname, sizeof(bss->conf->iface));
177
178         mconf = mesh_config_create(ssid);
179         if (!mconf)
180                 goto out_free;
181         ifmsh->mconf = mconf;
182
183         /* need conf->hw_mode for supported rates. */
184         conf->hw_mode = ieee80211_freq_to_chan(ssid->frequency, &conf->channel);
185         if (conf->hw_mode == NUM_HOSTAPD_MODES) {
186                 wpa_printf(MSG_ERROR, "Unsupported mesh mode frequency: %d MHz",
187                            ssid->frequency);
188                 goto out_free;
189         }
190         if (ssid->ht40)
191                 conf->secondary_channel = ssid->ht40;
192         if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) {
193                 conf->vht_oper_chwidth = ssid->max_oper_chwidth;
194                 switch (conf->vht_oper_chwidth) {
195                 case VHT_CHANWIDTH_80MHZ:
196                 case VHT_CHANWIDTH_80P80MHZ:
197                         ieee80211_freq_to_chan(
198                                 ssid->frequency,
199                                 &conf->vht_oper_centr_freq_seg0_idx);
200                         conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
201                         break;
202                 case VHT_CHANWIDTH_160MHZ:
203                         ieee80211_freq_to_chan(
204                                 ssid->frequency,
205                                 &conf->vht_oper_centr_freq_seg0_idx);
206                         conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
207                         conf->vht_oper_centr_freq_seg0_idx += 40 / 5;
208                         break;
209                 }
210                 ieee80211_freq_to_chan(ssid->vht_center_freq2,
211                                        &conf->vht_oper_centr_freq_seg1_idx);
212         }
213
214         if (ssid->mesh_basic_rates == NULL) {
215                 /*
216                  * XXX: Hack! This is so an MPM which correctly sets the ERP
217                  * mandatory rates as BSSBasicRateSet doesn't reject us. We
218                  * could add a new hw_mode HOSTAPD_MODE_IEEE80211G_ERP, but
219                  * this is way easier. This also makes our BSSBasicRateSet
220                  * advertised in beacons match the one in peering frames, sigh.
221                  */
222                 if (conf->hw_mode == HOSTAPD_MODE_IEEE80211G) {
223                         conf->basic_rates = os_malloc(sizeof(basic_rates_erp));
224                         if (!conf->basic_rates)
225                                 goto out_free;
226                         os_memcpy(conf->basic_rates, basic_rates_erp,
227                                   sizeof(basic_rates_erp));
228                 }
229         } else {
230                 rate_len = 0;
231                 while (1) {
232                         if (ssid->mesh_basic_rates[rate_len] < 1)
233                                 break;
234                         rate_len++;
235                 }
236                 conf->basic_rates = os_calloc(rate_len + 1, sizeof(int));
237                 if (conf->basic_rates == NULL)
238                         goto out_free;
239                 os_memcpy(conf->basic_rates, ssid->mesh_basic_rates,
240                           rate_len * sizeof(int));
241                 conf->basic_rates[rate_len] = -1;
242         }
243
244         if (hostapd_setup_interface(ifmsh)) {
245                 wpa_printf(MSG_ERROR,
246                            "Failed to initialize hostapd interface for mesh");
247                 return -1;
248         }
249
250         if (wpa_drv_init_mesh(wpa_s)) {
251                 wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
252                 return -1;
253         }
254
255         if (mconf->security != MESH_CONF_SEC_NONE) {
256                 if (ssid->passphrase == NULL) {
257                         wpa_printf(MSG_ERROR,
258                                    "mesh: Passphrase for SAE not configured");
259                         goto out_free;
260                 }
261
262                 bss->conf->wpa = ssid->proto;
263                 bss->conf->wpa_key_mgmt = ssid->key_mgmt;
264
265                 if (wpa_s->conf->sae_groups &&
266                     wpa_s->conf->sae_groups[0] > 0) {
267                         wpas_mesh_copy_groups(bss, wpa_s);
268                 } else {
269                         bss->conf->sae_groups =
270                                 os_malloc(sizeof(default_groups));
271                         if (!bss->conf->sae_groups)
272                                 goto out_free;
273                         os_memcpy(bss->conf->sae_groups, default_groups,
274                                   sizeof(default_groups));
275                 }
276
277                 len = os_strlen(ssid->passphrase);
278                 bss->conf->ssid.wpa_passphrase =
279                         dup_binstr(ssid->passphrase, len);
280
281                 wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
282                 if (!wpa_s->mesh_rsn)
283                         goto out_free;
284         }
285
286         wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
287
288         return 0;
289 out_free:
290         wpa_supplicant_mesh_deinit(wpa_s);
291         return -ENOMEM;
292 }
293
294
295 void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
296                           const u8 *ies, size_t ie_len)
297 {
298         struct ieee802_11_elems elems;
299
300         wpa_msg(wpa_s, MSG_INFO,
301                 "new peer notification for " MACSTR, MAC2STR(addr));
302
303         if (ieee802_11_parse_elems(ies, ie_len, &elems, 0) == ParseFailed) {
304                 wpa_msg(wpa_s, MSG_INFO, "Could not parse beacon from " MACSTR,
305                         MAC2STR(addr));
306                 return;
307         }
308         wpa_mesh_new_mesh_peer(wpa_s, addr, &elems);
309 }
310
311
312 void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s,
313                                      struct wpabuf **extra_ie)
314 {
315         /* EID + 0-length (wildcard) mesh-id */
316         size_t ielen = 2;
317
318         if (wpabuf_resize(extra_ie, ielen) == 0) {
319                 wpabuf_put_u8(*extra_ie, WLAN_EID_MESH_ID);
320                 wpabuf_put_u8(*extra_ie, 0);
321         }
322 }
323
324
325 int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
326                              struct wpa_ssid *ssid)
327 {
328         struct wpa_driver_mesh_join_params params;
329         int ret = 0;
330
331         if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency) {
332                 ret = -ENOENT;
333                 goto out;
334         }
335
336         wpa_supplicant_mesh_deinit(wpa_s);
337
338         if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
339                 wpa_s->pairwise_cipher = WPA_CIPHER_CCMP;
340                 wpa_s->group_cipher = WPA_CIPHER_CCMP;
341                 wpa_s->mgmt_group_cipher = 0;
342         } else {
343                 wpa_s->pairwise_cipher = WPA_CIPHER_NONE;
344                 wpa_s->group_cipher = WPA_CIPHER_NONE;
345                 wpa_s->mgmt_group_cipher = 0;
346         }
347
348         os_memset(&params, 0, sizeof(params));
349         params.meshid = ssid->ssid;
350         params.meshid_len = ssid->ssid_len;
351         ibss_mesh_setup_freq(wpa_s, ssid, &params.freq);
352         wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled;
353         wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled;
354         if (params.freq.ht_enabled && params.freq.sec_channel_offset)
355                 ssid->ht40 = params.freq.sec_channel_offset;
356         if (wpa_s->mesh_vht_enabled) {
357                 ssid->vht = 1;
358                 switch (params.freq.bandwidth) {
359                 case 80:
360                         if (params.freq.center_freq2) {
361                                 ssid->max_oper_chwidth = VHT_CHANWIDTH_80P80MHZ;
362                                 ssid->vht_center_freq2 =
363                                         params.freq.center_freq2;
364                         } else {
365                                 ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ;
366                         }
367                         break;
368                 case 160:
369                         ssid->max_oper_chwidth = VHT_CHANWIDTH_160MHZ;
370                         break;
371                 default:
372                         ssid->max_oper_chwidth = VHT_CHANWIDTH_USE_HT;
373                         break;
374                 }
375         }
376         if (ssid->beacon_int > 0)
377                 params.beacon_int = ssid->beacon_int;
378         else if (wpa_s->conf->beacon_int > 0)
379                 params.beacon_int = wpa_s->conf->beacon_int;
380         params.max_peer_links = wpa_s->conf->max_peer_links;
381
382         if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
383                 params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
384                 params.flags |= WPA_DRIVER_MESH_FLAG_AMPE;
385                 wpa_s->conf->user_mpm = 1;
386         }
387
388         if (wpa_s->conf->user_mpm) {
389                 params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
390                 params.conf.flags &= ~WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
391         } else {
392                 params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
393                 params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
394         }
395         params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
396
397         if (wpa_supplicant_mesh_init(wpa_s, ssid)) {
398                 wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
399                 wpa_drv_leave_mesh(wpa_s);
400                 ret = -1;
401                 goto out;
402         }
403
404         if (wpa_s->ifmsh) {
405                 params.ies = wpa_s->ifmsh->mconf->rsn_ie;
406                 params.ie_len = wpa_s->ifmsh->mconf->rsn_ie_len;
407                 params.basic_rates = wpa_s->ifmsh->basic_rates;
408         }
409
410         wpa_msg(wpa_s, MSG_INFO, "joining mesh %s",
411                 wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
412         ret = wpa_drv_join_mesh(wpa_s, &params);
413         if (ret)
414                 wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d", ret);
415
416         /* hostapd sets the interface down until we associate */
417         wpa_drv_set_operstate(wpa_s, 1);
418
419 out:
420         return ret;
421 }
422
423
424 int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s)
425 {
426         int ret = 0;
427
428         wpa_msg(wpa_s, MSG_INFO, "leaving mesh");
429
430         /* Need to send peering close messages first */
431         wpa_supplicant_mesh_deinit(wpa_s);
432
433         ret = wpa_drv_leave_mesh(wpa_s);
434         if (ret)
435                 wpa_msg(wpa_s, MSG_ERROR, "mesh leave error=%d", ret);
436
437         wpa_drv_set_operstate(wpa_s, 1);
438
439         return ret;
440 }
441
442
443 static int mesh_attr_text(const u8 *ies, size_t ies_len, char *buf, char *end)
444 {
445         struct ieee802_11_elems elems;
446         char *mesh_id, *pos = buf;
447         u8 *bss_basic_rate_set;
448         int bss_basic_rate_set_len, ret, i;
449
450         if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed)
451                 return -1;
452
453         if (elems.mesh_id_len < 1)
454                 return 0;
455
456         mesh_id = os_malloc(elems.mesh_id_len + 1);
457         if (mesh_id == NULL)
458                 return -1;
459
460         os_memcpy(mesh_id, elems.mesh_id, elems.mesh_id_len);
461         mesh_id[elems.mesh_id_len] = '\0';
462         ret = os_snprintf(pos, end - pos, "mesh_id=%s\n", mesh_id);
463         os_free(mesh_id);
464         if (os_snprintf_error(end - pos, ret))
465                 return pos - buf;
466         pos += ret;
467
468         if (elems.mesh_config_len > 6) {
469                 ret = os_snprintf(pos, end - pos,
470                                   "active_path_selection_protocol_id=0x%02x\n"
471                                   "active_path_selection_metric_id=0x%02x\n"
472                                   "congestion_control_mode_id=0x%02x\n"
473                                   "synchronization_method_id=0x%02x\n"
474                                   "authentication_protocol_id=0x%02x\n"
475                                   "mesh_formation_info=0x%02x\n"
476                                   "mesh_capability=0x%02x\n",
477                                   elems.mesh_config[0], elems.mesh_config[1],
478                                   elems.mesh_config[2], elems.mesh_config[3],
479                                   elems.mesh_config[4], elems.mesh_config[5],
480                                   elems.mesh_config[6]);
481                 if (os_snprintf_error(end - pos, ret))
482                         return pos - buf;
483                 pos += ret;
484         }
485
486         bss_basic_rate_set = os_malloc(elems.supp_rates_len +
487                 elems.ext_supp_rates_len);
488         if (bss_basic_rate_set == NULL)
489                 return -1;
490
491         bss_basic_rate_set_len = 0;
492         for (i = 0; i < elems.supp_rates_len; i++) {
493                 if (elems.supp_rates[i] & 0x80) {
494                         bss_basic_rate_set[bss_basic_rate_set_len++] =
495                                 (elems.supp_rates[i] & 0x7f) * 5;
496                 }
497         }
498         for (i = 0; i < elems.ext_supp_rates_len; i++) {
499                 if (elems.ext_supp_rates[i] & 0x80) {
500                         bss_basic_rate_set[bss_basic_rate_set_len++] =
501                                 (elems.ext_supp_rates[i] & 0x7f) * 5;
502                 }
503         }
504         if (bss_basic_rate_set_len > 0) {
505                 ret = os_snprintf(pos, end - pos, "bss_basic_rate_set=%d",
506                                   bss_basic_rate_set[0]);
507                 if (os_snprintf_error(end - pos, ret))
508                         goto fail;
509                 pos += ret;
510
511                 for (i = 1; i < bss_basic_rate_set_len; i++) {
512                         ret = os_snprintf(pos, end - pos, " %d",
513                                           bss_basic_rate_set[i]);
514                         if (os_snprintf_error(end - pos, ret))
515                                 goto fail;
516                         pos += ret;
517                 }
518
519                 ret = os_snprintf(pos, end - pos, "\n");
520                 if (os_snprintf_error(end - pos, ret))
521                         goto fail;
522                 pos += ret;
523         }
524 fail:
525         os_free(bss_basic_rate_set);
526
527         return pos - buf;
528 }
529
530
531 int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
532                                char *end)
533 {
534         return mesh_attr_text(ies, ies_len, buf, end);
535 }
536
537
538 static int wpas_mesh_get_ifname(struct wpa_supplicant *wpa_s, char *ifname,
539                                 size_t len)
540 {
541         char *ifname_ptr = wpa_s->ifname;
542         int res;
543
544         res = os_snprintf(ifname, len, "mesh-%s-%d", ifname_ptr,
545                           wpa_s->mesh_if_idx);
546         if (os_snprintf_error(len, res) ||
547             (os_strlen(ifname) >= IFNAMSIZ &&
548              os_strlen(wpa_s->ifname) < IFNAMSIZ)) {
549                 /* Try to avoid going over the IFNAMSIZ length limit */
550                 res = os_snprintf(ifname, len, "mesh-%d", wpa_s->mesh_if_idx);
551                 if (os_snprintf_error(len, res))
552                         return -1;
553         }
554         wpa_s->mesh_if_idx++;
555         return 0;
556 }
557
558
559 int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
560                             size_t len)
561 {
562         struct wpa_interface iface;
563         struct wpa_supplicant *mesh_wpa_s;
564         u8 addr[ETH_ALEN];
565
566         if (ifname[0] == '\0' && wpas_mesh_get_ifname(wpa_s, ifname, len) < 0)
567                 return -1;
568
569         if (wpa_drv_if_add(wpa_s, WPA_IF_MESH, ifname, NULL, NULL, NULL, addr,
570                            NULL) < 0) {
571                 wpa_printf(MSG_ERROR,
572                            "mesh: Failed to create new mesh interface");
573                 return -1;
574         }
575         wpa_printf(MSG_INFO, "mesh: Created virtual interface %s addr "
576                    MACSTR, ifname, MAC2STR(addr));
577
578         os_memset(&iface, 0, sizeof(iface));
579         iface.ifname = ifname;
580         iface.driver = wpa_s->driver->name;
581         iface.driver_param = wpa_s->conf->driver_param;
582         iface.ctrl_interface = wpa_s->conf->ctrl_interface;
583
584         mesh_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface, wpa_s);
585         if (!mesh_wpa_s) {
586                 wpa_printf(MSG_ERROR,
587                            "mesh: Failed to create new wpa_supplicant interface");
588                 wpa_drv_if_remove(wpa_s, WPA_IF_MESH, ifname);
589                 return -1;
590         }
591         mesh_wpa_s->mesh_if_created = 1;
592         return 0;
593 }
594
595
596 int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr)
597 {
598         return mesh_mpm_close_peer(wpa_s, addr);
599 }
600
601
602 int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
603                        int duration)
604 {
605         return mesh_mpm_connect_peer(wpa_s, addr, duration);
606 }