nl80211: Add support to probe specific mesh link by injecting frames

Add support for injecting frames to a given mesh peer, bypassing the
mpath table lookup using PROBE_MESH_LINK command. This helps to send
data frames over unexercised direct mesh path, which is not selected as
next_hop node. This can be helpful in measuring link metrics.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
This commit is contained in:
Pradeep Kumar Chitrapu 2019-04-29 11:42:57 -07:00 committed by Jouni Malinen
parent 4087957814
commit c36109e4d9
2 changed files with 43 additions and 0 deletions

View file

@ -3991,6 +3991,18 @@ struct wpa_driver_ops {
*/
int (*leave_mesh)(void *priv);
/**
* probe_mesh_link - Inject a frame over direct mesh link to a given
* peer skipping the next_hop lookup from mpath table.
* @priv: Private driver interface data
* @addr: Peer MAC address
* @eth: Ethernet frame to be sent
* @len: Ethernet frame lengtn in bytes
* Returns 0 on success, -1 on failure
*/
int (*probe_mesh_link)(void *priv, const u8 *addr, const u8 *eth,
size_t len);
/**
* do_acs - Automatically select channel
* @priv: Private driver interface data

View file

@ -9698,6 +9698,36 @@ static int wpa_driver_nl80211_leave_mesh(void *priv)
return ret;
}
static int nl80211_probe_mesh_link(void *priv, const u8 *addr, const u8 *eth,
size_t len)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
int ret;
msg = nl80211_drv_msg(drv, 0, NL80211_CMD_PROBE_MESH_LINK);
if (!msg ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
nla_put(msg, NL80211_ATTR_FRAME, len, eth)) {
nlmsg_free(msg);
return -ENOBUFS;
}
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: mesh link probe to " MACSTR
" failed: ret=%d (%s)",
MAC2STR(addr), ret, strerror(-ret));
} else {
wpa_printf(MSG_DEBUG, "nl80211: Mesh link to " MACSTR
" probed successfully", MAC2STR(addr));
}
return ret;
}
#endif /* CONFIG_MESH */
@ -11044,6 +11074,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.init_mesh = wpa_driver_nl80211_init_mesh,
.join_mesh = wpa_driver_nl80211_join_mesh,
.leave_mesh = wpa_driver_nl80211_leave_mesh,
.probe_mesh_link = nl80211_probe_mesh_link,
#endif /* CONFIG_MESH */
.br_add_ip_neigh = wpa_driver_br_add_ip_neigh,
.br_delete_ip_neigh = wpa_driver_br_delete_ip_neigh,