[PATCH] NAN: Fix A3 for P2P2 USD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to WFD spec, address 3 in multicast USD frames shall be set to
wildcard bssid. For unicast USD frames, address 3 shall be set to P2P
device address of the sender. Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
 src/common/nan_de.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index c38fd9ba60..0e6b4d5fdd 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -27,6 +27,9 @@ enum nan_de_service_type {
 static const u8 p2p_network_id[ETH_ALEN] =
 { 0x51, 0x6f, 0x9a, 0x02, 0x00, 0x00 };
 
+static const u8 wildcard_bssid[ETH_ALEN] =
+{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
 struct nan_de_service {
 	int id;
 	enum nan_de_service_type type;
@@ -353,6 +356,7 @@ static void nan_de_tx_multicast(struct nan_de *de, struct nan_de_service *srv,
 	enum nan_service_control_type type;
 	unsigned int wait_time = 100;
 	const u8 *network_id;
+	const u8 *bssid;
 
 	if (srv->type == NAN_DE_PUBLISH) {
 		int ms;
@@ -370,12 +374,15 @@ static void nan_de_tx_multicast(struct nan_de *de, struct nan_de_service *srv,
 		return;
 	}
 
-	if (srv->is_p2p)
+	if (srv->is_p2p) {
 		network_id = p2p_network_id;
-	else
+		bssid = wildcard_bssid;
+	} else {
 		network_id = nan_network_id;
+		bssid = nan_network_id;
+	}
 
-	nan_de_tx_sdf(de, srv, wait_time, type, network_id, network_id,
+	nan_de_tx_sdf(de, srv, wait_time, type, network_id, bssid,
 		      req_instance_id, srv->ssi);
 	os_get_reltime(&srv->last_multicast);
 }
@@ -1020,6 +1027,8 @@ static void nan_de_rx_subscribe(struct nan_de *de, struct nan_de_service *srv,
 
 	if (srv->publish.solicited_multicast || !a3)
 		a3 = network_id;
+	else if (srv->is_p2p)
+		a3 = de->nmi;
 
 	nan_de_tx(de, srv->freq, 100,
 		  srv->publish.solicited_multicast ? network_id : peer_addr,
-- 
2.43.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux