diff options
author | Utkarsh Saxena <usaxena@codeaurora.org> | 2017-06-12 16:13:58 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-07-06 22:49:11 -0700 |
commit | 1d6dbdcef40b4f22303183cdc7c178594f8ecd0a (patch) | |
tree | 38370c0d97a8908b59ef7e8835c4f50764a73583 | |
parent | 40d7c595d48dbe78a72081b6f01e3d274be7bef8 (diff) | |
download | ipacfg-mgr-1d6dbdcef40b4f22303183cdc7c178594f8ecd0a.tar.gz |
ipacm: Set flag to handle IPA_HANDLE_WAN_UP_TETHER event only once in STA mode
Incase of handsoff between wifi and mobile data,
IPA_HANDLE_WAN_UP_TETHER event is added twice.
So filtering rule is overwritten. Set a flag
and add additional check to make sure
IPA_HANDLE_WAN_UP_TETHER event should be
handled only once
Change-Id: Icc47d0199a0a30a2b0173ef2d4be905d000ecdaf
-rw-r--r-- | ipacm/inc/IPACM_Lan.h | 3 | ||||
-rw-r--r-- | ipacm/src/IPACM_Lan.cpp | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/ipacm/inc/IPACM_Lan.h b/ipacm/inc/IPACM_Lan.h index 85ea927..2e5f21b 100644 --- a/ipacm/inc/IPACM_Lan.h +++ b/ipacm/inc/IPACM_Lan.h @@ -220,6 +220,9 @@ protected: bool modem_ul_v4_set; bool modem_ul_v6_set; + bool sta_ul_v4_set; + bool sta_ul_v6_set; + uint32_t if_ipv4_subnet; uint32_t ipv6_prefix[2]; diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp index 8d853d2..a561eef 100644 --- a/ipacm/src/IPACM_Lan.cpp +++ b/ipacm/src/IPACM_Lan.cpp @@ -79,6 +79,10 @@ IPACM_Lan::IPACM_Lan(int iface_index) : IPACM_Iface(iface_index) is_active = true; modem_ul_v4_set = false; modem_ul_v6_set = false; + + sta_ul_v4_set = false; + sta_ul_v6_set = false; + is_mode_switch = false; if_ipv4_subnet =0; each_client_rt_rule_count[IPA_IP_v4] = 0; @@ -1081,6 +1085,7 @@ int IPACM_Lan::handle_wan_down(bool is_sta_mode) return IPACM_FAILURE; } IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1); + sta_ul_v4_set = false; } close(fd); @@ -1375,6 +1380,11 @@ int IPACM_Lan::handle_wan_up(ipa_ip_type ip_type) if(ip_type == IPA_IP_v4) { + if(sta_ul_v4_set == true) + { + IPACMDBG_H("Filetring rule for IPV4 of STA mode is already configured, sta_ul_v4_set: %d\n",sta_ul_v4_set); + return IPACM_FAILURE; + } len = sizeof(struct ipa_ioc_add_flt_rule) + (1 * sizeof(struct ipa_flt_rule_add)); m_pFilteringTable = (struct ipa_ioc_add_flt_rule *)calloc(1, len); if (m_pFilteringTable == NULL) @@ -1447,13 +1457,18 @@ int IPACM_Lan::handle_wan_up(ipa_ip_type ip_type) m_pFilteringTable->rules[0].status); } - + sta_ul_v4_set = true; /* copy filter hdls */ lan_wan_fl_rule_hdl[0] = m_pFilteringTable->rules[0].flt_rule_hdl; free(m_pFilteringTable); } else if(ip_type == IPA_IP_v6) { + if(sta_ul_v6_set == true) + { + IPACMDBG_H("Filetring rule for IPV6 of STA mode is already configured, sta_ul_v6_set: %d\n",sta_ul_v6_set); + return IPACM_FAILURE; + } /* add default v6 filter rule */ m_pFilteringTable = (struct ipa_ioc_add_flt_rule *) calloc(1, sizeof(struct ipa_ioc_add_flt_rule) + @@ -1529,6 +1544,7 @@ int IPACM_Lan::handle_wan_up(ipa_ip_type ip_type) IPACMDBG_H("flt rule hdl0=0x%x, status=0x%x\n", m_pFilteringTable->rules[0].flt_rule_hdl, m_pFilteringTable->rules[0].status); } + sta_ul_v6_set = true; /* copy filter hdls */ dft_v6fl_rule_hdl[IPV6_DEFAULT_FILTERTING_RULES] = m_pFilteringTable->rules[0].flt_rule_hdl; free(m_pFilteringTable); @@ -3248,6 +3264,7 @@ int IPACM_Lan::handle_wan_down_v6(bool is_sta_mode) return IPACM_FAILURE; } IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1); + sta_ul_v6_set = false; } close(fd); return IPACM_SUCCESS; |