wireless: bcmdhd: enable DHCP and 4Way handshake prints
Bhadram Varka [Fri, 4 Mar 2016 05:36:04 +0000 (10:36 +0530)]
Bug 1738117

Change-Id: Ia2bd912a06383ad01afc97f787664e3372dd2394
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: http://git-master/r/1023898
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

drivers/net/wireless/bcmdhd/Makefile
drivers/net/wireless/bcmdhd/dhd_common.c
drivers/net/wireless/bcmdhd/dhd_linux.c

index c8aa062..bf8ae48 100755 (executable)
@@ -25,6 +25,11 @@ DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
 
 DHDCFLAGS += -DVSDB
 
+# Print 802.1X packets
+DHDCFLAGS += -DDHD_8021X_DUMP
+# Print DHCP packets
+DHDCFLAGS += -DDHD_DHCP_DUMP
+
 # For p2p connection issue
 DHDCFLAGS += -DWL_SCB_TIMEOUT=10
 
index 4ef4b78..f738a7f 100644 (file)
@@ -2940,3 +2940,41 @@ wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num)
        *list_str = str;
        return num;
 }
+
+/* Parse EAPOL 4 way handshake messages */
+void dhd_dump_eapol_4way_message(char *dump_data, bool direction)
+{
+       int pair, ack, mic, kerr, req, sec, install;
+       unsigned short us_tmp;
+       unsigned char type;
+
+       /* Extract EAPOL Key type from 802.1x authentication header
+        * EAPOL WPA2 key type - 2, EAPOL WPA key type - 254
+        */
+       type = dump_data[18];
+       if (type == 2 || type == 254) {
+               us_tmp = (dump_data[19] << 8) | dump_data[20];
+               pair = 0 != (us_tmp & 0x08);
+               ack = 0 != (us_tmp & 0x80);
+               mic = 0 != (us_tmp & 0x100);
+               kerr = 0 != (us_tmp & 0x400);
+               req = 0 != (us_tmp & 0x800);
+               sec = 0 != (us_tmp & 0x200);
+               install = 0 != (us_tmp & 0x40);
+
+               if (!sec && !mic && ack && !install && pair && !kerr && !req)
+                       DHD_NV_INFO(("ETHER_TYPE_802_1X [%s] : M1 of 4way\n",
+                                   direction ? "TX" : "RX"));
+               else if (pair && !install && !ack && mic &&
+                               !sec && !kerr && !req)
+                       DHD_NV_INFO(("ETHER_TYPE_802_1X [%s] : M2 of 4way\n",
+                                   direction ? "TX" : "RX"));
+               else if (pair && ack && mic && sec && !kerr && !req)
+                       DHD_NV_INFO(("ETHER_TYPE_802_1X [%s] : M3 of 4way\n",
+                                   direction ? "TX" : "RX"));
+               else if (pair && !install && !ack && mic &&
+                               sec && !req && !kerr)
+                       DHD_NV_INFO(("ETHER_TYPE_802_1X [%s] : M4 of 4way\n",
+                                   direction ? "TX" : "RX"));
+       }
+}
index b3cc337..5416979 100644 (file)
@@ -171,6 +171,7 @@ extern bool ap_cfg_running;
 extern bool ap_fw_loaded;
 #endif
 
+extern void dhd_dump_eapol_4way_message(char *dump_data, bool direction);
 
 #ifdef ENABLE_ADAPTIVE_SCHED
 #define DEFAULT_CPUFREQ_THRESH         1000000 /* threshold frequency : 1000000 = 1GHz */
@@ -2465,10 +2466,9 @@ dhd_tx_dump(osl_t *osh, void *pkt)
        dump_data = PKTDATA(osh, pkt);
        protocol = (dump_data[12] << 8) | dump_data[13];
 
-       if (protocol == ETHER_TYPE_802_1X) {
-               DHD_ERROR(("ETHER_TYPE_802_1X [TX]: ver %d, type %d, replay %d\n",
-                       dump_data[14], dump_data[15], dump_data[30]));
-       }
+       if (protocol == ETHER_TYPE_802_1X)
+               /* flag true indicates Tx path */
+               dhd_dump_eapol_4way_message(dump_data, true);
 }
 #endif /* DHD_8021X_DUMP */
 
@@ -3085,12 +3085,9 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
                protocol = (dump_data[12] << 8) | dump_data[13];
 #endif /* DHD_RX_DUMP || DHD_8021X_DUMP || DHD_DHCP_DUMP */
 #ifdef DHD_8021X_DUMP
-               if (protocol == ETHER_TYPE_802_1X) {
-                       DHD_ERROR(("ETHER_TYPE_802_1X [RX]: "
-                               "ver %d, type %d, replay %d\n",
-                               dump_data[14], dump_data[15],
-                               dump_data[30]));
-               }
+               if (protocol == ETHER_TYPE_802_1X)
+                       /* flag false indicates Rx path */
+                       dhd_dump_eapol_4way_message(dump_data, false);
 #endif /* DHD_8021X_DUMP */
 #ifdef DHD_DHCP_DUMP
                if (protocol != ETHER_TYPE_BRCM && protocol == ETHER_TYPE_IP) {