summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Javid <mjavid@codeaurora.org>2018-02-20 17:06:13 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-03-05 03:00:49 -0800
commit6e15ea2330039cf1d53af9e4cfab6162dbd709bc (patch)
tree13cc182c451295a0be8a8fefe5aa2c309bd4d256
parentf490bbc8f6db14d7a4700d351c72cf2396417851 (diff)
downloadipacfg-mgr-6e15ea2330039cf1d53af9e4cfab6162dbd709bc.tar.gz
ipacm: clean upstream if STA disconnected earlier
If STA is disconnected, since interface is already down so clean upstream is not getting handled. Handle wan down event when interface is going down. Change-Id: I03d041db10eb072ef87d5f0c8ad88436e9744ab3
-rw-r--r--ipacm/src/IPACM_Wan.cpp65
1 files changed, 59 insertions, 6 deletions
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 87ecb6d..a902457 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -4375,7 +4375,11 @@ int IPACM_Wan::config_dft_embms_rules(ipa_ioc_add_flt_rule *pFilteringTable_v4,
int IPACM_Wan::handle_down_evt()
{
int res = IPACM_SUCCESS;
- uint32_t i;
+ uint32_t i, tether_total;
+ int ipa_if_num_tether_tmp[IPA_MAX_IFACE_ENTRIES];
+
+ tether_total = 0;
+ memset(ipa_if_num_tether_tmp, 0, IPA_MAX_IFACE_ENTRIES);
IPACMDBG_H(" wan handle_down_evt \n");
@@ -4396,22 +4400,61 @@ int IPACM_Wan::handle_down_evt()
/* make sure default routing rules and firewall rules are deleted*/
if (active_v4)
{
- if (rx_prop != NULL)
- {
+ if (rx_prop != NULL)
+ {
del_dft_firewall_rules(IPA_IP_v4);
}
handle_route_del_evt(IPA_IP_v4);
IPACMDBG_H("Delete default v4 routing rules\n");
+
+#ifdef FEATURE_IPA_ANDROID
+ /* posting wan_down_tether for lan clients */
+#ifdef FEATURE_IPACM_HAL
+ IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV4\n");
+ post_wan_down_tether_evt(IPA_IP_v4, 0);
+#else
+ for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++)
+ {
+ ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v4[i];
+ }
+ tether_total = IPACM_Wan::ipa_if_num_tether_v4_total;
+ for (i=0; i < tether_total; i++)
+ {
+ post_wan_down_tether_evt(IPA_IP_v4, ipa_if_num_tether_tmp[i]);
+ IPACMDBG_H("post_wan_down_tether_v4 iface(%d: %s)\n",
+ i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name);
+ }
+#endif
+#endif
}
if (active_v6)
{
- if (rx_prop != NULL)
- {
+ if (rx_prop != NULL)
+ {
del_dft_firewall_rules(IPA_IP_v6);
}
handle_route_del_evt(IPA_IP_v6);
IPACMDBG_H("Delete default v6 routing rules\n");
+#ifdef FEATURE_IPA_ANDROID
+ /* posting wan_down_tether for lan clients */
+#ifdef FEATURE_IPACM_HAL
+ IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV6\n");
+ post_wan_down_tether_evt(IPA_IP_v6, 0);
+#else
+ for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++)
+ {
+ ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v6[i];
+ }
+ tether_total = IPACM_Wan::ipa_if_num_tether_v6_total;
+ for (i=0; i < tether_total; i++)
+ {
+ post_wan_down_tether_evt(IPA_IP_v6, ipa_if_num_tether_tmp[i]);
+ IPACMDBG_H("post_wan_down_tether_v6 iface(%d: %s)\n",
+ i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name);
+ }
+#endif
+#endif
}
/* Delete default v4 RT rule */
@@ -4420,7 +4463,7 @@ int IPACM_Wan::handle_down_evt()
IPACMDBG_H("Delete default v4 routing rules\n");
if (m_routing.DeleteRoutingHdl(dft_rt_rule_hdl[0], IPA_IP_v4) == false)
{
- IPACMERR("Routing rule deletion failed!\n");
+ IPACMERR("Routing rule deletion failed!\n");
res = IPACM_FAILURE;
goto fail;
}
@@ -4755,6 +4798,10 @@ int IPACM_Wan::handle_down_evt_ex()
handle_route_del_evt_ex(IPA_IP_v4);
#ifdef FEATURE_IPA_ANDROID
/* posting wan_down_tether for all lan clients */
+#ifdef FEATURE_IPACM_HAL
+ IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV4\n");
+ post_wan_down_tether_evt(IPA_IP_v4, 0);
+#else
for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++)
{
ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v4[i];
@@ -4767,11 +4814,16 @@ int IPACM_Wan::handle_down_evt_ex()
i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name);
}
#endif
+#endif
IPACM_Wan::wan_up_v6 = false;
del_wan_firewall_rule(IPA_IP_v6);
handle_route_del_evt_ex(IPA_IP_v6);
#ifdef FEATURE_IPA_ANDROID
/* posting wan_down_tether for all lan clients */
+#ifdef FEATURE_IPACM_HAL
+ IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV6\n");
+ post_wan_down_tether_evt(IPA_IP_v6, 0);
+#else
for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++)
{
ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v6[i];
@@ -4784,6 +4836,7 @@ int IPACM_Wan::handle_down_evt_ex()
i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name);
}
#endif
+#endif
memset(IPACM_Wan::wan_up_dev_name, 0, sizeof(IPACM_Wan::wan_up_dev_name));
install_wan_filtering_rule(false);