Merge "IPACM: add flt rule counter on each prod client"
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 9d4d99c..3527f13 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -354,6 +354,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++;
@@ -1571,6 +1572,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);
}
@@ -1653,6 +1655,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);
}
@@ -1737,6 +1740,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,
@@ -1760,6 +1764,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,
@@ -1783,6 +1788,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,
@@ -1856,6 +1862,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);
}
@@ -1899,6 +1906,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 */
@@ -1963,6 +1971,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);
}
@@ -2031,6 +2040,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;
@@ -2049,6 +2059,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;
@@ -2058,7 +2069,6 @@
}
else
{
-
memcpy(&(m_pFilteringTable->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
if (false == m_filtering.AddFilteringRule(m_pFilteringTable))
{
@@ -2068,6 +2078,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;
@@ -2102,6 +2113,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 */
@@ -2159,6 +2171,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*/
@@ -3323,6 +3336,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
{
@@ -3335,6 +3349,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;
}
@@ -3355,6 +3370,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
{
@@ -3367,16 +3383,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;
}
@@ -3867,6 +3886,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 ");
}
@@ -3882,6 +3902,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)
{
@@ -3891,6 +3912,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 fd957a4..27e27f6 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);
@@ -1234,7 +1251,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;
@@ -1264,6 +1281,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));
@@ -1315,35 +1339,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++)
{
@@ -1353,8 +1362,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;
}
@@ -1381,6 +1391,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)
{
@@ -1389,6 +1400,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
{
@@ -2300,6 +2312,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 */
@@ -3052,6 +3065,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++)
{
@@ -3102,6 +3116,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++)
{
@@ -3163,11 +3178,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;