[RFC 01/13] NAN: Don't add empty SDEA in SDF frames

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Dec 23 03:57:13 PST 2025


SDEA was unconditionally added for publish services.
Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/common/nan_de.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index 562cf73f71..8ffcf1ef9b 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -332,21 +332,24 @@ static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
 
 	/* Service Descriptor Extension attribute */
 	if (srv->type == NAN_DE_PUBLISH || ssi) {
-		wpabuf_put_u8(buf, NAN_ATTR_SDEA);
-		wpabuf_put_le16(buf, sdea_len);
-		wpabuf_put_u8(buf, srv->id); /* Instance ID */
 		if (srv->type == NAN_DE_PUBLISH) {
 			if (srv->publish.fsd)
 				sdea_ctrl |= NAN_SDEA_CTRL_FSD_REQ;
 			if (srv->publish.fsd_gas)
 				sdea_ctrl |= NAN_SDEA_CTRL_FSD_GAS;
 		}
-		wpabuf_put_le16(buf, sdea_ctrl);
-		if (ssi) {
-			wpabuf_put_le16(buf, 4 + wpabuf_len(ssi));
-			wpabuf_put_be24(buf, OUI_WFA);
-			wpabuf_put_u8(buf, srv->srv_proto_type);
-			wpabuf_put_buf(buf, ssi);
+
+		if (sdea_ctrl || ssi) {
+			wpabuf_put_u8(buf, NAN_ATTR_SDEA);
+			wpabuf_put_le16(buf, sdea_len);
+			wpabuf_put_u8(buf, srv->id); /* Instance ID */
+			wpabuf_put_le16(buf, sdea_ctrl);
+			if (ssi) {
+				wpabuf_put_le16(buf, 4 + wpabuf_len(ssi));
+				wpabuf_put_be24(buf, OUI_WFA);
+				wpabuf_put_u8(buf, srv->srv_proto_type);
+				wpabuf_put_buf(buf, ssi);
+			}
 		}
 	}
 
-- 
2.49.0




More information about the Hostap mailing list