Merge "P2P: Use P2P Device ID attribute if Device Info not available"
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index d5884f2..a4c6a8f 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2094,6 +2094,7 @@
 {
 	struct wpabuf *p2p_ie;
 	struct p2p_message msg;
+	int ret = -1;
 
 	p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
 					     P2P_IE_VENDOR_TYPE);
@@ -2105,14 +2106,16 @@
 		return -1;
 	}
 
-	if (msg.p2p_device_addr == NULL) {
-		wpabuf_free(p2p_ie);
-		return -1;
+	if (msg.p2p_device_addr) {
+		os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
+		ret = 0;
+	} else if (msg.device_id) {
+		os_memcpy(dev_addr, msg.device_id, ETH_ALEN);
+		ret = 0;
 	}
 
-	os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
 	wpabuf_free(p2p_ie);
-	return 0;
+	return ret;
 }