wlan: Add support for SoftAP Random BSSID

 There is a new requirement that when the driver is in SoftAP mode that
 it create and use a randomized BSSID of the form "02:1A:11:Fx:xx:xx".
 Add logic to implement this feature, enabled via a new cfg.ini
 configuration item.

 CR-FIxed: 408851

Change-Id: Idf89638c052ce029ade9e48a71c980f8beccdb96
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9f544b8..6b5f51b 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2102,6 +2102,28 @@
                     }
                 }
 
+                if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) &&
+                    (pConfig->apRandomBssidEnabled))
+                {
+                    /* To meet Android requirements create a randomized
+                       MAC address of the form 02:1A:11:Fx:xx:xx */
+                    get_random_bytes(&ndev->dev_addr[3], 3);
+                    ndev->dev_addr[0] = 0x02;
+                    ndev->dev_addr[1] = 0x1A;
+                    ndev->dev_addr[2] = 0x11;
+                    ndev->dev_addr[3] |= 0xF0;
+                    memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr,
+                           VOS_MAC_ADDR_SIZE);
+                    pr_info("wlan: Generated HotSpot BSSID "
+                            "%02x:%02x:%02x:%02x:%02x:%02x\n",
+                            ndev->dev_addr[0],
+                            ndev->dev_addr[1],
+                            ndev->dev_addr[2],
+                            ndev->dev_addr[3],
+                            ndev->dev_addr[4],
+                            ndev->dev_addr[5]);
+                }
+
                 hdd_set_ap_ops( pAdapter->dev );
 
                 status = hdd_init_ap_mode(pAdapter);