mesh: Add mesh interface creation command for mesh gate
The mesh gate is used to bridge (or route) between mesh network and another network. For example, mesh gate acts as router between mesh network and IEEE 802.11 BSS network. This command makes a virtual mesh interface to be used for mesh gate. This command expects to be used like this. wpa_cli -i wlan0 MESH_INTERFACE_ADD ifname=mesh0 wpa_cli -i mesh0 add_network wpa_cli -i mesh0 set_network 0 ssid '"commell_2X_mmm"' wpa_cli -i mesh0 set_network 0 mode 5 wpa_cli -i mesh0 set_network 0 frequency 2412 wpa_cli -i mesh0 set_network 0 key_mgmt SAE wpa_cli -i mesh0 set_network 0 psk '"01234567"' wpa_cli -i mesh0 mesh_group_add 0 wpa_cli -i wlan0 mesh_group_remove mesh0 Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
bd0b620371
commit
5b78493f3b
8 changed files with 166 additions and 19 deletions
|
@ -1244,7 +1244,12 @@ enum wpa_driver_if_type {
|
|||
* WPA_IF_P2P_DEVICE - P2P Device interface is used to indentify the
|
||||
* abstracted P2P Device function in the driver
|
||||
*/
|
||||
WPA_IF_P2P_DEVICE
|
||||
WPA_IF_P2P_DEVICE,
|
||||
|
||||
/*
|
||||
* WPA_IF_MESH - Mesh interface
|
||||
*/
|
||||
WPA_IF_MESH,
|
||||
};
|
||||
|
||||
struct wpa_init_params {
|
||||
|
|
|
@ -5594,12 +5594,14 @@ static enum nl80211_iftype wpa_driver_nl80211_if_type(
|
|||
return NL80211_IFTYPE_P2P_GO;
|
||||
case WPA_IF_P2P_DEVICE:
|
||||
return NL80211_IFTYPE_P2P_DEVICE;
|
||||
case WPA_IF_MESH:
|
||||
return NL80211_IFTYPE_MESH_POINT;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
#if defined(CONFIG_P2P) || defined(CONFIG_MESH)
|
||||
|
||||
static int nl80211_addr_in_use(struct nl80211_global *global, const u8 *addr)
|
||||
{
|
||||
|
@ -5613,8 +5615,7 @@ static int nl80211_addr_in_use(struct nl80211_global *global, const u8 *addr)
|
|||
}
|
||||
|
||||
|
||||
static int nl80211_p2p_interface_addr(struct wpa_driver_nl80211_data *drv,
|
||||
u8 *new_addr)
|
||||
static int nl80211_vif_addr(struct wpa_driver_nl80211_data *drv, u8 *new_addr)
|
||||
{
|
||||
unsigned int idx;
|
||||
|
||||
|
@ -5631,13 +5632,13 @@ static int nl80211_p2p_interface_addr(struct wpa_driver_nl80211_data *drv,
|
|||
if (idx == 64)
|
||||
return -1;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Assigned new P2P Interface Address "
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Assigned new virtual interface address "
|
||||
MACSTR, MAC2STR(new_addr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_P2P */
|
||||
#endif /* CONFIG_P2P || CONFIG_MESH */
|
||||
|
||||
|
||||
struct wdev_info {
|
||||
|
@ -5724,10 +5725,10 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
#if defined(CONFIG_P2P) || defined(CONFIG_MESH)
|
||||
if (!addr &&
|
||||
(type == WPA_IF_P2P_CLIENT || type == WPA_IF_P2P_GROUP ||
|
||||
type == WPA_IF_P2P_GO)) {
|
||||
type == WPA_IF_P2P_GO || type == WPA_IF_MESH)) {
|
||||
/* Enforce unique P2P Interface Address */
|
||||
u8 new_addr[ETH_ALEN];
|
||||
|
||||
|
@ -5739,8 +5740,9 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
|
|||
}
|
||||
if (nl80211_addr_in_use(drv->global, new_addr)) {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Allocate new address "
|
||||
"for P2P group interface");
|
||||
if (nl80211_p2p_interface_addr(drv, new_addr) < 0) {
|
||||
"for %s interface", type == WPA_IF_MESH ?
|
||||
"mesh" : "P2P group");
|
||||
if (nl80211_vif_addr(drv, new_addr) < 0) {
|
||||
if (added)
|
||||
nl80211_remove_iface(drv, ifidx);
|
||||
return -1;
|
||||
|
@ -5754,7 +5756,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
|
|||
}
|
||||
os_memcpy(if_addr, new_addr, ETH_ALEN);
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
#endif /* CONFIG_P2P || CONFIG_MESH */
|
||||
|
||||
if (type == WPA_IF_AP_BSS) {
|
||||
struct i802_bss *new_bss = os_zalloc(sizeof(*new_bss));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue