Browse Source

qcacmn: Fix multicast checks

IP multicast check for IPv4 was failing as the big endian
conversion was not being done and wrong values were being checked.
Do ntohs conversion on macros to check if packet is mcast packet.
In IPv6 check, the word is being checked instead of first byte.
Check only first byte when checking for ipv6 multicast address.

Change-Id: I686cdef7957778f9c60f2dc919421d39c4b8b71c
CRs-Fixed: 3824229
Ananya Gupta 10 months ago
parent
commit
ecbe06079f
1 changed files with 6 additions and 5 deletions
  1. 6 5
      qdf/linux/src/qdf_nbuf.c

+ 6 - 5
qdf/linux/src/qdf_nbuf.c

@@ -2540,8 +2540,9 @@ bool __qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
 		 * Check first word of the IPV4 address and if it is
 		 * equal to 0xE then it represents multicast IP.
 		 */
-		if ((*dst_addr & QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK) ==
-				QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK)
+		if ((*dst_addr &
+		     QDF_SWAP_U32(QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK)) ==
+		     QDF_SWAP_U32(QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK))
 			return true;
 		else
 			return false;
@@ -2559,10 +2560,10 @@ bool __qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
 
 		/*
 		 * Check first byte of the IP address and if it
-		 * 0xFF00 then it is a IPV6 mcast packet.
+		 * 0xFF then it is a IPV6 mcast packet.
 		 */
-		if (*dst_addr ==
-		     QDF_SWAP_U16(QDF_NBUF_TRAC_IPV6_DEST_ADDR))
+		if ((*dst_addr & QDF_SWAP_U16(QDF_NBUF_TRAC_IPV6_DEST_ADDR)) ==
+		    QDF_SWAP_U16(QDF_NBUF_TRAC_IPV6_DEST_ADDR))
 			return true;
 		else
 			return false;