IPACM: update dst mac address correctly
use the dst mac address offset sent by client
while constructing the full client header
Change-Id: I23b610111d926a7ef9a0773c21b5d9b8beffa1c0
Acked-by: Sunil Paidimarri <hisunil@qti.qualcomm.com>
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index 9009136..132203c 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -149,8 +149,6 @@
bool header_partial_default_wan_v4;
bool header_partial_default_wan_v6;
uint8_t ext_router_mac_addr[IPA_MAC_ADDR_SIZE];
- uint16_t eth2_ofst_v4;
- uint16_t eth2_ofst_v6;
static int num_ipv4_modem_pdn;
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 12bfeba..ef8d0d0 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -4593,7 +4593,19 @@
/* copy client mac_addr to partial header */
IPACMDBG_H("header eth2_ofst_valid: %d, eth2_ofst: %d\n",
sCopyHeader.is_eth2_ofst_valid, sCopyHeader.eth2_ofst);
- memcpy(&pHeaderDescriptor->hdr[0].hdr[eth2_ofst_v4], mac_addr, IPA_MAC_ADDR_SIZE); /* only copy 6 bytes mac-address */
+
+ /* only copy 6 bytes mac-address */
+ if(sCopyHeader.is_eth2_ofst_valid == false)
+ {
+ memcpy(&pHeaderDescriptor->hdr[0].hdr[0],
+ mac_addr, IPA_MAC_ADDR_SIZE);
+ }
+ else
+ {
+ memcpy(&pHeaderDescriptor->hdr[0].hdr[sCopyHeader.eth2_ofst],
+ mac_addr, IPA_MAC_ADDR_SIZE);
+ }
+
pHeaderDescriptor->commit = true;
pHeaderDescriptor->num_hdrs = 1;
@@ -4676,11 +4688,21 @@
{
memcpy(pHeaderDescriptor->hdr[0].hdr,
sCopyHeader.hdr,
- sCopyHeader.hdr_len);
+ sCopyHeader.hdr_len);
}
/* copy client mac_addr to partial header */
- memcpy(&pHeaderDescriptor->hdr[0].hdr[eth2_ofst_v6], mac_addr, IPA_MAC_ADDR_SIZE); /* only copy 6 bytes mac-address */
+ if(sCopyHeader.is_eth2_ofst_valid == false)
+ {
+ memcpy(&pHeaderDescriptor->hdr[0].hdr[0],
+ mac_addr, IPA_MAC_ADDR_SIZE); /* only copy 6 bytes mac-address */
+ }
+ else
+ {
+ memcpy(&pHeaderDescriptor->hdr[0].hdr[sCopyHeader.eth2_ofst],
+ mac_addr, IPA_MAC_ADDR_SIZE); /* only copy 6 bytes mac-address */
+ }
+
pHeaderDescriptor->commit = true;
pHeaderDescriptor->num_hdrs = 1;