@@ -2373,7 +2373,7 @@ static int wpa_supplicant_ctrl_iface_mesh_interface_add(
os_strlcpy(ifname, pos, sizeof(ifname));
}
- if (wpas_mesh_add_interface(wpa_s, ifname, sizeof(ifname)) < 0)
+ if (wpas_mesh_add_interface(wpa_s, ifname, sizeof(ifname), NULL) < 0)
return -1;
os_strlcpy(reply, ifname, max_len);
@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
+ "b:Bc:C:D:de:f:g:G:hi:I:KLmn:No:O:p:P:qsTtuvW");
if (c < 0)
break;
switch (c) {
@@ -240,6 +240,11 @@ int main(int argc, char *argv[])
iface->conf_p2p_dev = optarg;
break;
#endif /* CONFIG_P2P */
+#ifdef CONFIG_MESH
+ case 'n':
+ iface->conf_mesh = optarg;
+ break;
+#endif /* CONFIG_MESH */
case 'o':
params.override_driver = optarg;
break;
@@ -497,7 +497,7 @@ static void wpas_mesh_get_ifname(struct wpa_supplicant *wpa_s, char *ifname,
int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
- size_t len)
+ size_t len, const char *confname)
{
struct wpa_interface iface;
struct wpa_supplicant *mesh_wpa_s;
@@ -509,7 +509,7 @@ int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
if (wpa_drv_if_add(wpa_s, WPA_IF_MESH, ifname, NULL, NULL, NULL, addr,
NULL) < 0) {
wpa_printf(MSG_ERROR, "mesh: Failed to create new mesh "
- "interface");
+ "interface %s", ifname);
return -1;
}
wpa_printf(MSG_INFO, "mesh: Created virtual interface %s addr "
@@ -519,7 +519,9 @@ int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
iface.ifname = ifname;
iface.driver = wpa_s->driver->name;
iface.driver_param = wpa_s->conf->driver_param;
- iface.ctrl_interface = wpa_s->conf->ctrl_interface;
+ iface.confname = confname;
+ iface.ctrl_interface =
+ confname == NULL ? wpa_s->conf->ctrl_interface : NULL;
mesh_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface);
if (!mesh_wpa_s) {
@@ -17,7 +17,7 @@ void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s,
int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
char *end);
int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
- size_t len);
+ size_t len, const char *confname);
#ifdef CONFIG_MESH
@@ -4045,6 +4045,9 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
struct wpa_supplicant *wpa_s;
struct wpa_interface t_iface;
struct wpa_ssid *ssid;
+#ifdef CONFIG_MESH
+ char ifname[IFNAMSIZ + 1];
+#endif /* CONFIG_MESH */
if (global == NULL || iface == NULL)
return NULL;
@@ -4101,6 +4104,14 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
/* Try to continue without. P2P will be disabled. */
}
#endif /* CONFIG_P2P */
+#ifdef CONFIG_MESH
+ if (iface->conf_mesh != NULL &&
+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_MESH)) {
+ ifname[0] = '\0';
+ wpas_mesh_add_interface(wpa_s, ifname, sizeof(ifname),
+ iface->conf_mesh);
+ }
+#endif /* CONFIG_MESH */
return wpa_s;
}
@@ -76,6 +76,17 @@ struct wpa_interface {
const char *conf_p2p_dev;
#endif /* CONFIG_P2P */
+#ifdef CONFIG_MESH
+ /**
+ * conf_mesh - Additional configuration file used to hold the mesh
+ * network configuration parameters.
+ *
+ * This can also be %NULL. In such a case, virtual interface for mesh
+ * will not be created.
+ */
+ const char *conf_mesh;
+#endif /* CONFIG_MESH */
+
/**
* ctrl_interface - Control interface parameter
*
This functionality is used to create mesh gate. Signed-off-by: Masashi Honma <masashi.honma@gmail.com> --- wpa_supplicant/ctrl_iface.c | 2 +- wpa_supplicant/main.c | 7 ++++++- wpa_supplicant/mesh.c | 8 +++++--- wpa_supplicant/mesh.h | 2 +- wpa_supplicant/wpa_supplicant.c | 11 +++++++++++ wpa_supplicant/wpa_supplicant_i.h | 11 +++++++++++ 6 files changed, 35 insertions(+), 6 deletions(-)