IPACM: add flt rule counter on each prod client
Add flt rule counter on each producer client to reflect the actual rules
installed on each pipe, to avoid wrong modem rule indices sent to modem.
Also when the modem rule indices are different from expected values, print
error message in dmesg.
Change-Id: I3fe19f0f6cc0c7679082bdef3ff7e8ae810049a3
diff --git a/ipacm/inc/IPACM_Config.h b/ipacm/inc/IPACM_Config.h
index 54e2d0c..2f2da53 100644
--- a/ipacm/inc/IPACM_Config.h
+++ b/ipacm/inc/IPACM_Config.h
@@ -121,6 +121,10 @@
/* Store SW-enable or not */
bool ipa_sw_rt_enable;
+ /* Store the flt rule count for each producer client*/
+ int flt_rule_count_v4[IPA_CLIENT_CONS - IPA_CLIENT_PROD];
+ int flt_rule_count_v6[IPA_CLIENT_CONS - IPA_CLIENT_PROD];
+
/* IPACM routing table name for v4/v6 */
struct ipa_ioc_get_rt_tbl rt_tbl_lan_v4, rt_tbl_wan_v4, rt_tbl_default_v4, rt_tbl_v6, rt_tbl_wan_v6;
struct ipa_ioc_get_rt_tbl rt_tbl_wan_dl;
@@ -134,6 +138,63 @@
/* To return the instance */
static IPACM_Config* GetInstance();
+ inline void increaseFltRuleCount(int index, ipa_ip_type iptype, int increment)
+ {
+ if((index >= IPA_CLIENT_CONS - IPA_CLIENT_PROD) || (index < 0))
+ {
+ IPACMERR("Index is out of range: %d.\n", index);
+ return;
+ }
+ if(iptype == IPA_IP_v4)
+ {
+ flt_rule_count_v4[index] += increment;
+ IPACMDBG_H("Now num of v4 flt rules on client %d is %d.\n", index, flt_rule_count_v4[index]);
+ }
+ else
+ {
+ flt_rule_count_v6[index] += increment;
+ IPACMDBG_H("Now num of v6 flt rules on client %d is %d.\n", index, flt_rule_count_v6[index]);
+ }
+ return;
+ }
+
+ inline void decreaseFltRuleCount(int index, ipa_ip_type iptype, int decrement)
+ {
+ if((index >= IPA_CLIENT_CONS - IPA_CLIENT_PROD) || (index < 0))
+ {
+ IPACMERR("Index is out of range: %d.\n", index);
+ return;
+ }
+ if(iptype == IPA_IP_v4)
+ {
+ flt_rule_count_v4[index] -= decrement;
+ IPACMDBG_H("Now num of v4 flt rules on client %d is %d.\n", index, flt_rule_count_v4[index]);
+ }
+ else
+ {
+ flt_rule_count_v6[index] -= decrement;
+ IPACMDBG_H("Now num of v6 flt rules on client %d is %d.\n", index, flt_rule_count_v6[index]);
+ }
+ return;
+ }
+
+ inline int getFltRuleCount(int index, ipa_ip_type iptype)
+ {
+ if((index >= IPA_CLIENT_CONS - IPA_CLIENT_PROD) || (index < 0))
+ {
+ IPACMERR("Index is out of range: %d.\n", index);
+ return -1;
+ }
+ if(iptype == IPA_IP_v4)
+ {
+ return flt_rule_count_v4[index];
+ }
+ else
+ {
+ return flt_rule_count_v6[index];
+ }
+ }
+
inline int GetAlgPortCnt()
{
return ipa_num_alg_ports;
diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h
index f661974..278ed24 100644
--- a/ipacm/inc/IPACM_Iface.h
+++ b/ipacm/inc/IPACM_Iface.h
@@ -144,11 +144,6 @@
/* software routing disable */
virtual int handle_software_routing_disable(void);
- /* used to get filtering rule index in table */
- int flt_rule_count_v4;
-
- int flt_rule_count_v6;
-
private:
static const char *DEVICE_NAME;
diff --git a/ipacm/inc/IPACM_Lan.h b/ipacm/inc/IPACM_Lan.h
index bcfd898..68669c0 100644
--- a/ipacm/inc/IPACM_Lan.h
+++ b/ipacm/inc/IPACM_Lan.h
@@ -53,7 +53,7 @@
#define IPA_WAN_DEFAULT_FILTER_RULE_HANDLES 1
#define IPA_PRIV_SUBNET_FILTER_RULE_HANDLES 3
#define IPA_NUM_ODU_ROUTE_RULES 2
-#define MAX_WAN_UL_FILTER_RULES 20
+#define MAX_WAN_UL_FILTER_RULES MAX_NUM_EXT_PROPS
#define NUM_IPV6_PREFIX_FLT_RULE 1
#define NUM_IPV6_ICMP_FLT_RULE 1
@@ -304,6 +304,10 @@
uint32_t if_ipv4_subnet;
+ /* expected modem UL rules starting index */
+ int exp_index_v4;
+ int exp_index_v6;
+
private:
/* dynamically allocate lan iface's unicast routing rule structure */
diff --git a/ipacm/inc/IPACM_Log.h b/ipacm/inc/IPACM_Log.h
index f2ed773..131aab8 100644
--- a/ipacm/inc/IPACM_Log.h
+++ b/ipacm/inc/IPACM_Log.h
@@ -65,12 +65,18 @@
void ipacm_log_send( void * user_data);
static char buffer_send[MAX_BUF_LEN];
+static char dmesg_cmd[MAX_BUF_LEN];
#define PERROR(fmt) memset(buffer_send, 0, MAX_BUF_LEN);\
snprintf(buffer_send,MAX_BUF_LEN,"%s:%d %s()", __FILE__, __LINE__, __FUNCTION__);\
ipacm_log_send (buffer_send); \
perror(fmt);
+#define IPACMDBG_DMESG(fmt, ...) memset(buffer_send, 0, MAX_BUF_LEN);\
+ snprintf(buffer_send,MAX_BUF_LEN,"%s:%d %s: " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);\
+ memset(dmesg_cmd, 0, MAX_BUF_LEN);\
+ snprintf(dmesg_cmd, MAX_BUF_LEN, "echo %s > /dev/kmsg", buffer_send);\
+ system(dmesg_cmd);
#define IPACMERR(fmt, ...) memset(buffer_send, 0, MAX_BUF_LEN);\
snprintf(buffer_send,MAX_BUF_LEN,"ERR: %s:%d %s() " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);\
ipacm_log_send (buffer_send);\
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index 5626367..d7b5ee0 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -85,6 +85,9 @@
qmap_id = ~0;
+ memset(flt_rule_count_v4, 0, (IPA_CLIENT_CONS - IPA_CLIENT_PROD)*sizeof(int));
+ memset(flt_rule_count_v6, 0, (IPA_CLIENT_CONS - IPA_CLIENT_PROD)*sizeof(int));
+
IPACMDBG_H(" create IPACM_Config constructor\n");
return;
}
diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp
index 729acf2..0606ab4 100644
--- a/ipacm/src/IPACM_Iface.cpp
+++ b/ipacm/src/IPACM_Iface.cpp
@@ -82,8 +82,6 @@
memset(software_routing_fl_rule_hdl, 0, sizeof(software_routing_fl_rule_hdl));
memset(ipv6_addr, 0, sizeof(ipv6_addr));
- flt_rule_count_v4 = 0;
- flt_rule_count_v6 = 0;
query_iface_property();
IPACMDBG_H(" create iface-index(%d) constructor\n", ipa_if_num);
return;
@@ -159,6 +157,7 @@
goto fail;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
IPACMDBG("soft-routing flt rule hdl0=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl);
/* copy filter hdls */
software_routing_fl_rule_hdl[0] = m_pFilteringTable->rules[0].flt_rule_hdl;
@@ -179,6 +178,7 @@
goto fail;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG("soft-routing flt rule hdl0=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl);
/* copy filter hdls */
software_routing_fl_rule_hdl[1] = m_pFilteringTable->rules[0].flt_rule_hdl;
@@ -209,6 +209,7 @@
goto fail;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, ip_type, 1);
IPACMDBG("soft-routing flt rule hdl0=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl);
/* copy filter hdls */
if (ip_type == IPA_IP_v4)
@@ -258,6 +259,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
/* ipv6 case */
if (m_filtering.DeleteFilteringHdls(&software_routing_fl_rule_hdl[1],
@@ -267,6 +269,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
softwarerouting_act = false;
#if 0
}
@@ -297,6 +300,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, ip, 1);
softwarerouting_act = false;
}
#endif
@@ -754,7 +758,7 @@
}
else
{
- flt_rule_count_v4 += IPV4_DEFAULT_FILTERTING_RULES;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES);
/* copy filter hdls */
for (int i = 0; i < IPV4_DEFAULT_FILTERTING_RULES; i++)
{
@@ -842,7 +846,7 @@
}
else
{
- flt_rule_count_v6 += IPV6_DEFAULT_FILTERTING_RULES;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES);
/* copy filter hdls */
for (int i = 0;
i < IPV6_DEFAULT_FILTERTING_RULES;
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 2b757a6..ebdf919 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -168,6 +168,22 @@
memset(ipv6_prefix_flt_rule_hdl, 0, NUM_IPV6_PREFIX_FLT_RULE * sizeof(uint32_t));
memset(ipv6_icmp_flt_rule_hdl, 0, NUM_IPV6_ICMP_FLT_RULE * sizeof(uint32_t));
+#ifdef FEATURE_ETH_BRIDGE_LE
+ exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
+#else
+#ifdef CT_OPT
+ exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_TCP_CTL_FLT_RULE + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
+#else
+ exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
+#endif
+#ifdef FEATURE_IPA_ANDROID
+ exp_index_v4 = exp_index_v4 - IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_MAX_PRIVATE_SUBNET_ENTRIES;
+#endif
+#endif
+
/* ODU routing table initilization */
if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
{
@@ -342,6 +358,21 @@
//IPACMDBG_H("Posting event:%d\n", evt_data.event);
IPACM_EvtDispatcher::PostEvt(&evt_data);
}
+#ifndef FEATURE_IPA_ANDROID
+ if(rx_prop != NULL)
+ {
+ if(IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4) != 0)
+ {
+ IPACMDBG_DMESG("### WARNING ### num ipv4 flt rules on client %d is not expected: %d expected value: 0",
+ rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4));
+ }
+ if(IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6) != 0)
+ {
+ IPACMDBG_DMESG("### WARNING ### num ipv6 flt rules on client %d is not expected: %d expected value: 0",
+ rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6));
+ }
+ }
+#endif
delete this;
}
break;
@@ -772,20 +803,6 @@
IPACMERR("Failed opening %s.\n", IPA_DEVICE_NAME);
return IPACM_FAILURE;
}
-#ifdef FEATURE_ETH_BRIDGE_LE
- flt_rule_count_v4 = IPV4_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-#else
-#ifdef CT_OPT
- flt_rule_count_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR
- + NUM_TCP_CTL_FLT_RULE + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-#else
- flt_rule_count_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR
- + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-#endif
-#ifdef FEATURE_IPA_ANDROID
- flt_rule_count_v4 = flt_rule_count_v4 - IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_MAX_PRIVATE_SUBNET_ENTRIES;
-#endif
-#endif
if(is_sta_mode == false)
{
@@ -802,6 +819,7 @@
close(fd);
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, num_wan_ul_fl_rule_v4);
memset(wan_ul_fl_rule_hdl_v4, 0, MAX_WAN_UL_FILTER_RULES * sizeof(uint32_t));
num_wan_ul_fl_rule_v4 = 0;
@@ -832,6 +850,7 @@
close(fd);
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
}
close(fd);
@@ -1104,8 +1123,7 @@
free(m_pFilteringTable);
return IPACM_FAILURE;
}
-
- flt_rule_count_v4 += IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
/* copy filter rule hdls */
for (i = 0; i < IPACM_Iface::ipacmcfg->ipa_num_private_subnet; i++)
@@ -1196,6 +1214,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n",
m_pFilteringTable->rules[0].flt_rule_hdl,
m_pFilteringTable->rules[0].status);
@@ -1263,6 +1282,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
@@ -2388,6 +2408,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES);
#ifdef FEATURE_ETH_BRIDGE_LE
for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
{
@@ -2399,6 +2420,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
#endif
#ifndef FEATURE_ETH_BRIDGE_LE
#ifdef CT_OPT
@@ -2408,6 +2430,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, NUM_TCP_CTL_FLT_RULE);
#endif
for(i=0; i<MAX_OFFLOAD_PAIR; i++)
{
@@ -2417,6 +2440,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
}
IPACMDBG_H("Deleted lan2lan IPv4 flt rules.\n");
#endif
@@ -2436,6 +2460,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_MAX_PRIVATE_SUBNET_ENTRIES);
#else
if (m_filtering.DeleteFilteringHdls(private_fl_rule_hdl, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet) == false)
{
@@ -2443,6 +2468,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
#endif
}
IPACMDBG_H("Finished delete default iface ipv4 filtering rules \n ");
@@ -2455,15 +2481,15 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE);
- if (m_filtering.DeleteFilteringHdls(dft_v6fl_rule_hdl,
- IPA_IP_v6,
- (IPV6_DEFAULT_FILTERTING_RULES + IPV6_DEFAULT_LAN_FILTERTING_RULES)) == false)
+ if (m_filtering.DeleteFilteringHdls(dft_v6fl_rule_hdl, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES) == false)
{
IPACMERR("Error Adding RuleTable(1) to Filtering, aborting...\n");
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES);
#ifdef FEATURE_ETH_BRIDGE_LE
for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
{
@@ -2475,6 +2501,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
#endif
#ifndef FEATURE_ETH_BRIDGE_LE
#ifdef CT_OPT
@@ -2484,6 +2511,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_TCP_CTL_FLT_RULE);
#endif
for(i=0; i<MAX_OFFLOAD_PAIR; i++)
{
@@ -2493,6 +2521,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
}
IPACMDBG_H("Deleted lan2lan IPv6 flt rules.\n");
#endif
@@ -2669,7 +2698,7 @@
ipa_ioc_add_flt_rule *pFilteringTable;
ipa_fltr_installed_notif_req_msg_v01 flt_index;
int fd;
- int i;
+ int i, index;
IPACMDBG_H("Set extended property rules in LAN\n");
@@ -2689,6 +2718,13 @@
if (0 == fd)
{
IPACMERR("Failed opening %s.\n", IPA_DEVICE_NAME);
+ return IPACM_FAILURE;
+ }
+ if (prop->num_ext_props > MAX_WAN_UL_FILTER_RULES)
+ {
+ IPACMERR("number of modem UL rules > MAX_WAN_UL_FILTER_RULES, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
}
memset(&flt_index, 0, sizeof(flt_index));
@@ -2739,6 +2775,21 @@
goto fail;
}
+ index = IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, iptype);
+
+#ifndef FEATURE_IPA_ANDROID
+ if(iptype == IPA_IP_v4 && index != exp_index_v4)
+ {
+ IPACMDBG_DMESG("### WARNING ### num flt rules for IPv4 on client %d is not expected: %d expected value: %d",
+ rx_prop->rx[0].src_pipe, index, exp_index_v4);
+ }
+ if(iptype == IPA_IP_v6 && index != exp_index_v6)
+ {
+ IPACMDBG_DMESG("### WARNING ### num flt rules for IPv6 on client %d is not expected: %d expected value: %d",
+ rx_prop->rx[0].src_pipe, index, exp_index_v6);
+ }
+#endif
+
for(cnt=0; cnt<prop->num_ext_props; cnt++)
{
memcpy(&flt_rule_entry.rule.eq_attrib,
@@ -2747,18 +2798,10 @@
flt_rule_entry.rule.rt_tbl_idx = prop->prop[cnt].rt_tbl_idx;
memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
- if(iptype == IPA_IP_v4)
- {
- IPACMDBG_H("Filtering rule %d has index %d\n", cnt, flt_rule_count_v4);
- flt_index.filter_index_list[cnt].filter_index = flt_rule_count_v4;
- flt_rule_count_v4++;
- }
- if(iptype == IPA_IP_v6)
- {
- IPACMDBG_H("Filtering rule %d has index %d\n", cnt, flt_rule_count_v6);
- flt_index.filter_index_list[cnt].filter_index = flt_rule_count_v6;
- flt_rule_count_v6++;
- }
+ IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
+ flt_index.filter_index_list[cnt].filter_index = index;
+ index++;
+
flt_index.filter_index_list[cnt].filter_handle = prop->prop[cnt].filter_hdl;
}
@@ -2784,6 +2827,7 @@
wan_ul_fl_rule_hdl_v4[num_wan_ul_fl_rule_v4] = pFilteringTable->rules[i].flt_rule_hdl;
num_wan_ul_fl_rule_v4++;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
}
else if(iptype == IPA_IP_v6)
{
@@ -2792,6 +2836,7 @@
wan_ul_fl_rule_hdl_v6[num_wan_ul_fl_rule_v6] = pFilteringTable->rules[i].flt_rule_hdl;
num_wan_ul_fl_rule_v6++;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
}
else
{
@@ -2817,21 +2862,13 @@
IPACMERR("Failed opening %s.\n", IPA_DEVICE_NAME);
return IPACM_FAILURE;
}
-#ifdef FEATURE_ETH_BRIDGE_LE
- flt_rule_count_v6 = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + NUM_IPV6_ICMP_FLT_RULE;
-#else
-#ifdef CT_OPT
- flt_rule_count_v6 = IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE;
-#else
- flt_rule_count_v6 = IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE;
-#endif
-#endif
if(m_filtering.DeleteFilteringHdls(ipv6_prefix_flt_rule_hdl, IPA_IP_v6, NUM_IPV6_PREFIX_FLT_RULE) == false)
{
close(fd);
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_IPV6_PREFIX_FLT_RULE);
if(is_sta_mode == false)
{
@@ -2849,6 +2886,7 @@
close(fd);
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, num_wan_ul_fl_rule_v6);
memset(wan_ul_fl_rule_hdl_v6, 0, MAX_WAN_UL_FILTER_RULES * sizeof(uint32_t));
num_wan_ul_fl_rule_v6 = 0;
@@ -2880,6 +2918,7 @@
close(fd);
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
}
close(fd);
@@ -3205,7 +3244,7 @@
}
else
{
- flt_rule_count_v4 += MAX_OFFLOAD_PAIR;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, MAX_OFFLOAD_PAIR);
/* copy filter rule hdls */
for (int i = 0; i < MAX_OFFLOAD_PAIR; i++)
{
@@ -3256,7 +3295,7 @@
}
else
{
- flt_rule_count_v6 += MAX_OFFLOAD_PAIR;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, MAX_OFFLOAD_PAIR);
/* copy filter rule hdls */
for (int i = 0; i < MAX_OFFLOAD_PAIR; i++)
{
@@ -4100,17 +4139,17 @@
{
for(i=0; i<NUM_TCP_CTL_FLT_RULE; i++)
{
- flt_rule_count_v4++;
tcp_ctl_flt_rule_hdl_v4[i] = pFilteringTable->rules[i].flt_rule_hdl;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, NUM_TCP_CTL_FLT_RULE);
}
else
{
for(i=0; i<NUM_TCP_CTL_FLT_RULE; i++)
{
- flt_rule_count_v6++;
tcp_ctl_flt_rule_hdl_v6[i] = pFilteringTable->rules[i].flt_rule_hdl;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, NUM_TCP_CTL_FLT_RULE);
}
}
@@ -4184,7 +4223,7 @@
}
else
{
- flt_rule_count_v4 += IPA_MAX_PRIVATE_SUBNET_ENTRIES;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_MAX_PRIVATE_SUBNET_ENTRIES);
/* copy filter rule hdls */
for (int i = 0; i < IPA_MAX_PRIVATE_SUBNET_ENTRIES; i++)
{
@@ -4350,9 +4389,9 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
ipv6_prefix_flt_rule_hdl[0] = flt_rule->rules[0].flt_rule_hdl;
IPACMDBG_H("IPv6 prefix filter rule HDL:0x%x\n", ipv6_prefix_flt_rule_hdl[0]);
- flt_rule_count_v6++;
free(flt_rule);
}
}
@@ -4407,9 +4446,9 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
ipv6_icmp_flt_rule_hdl[0] = flt_rule->rules[0].flt_rule_hdl;
IPACMDBG_H("IPv6 icmp filter rule HDL:0x%x\n", ipv6_icmp_flt_rule_hdl[0]);
- flt_rule_count_v6++;
free(flt_rule);
}
}
@@ -4509,7 +4548,7 @@
}
else
{
- flt_rule_count_v4 += IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
/* copy filter rule hdls */
for (int i = 0; i < IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
{
@@ -4561,7 +4600,7 @@
}
else
{
- flt_rule_count_v6 += IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
/* copy filter rule hdls */
for (int i = 0; i < IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
{
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index ddb7915..57c6537 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -353,6 +353,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
ipv6_dest_flt_rule_hdl[num_ipv6_dest_flt_rule] = flt_rule->rules[0].flt_rule_hdl;
IPACMDBG_H("IPv6 dest filter rule %d HDL:0x%x\n", num_ipv6_dest_flt_rule, ipv6_dest_flt_rule_hdl[num_ipv6_dest_flt_rule]);
num_ipv6_dest_flt_rule++;
@@ -1735,6 +1736,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
ipv6_frag_firewall_flt_rule_hdl = m_pFilteringTable->rules[0].flt_rule_hdl;
IPACMDBG_H("Installed IPv6 frag firewall rule, handle %d.\n", ipv6_frag_firewall_flt_rule_hdl);
}
@@ -1817,6 +1819,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
@@ -1901,6 +1904,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
/* save v4 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n",
m_pFilteringTable->rules[rule_v4].flt_rule_hdl,
@@ -1924,6 +1928,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
/* save v4 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n",
m_pFilteringTable->rules[rule_v4].flt_rule_hdl,
@@ -1947,6 +1952,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
/* save v4 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n",
m_pFilteringTable->rules[rule_v4].flt_rule_hdl,
@@ -2020,6 +2026,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
@@ -2063,6 +2070,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
/* copy filter hdls */
@@ -2127,6 +2135,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
@@ -2195,6 +2204,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
/* save v4 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
firewall_hdl_v6[rule_v6] = m_pFilteringTable->rules[0].flt_rule_hdl;
@@ -2213,6 +2223,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
/* save v6 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
firewall_hdl_v6[rule_v6] = m_pFilteringTable->rules[0].flt_rule_hdl;
@@ -2222,7 +2233,6 @@
}
else
{
-
memcpy(&(m_pFilteringTable->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
if (false == m_filtering.AddFilteringRule(m_pFilteringTable))
{
@@ -2232,6 +2242,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
/* save v6 firewall filter rule handler */
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
firewall_hdl_v6[rule_v6] = m_pFilteringTable->rules[0].flt_rule_hdl;
@@ -2266,6 +2277,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
/* copy filter hdls */
@@ -2323,6 +2335,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status);
}
/* copy filter hdls*/
@@ -3487,6 +3500,7 @@
IPACMERR("Error Deleting Filtering rules, aborting...\n");
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, num_firewall_v4);
}
else
{
@@ -3499,6 +3513,7 @@
IPACMERR("Error Deleting Filtering rules, aborting...\n");
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
num_firewall_v4 = 0;
}
@@ -3519,6 +3534,7 @@
IPACMERR("Error Deleting Filtering rules, aborting...\n");
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, num_firewall_v6);
}
else
{
@@ -3531,16 +3547,19 @@
IPACMERR("Error Deleting Filtering rules, aborting...\n");
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
if (m_filtering.DeleteFilteringHdls(&dft_wan_fl_hdl[2],
IPA_IP_v6, 1) == false)
{
IPACMERR("Error Deleting Filtering rules, aborting...\n");
return IPACM_FAILURE;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
if (m_filtering.DeleteFilteringHdls(&ipv6_frag_firewall_flt_rule_hdl, IPA_IP_v6, 1) == false)
{
IPACMERR("Error deleting IPv6 frag filtering rules.\n");
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
num_firewall_v6 = 0;
}
@@ -4031,6 +4050,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES);
IPACMDBG_H("finished delete default v4 filtering rules\n ");
}
@@ -4046,6 +4066,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES);
if(num_ipv6_dest_flt_rule > 0 && num_ipv6_dest_flt_rule <= MAX_DEFAULT_v6_ROUTE_RULES)
{
@@ -4055,6 +4076,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, num_ipv6_dest_flt_rule);
}
IPACMDBG_H("finished delete default v6 filtering rules\n ");
}
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 0d822f6..2bd0333 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -110,6 +110,23 @@
return;
}
+#ifdef FEATURE_ETH_BRIDGE_LE
+ exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + 2 * IPACM_Iface::ipacmcfg->ipa_num_private_subnet
+ + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
+ exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV6_PREFIX_FLT_RULE
+ + NUM_IPV6_ICMP_FLT_RULE;
+#else
+#ifndef CT_OPT
+ exp_index_v4 = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
+ exp_index_v6 = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR) + NUM_IPV6_PREFIX_FLT_RULE + NUM_IPV6_ICMP_FLT_RULE;
+#else
+ exp_index_v4 = 2*(IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
+ exp_index_v6 = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR) + NUM_IPV6_PREFIX_FLT_RULE + NUM_IPV6_ICMP_FLT_RULE;
+#endif
+#ifdef FEATURE_IPA_ANDROID
+ exp_index_v4 = exp_index_v4 + 2 * (IPA_MAX_PRIVATE_SUBNET_ENTRIES - IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
+#endif
+#endif
IPACM_Wlan::num_wlan_ap_iface++;
IPACMDBG_H("Now the number of wlan AP iface is %d\n", IPACM_Wlan::num_wlan_ap_iface);
@@ -1228,7 +1245,7 @@
int IPACM_Wlan::handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype)
{
ipa_flt_rule_add flt_rule_entry;
- int len = 0, cnt, ret = IPACM_SUCCESS, offset;
+ int len = 0, cnt, ret = IPACM_SUCCESS, index;
ipa_ioc_add_flt_rule *pFilteringTable;
ipa_fltr_installed_notif_req_msg_v01 flt_index;
int fd;
@@ -1258,6 +1275,13 @@
if (0 == fd)
{
IPACMERR("Failed opening %s.\n", IPA_DEVICE_NAME);
+ return IPACM_FAILURE;
+ }
+ if (prop->num_ext_props > MAX_WAN_UL_FILTER_RULES)
+ {
+ IPACMERR("number of modem UL rules > MAX_WAN_UL_FILTER_RULES, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
}
memset(&flt_index, 0, sizeof(flt_index));
@@ -1309,35 +1333,20 @@
goto fail;
}
- if(iptype == IPA_IP_v4)
+ index = IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, iptype);
+
+#ifndef FEATURE_IPA_ANDROID
+ if(iptype == IPA_IP_v4 && index != exp_index_v4)
{
-#ifdef FEATURE_ETH_BRIDGE_LE
- offset = IPV4_DEFAULT_FILTERTING_RULES + 2 * IPACM_Iface::ipacmcfg->ipa_num_private_subnet
- + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
-#else
-#ifndef CT_OPT
- offset = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#else
- offset = 2*(IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#endif
-#ifdef FEATURE_IPA_ANDROID
- offset = offset + 2 * (IPA_MAX_PRIVATE_SUBNET_ENTRIES - IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#endif
-#endif
+ IPACMDBG_DMESG("### WARNING ### num flt rules for IPv4 on client %d is not expected: %d expected value: %d",
+ rx_prop->rx[0].src_pipe, index, exp_index_v4);
}
- else
+ if(iptype == IPA_IP_v6 && index != exp_index_v6)
{
-#ifdef FEATURE_ETH_BRIDGE_LE
- offset = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV6_PREFIX_FLT_RULE
- + NUM_IPV6_ICMP_FLT_RULE;
-#else
-#ifndef CT_OPT
- offset = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR) + NUM_IPV6_PREFIX_FLT_RULE + NUM_IPV6_ICMP_FLT_RULE;
-#else
- offset = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR) + NUM_IPV6_PREFIX_FLT_RULE + NUM_IPV6_ICMP_FLT_RULE;
-#endif
-#endif
+ IPACMDBG_DMESG("### WARNING ### num flt rules for IPv6 on client %d is not expected: %d expected value: %d",
+ rx_prop->rx[0].src_pipe, index, exp_index_v6);
}
+#endif
for(cnt=0; cnt<prop->num_ext_props; cnt++)
{
@@ -1347,8 +1356,9 @@
flt_rule_entry.rule.rt_tbl_idx = prop->prop[cnt].rt_tbl_idx;
memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
- flt_index.filter_index_list[cnt].filter_index = offset+cnt;
- IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, offset+cnt);
+ IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
+ flt_index.filter_index_list[cnt].filter_index = index;
+ index++;
flt_index.filter_index_list[cnt].filter_handle = prop->prop[cnt].filter_hdl;
}
@@ -1375,6 +1385,7 @@
wan_ul_fl_rule_hdl_v4[num_wan_ul_fl_rule_v4] = pFilteringTable->rules[i].flt_rule_hdl;
num_wan_ul_fl_rule_v4++;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
}
else if(iptype == IPA_IP_v6)
{
@@ -1383,6 +1394,7 @@
wan_ul_fl_rule_hdl_v6[num_wan_ul_fl_rule_v6] = pFilteringTable->rules[i].flt_rule_hdl;
num_wan_ul_fl_rule_v6++;
}
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
}
else
{
@@ -2294,6 +2306,7 @@
res = IPACM_FAILURE;
goto fail;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE);
}
IPACMDBG_H("Delete default %d v6 filter rules\n", IPV6_DEFAULT_FILTERTING_RULES);
/* delete default filter rules */
@@ -3046,6 +3059,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_rule);
/* copy filter rule hdls */
for (int i = 0; i < num_rule; i++)
{
@@ -3096,6 +3110,7 @@
}
else
{
+ IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_rule);
/* copy filter rule hdls */
for (int i = 0; i < num_rule; i++)
{
@@ -3157,11 +3172,13 @@
IPACMERR("Failed to delete ipv4 dummy flt rules.\n");
return;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, num_v4_dummy_rule);
if(m_filtering.DeleteFilteringHdls(IPACM_Wlan::dummy_flt_rule_hdl_v6, IPA_IP_v6, num_v6_dummy_rule) == false)
{
IPACMERR("Failed to delete ipv6 dummy flt rules.\n");
return;
}
+ IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, num_v6_dummy_rule);
free(IPACM_Wlan::dummy_flt_rule_hdl_v4);
IPACM_Wlan::dummy_flt_rule_hdl_v4 = NULL;