From: Priyansha Tiwari Rename NL80211_CMD_PROBE_CLIENT to NL80211_CMD_PROBE_PEER to generalize peer probing, AP/GO continue to probe associated STAs (legacy PROBE_CLIENT behavior) while, when the driver advertises NL80211_EXT_FEATURE_PROBE_AP, a STA/P2P-client may probe its currently associated AP to quickly verify link responsiveness without waiting for traffic or long timeouts. Userspace and cfg80211 rely on this feature flag to determine whether STA-mode probing is supported. The command returns a cookie in the direct reply and delivers an event that indicates ACK (and, if available, signed-dBm ACK_SIGNAL). For MLO connections the event carries MLO_LINK_ID identifying the link on which the probe was ACKed. In AP/GO mode the peer MAC is required, while in STA/P2P-client mode the MAC is omitted (AP implied). NL80211_CMD_PROBE_CLIENT is retained as a compatibility alias. Signed-off-by: Priyansha Tiwari --- include/uapi/linux/nl80211.h | 27 +++++++++++++++++++++------ net/wireless/nl80211.c | 6 +++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 3d55bf4be36f..5c1b00bf8161 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -920,13 +920,23 @@ * and wasn't already in a 4-addr VLAN. The event will be sent similarly * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener. * - * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface + * @NL80211_CMD_PROBE_PEER: Probe an associated station on an AP interface * by sending a null data frame to it and reporting when the frame is * acknowledged. This is used to allow timing out inactive clients. Uses - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a - * direct reply with an %NL80211_ATTR_COOKIE that is later used to match - * up the event with the request. The event includes the same data and - * has %NL80211_ATTR_ACK set if the frame was ACKed. + * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC (required in AP/GO mode). + * This command can also be used on a STA/P2P-client interface to probe + * the currently associated AP/GO, when the driver indicates + * %NL80211_EXT_FEATURE_PROBE_AP; in that case %NL80211_ATTR_MAC must + * be omitted (the peer is implied by the association). + * + * The command returns a direct reply with an %NL80211_ATTR_COOKIE + * that is later used to match up the event with the request. The + * event includes the same data and has %NL80211_ATTR_ACK set if the + * frame was ACKed. + * + * In case of an MLO connection, the event includes + * %NL80211_ATTR_MLO_LINK_ID to indicate the link on which the null data + * frame was transmitted and ACKed. * * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from * other BSSes when any interfaces are in AP mode. This helps implement @@ -1548,7 +1558,7 @@ enum nl80211_commands { NL80211_CMD_UNEXPECTED_FRAME, - NL80211_CMD_PROBE_CLIENT, + NL80211_CMD_PROBE_PEER, NL80211_CMD_REGISTER_BEACONS, @@ -1716,6 +1726,7 @@ enum nl80211_commands { #define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG #define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG #define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE +#define NL80211_CMD_PROBE_CLIENT NL80211_CMD_PROBE_PEER /** * enum nl80211_attrs - nl80211 netlink attributes @@ -7029,6 +7040,9 @@ enum nl80211_feature_flags { * (NL80211_CMD_AUTHENTICATE) in non-AP STA mode, as specified in * "IEEE P802.11bi/D4.0, 12.16.5". * + * @NL80211_EXT_FEATURE_PROBE_AP: Driver supports probing the associated AP + * in STA mode using @NL80211_CMD_PROBE_PEER. + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ @@ -7108,6 +7122,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_EPPKE, NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION, NL80211_EXT_FEATURE_IEEE8021X_AUTH, + NL80211_EXT_FEATURE_PROBE_AP, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f334cdef8958..e7be43f023b6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -15817,7 +15817,7 @@ static int nl80211_probe_client(struct sk_buff *skb, return -ENOMEM; hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_PROBE_CLIENT); + NL80211_CMD_PROBE_PEER); if (!hdr) { err = -ENOBUFS; goto free_msg; @@ -19627,7 +19627,7 @@ static const struct genl_small_ops nl80211_small_ops[] = { .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV), }, { - .cmd = NL80211_CMD_PROBE_CLIENT, + .cmd = NL80211_CMD_PROBE_PEER, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = nl80211_probe_client, .flags = GENL_UNS_ADMIN_PERM, @@ -22181,7 +22181,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, if (!msg) return; - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_PROBE_CLIENT); + hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_PROBE_PEER); if (!hdr) { nlmsg_free(msg); return; -- 2.34.1