summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimanshu Agarwal <himanaga@qti.qualcomm.com>2016-08-01 18:04:26 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-08-02 14:49:54 +0530
commit874883d5b5fcd0ce0a8ce926cdbbd8618b2802b0 (patch)
tree6a2eb45c469cc3a83e995a1f06efcaf5f3910cf5
parent4daf2a79cf7d603a2e9dfeb25f75ac9f1a32e1c5 (diff)
qcacld-2.0: Add ipv4 and ipv6 packet checks
Presently in updating wma_wow_wake_up_stats, icmpv4 and icmpv6 counts are increased just by checking ICMP protocol offset byte and ICMPV6 protocol offset byte without checking for whether it is a IPV4 or IPV6 packet. So it is possible that for ICMPV6 packet, the IPV4 protol offset byte is equal to ICMP protocol or for some ICMP packet, the IPV6 protocol byte is equal to ICMPV6 protocol and thus both the icmpv4 and icmpv6 counts will get increased for that packet. Add ipv4 and ipv6 packet checks as well in addition to the present checks to avoid wrong increment in the counts. Change-Id: I2d6e5d095d2f4b2dd474b9338bfc830b04bfa533 CRs-fixed: 1048651
-rw-r--r--CORE/SERVICES/WMA/wma.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index c66ddff4cc1e..de672deea676 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -20930,9 +20930,11 @@ static void wma_wow_wake_up_stats(tp_wma_handle wma, uint8_t *data,
case WOW_REASON_PATTERN_MATCH_FOUND:
if (WMA_BCAST_MAC_ADDR == *data) {
wma->wow_bcast_wake_up_count++;
- if (WMA_ICMP_PROTOCOL == *(data + WMA_IPV4_PROTOCOL))
+ if (adf_nbuf_data_is_ipv4_pkt(data) &&
+ (WMA_ICMP_PROTOCOL == *(data + WMA_IPV4_PROTOCOL)))
wma->wow_icmpv4_count++;
- if ((len > WMA_ICMP_V6_TYPE_OFFSET) &&
+ else if (adf_nbuf_data_is_ipv6_pkt(data) &&
+ (len > WMA_ICMP_V6_TYPE_OFFSET) &&
(WMA_ICMP_V6_HEADER_TYPE ==
*(data + WMA_ICMP_V6_HEADER_OFFSET)))
wma->wow_icmpv6_uc_bc_count++;
@@ -20948,9 +20950,11 @@ static void wma_wow_wake_up_stats(tp_wma_handle wma, uint8_t *data,
WMA_LOGA("ICMP_V6 data len %d", len);
} else {
wma->wow_ucast_wake_up_count++;
- if (WMA_ICMP_PROTOCOL == *(data + WMA_IPV4_PROTOCOL))
+ if (adf_nbuf_data_is_ipv4_pkt(data) &&
+ (WMA_ICMP_PROTOCOL == *(data + WMA_IPV4_PROTOCOL)))
wma->wow_icmpv4_count++;
- if ((len > WMA_ICMP_V6_TYPE_OFFSET) &&
+ else if (adf_nbuf_data_is_ipv6_pkt(data) &&
+ (len > WMA_ICMP_V6_TYPE_OFFSET) &&
(WMA_ICMP_V6_HEADER_TYPE ==
*(data + WMA_ICMP_V6_HEADER_OFFSET)))
wma->wow_icmpv6_uc_bc_count++;