Add support for injecting packets to a given mesh peer, bypassing the mpath table lookup using PROBE_MESH_LINK command. This helps to send data frames over unexcersized 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@xxxxxxxxxxxxxx> --- src/drivers/driver.h | 11 +++++++++++ src/drivers/driver_nl80211.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 0acc0958aefb..dec401677eb5 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -3982,6 +3982,17 @@ struct wpa_driver_ops { int (*leave_mesh)(void *priv); /** + * probe_mesh_link - inject an ethernet packet over direct mesh link to 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: ethrnet frame len + * 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 * @params: Parameters for ACS diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ef37c8bcdfec..b83ae8af1981 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -22,6 +22,7 @@ #include <linux/rtnetlink.h> #include <netpacket/packet.h> #include <linux/errqueue.h> +#include <net/ethernet.h> #include "common.h" #include "eloop.h" @@ -9626,8 +9627,38 @@ static int wpa_driver_nl80211_leave_mesh(void *priv) return ret; } -#endif /* CONFIG_MESH */ +static int wpa_driver_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 = nl80211_drv_msg(drv, 0, NL80211_CMD_PROBE_MESH_LINK)) || + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || + nla_put(msg, NL80211_ATTR_FRAME, len, eth)) + goto fail; + + ret = send_and_recv_msgs(drv, msg, NULL, NULL); + if (ret) { + wpa_printf(MSG_DEBUG, "nl80211: mesh link probe failed: ret=%d (%s)", + ret, strerror(-ret)); + } else { + wpa_printf(MSG_DEBUG, "nl80211: mesh link probed successfully"); + } + + return ret; + +fail: + nlmsg_free(msg); + return -ENOBUFS; +} + +#endif /* CONFIG_MESH */ static int wpa_driver_br_add_ip_neigh(void *priv, u8 version, const u8 *ipaddr, int prefixlen, @@ -10971,6 +11002,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 = wpa_driver_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, -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap