ipacm: increment num_tethered_client properly in case of XLAT
Currently in case of XLAT if ADD_DOWNSTREAM event comes
before XLAT_CONNECT event then num_offload_v4_tethered_iface
is not incremented and it will have incorrect value. Increment
num_offload_v4_tethered_iface var if XLAT comes after downstream
is up.
Change-Id: I79814a526b1112d7004fa1959a519475c02fe834
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 65bd3ca..7e7e875 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -751,25 +751,7 @@
if (ipa_interface_index == ipa_if_num)
{
IPACMDBG_H("Received IPA_DOWNSTREAM_ADD event.\n");
-#ifdef FEATURE_IPA_ANDROID
- if (IPACM_Wan::isXlat() && (data->prefix.iptype == IPA_IP_v4))
- {
- /* indicate v4-offload */
- IPACM_OffloadManager::num_offload_v4_tethered_iface++;
- IPACMDBG_H("in xlat: update num_offload_v4_tethered_iface %d\n", IPACM_OffloadManager::num_offload_v4_tethered_iface);
- /* xlat not support for 2st tethered iface */
- if (IPACM_OffloadManager::num_offload_v4_tethered_iface > 1)
- {
- IPACMDBG_H("Not support 2st downstream iface %s for xlat, cur: %d\n", dev_name,
- IPACM_OffloadManager::num_offload_v4_tethered_iface);
- return;
- }
- }
-
- IPACMDBG_H(" support downstream iface %s, cur %d\n", dev_name,
- IPACM_OffloadManager::num_offload_v4_tethered_iface);
-#endif
if (data->prefix.iptype < IPA_IP_MAX && is_downstream_set[data->prefix.iptype] == false)
{
IPACMDBG_H("Add downstream for IP iptype %d\n", data->prefix.iptype);
@@ -1905,6 +1887,25 @@
ret = handle_uplink_filter_rule(ext_prop, iptype, xlat_mux_id);
modem_ul_v6_set = true;
} else if (iptype ==IPA_IP_v4 && modem_ul_v4_set == false) {
+#ifdef FEATURE_IPA_ANDROID
+ if (IPACM_Wan::isXlat())
+ {
+ /* indicate v4-offload */
+ IPACM_OffloadManager::num_offload_v4_tethered_iface++;
+ IPACMDBG_H("in xlat: update num_offload_v4_tethered_iface %d\n", IPACM_OffloadManager::num_offload_v4_tethered_iface);
+
+ /* xlat not support for 2st tethered iface */
+ if (IPACM_OffloadManager::num_offload_v4_tethered_iface > 1)
+ {
+ IPACMDBG_H("Not support 2st downstream iface %s for xlat, cur: %d\n", dev_name,
+ IPACM_OffloadManager::num_offload_v4_tethered_iface);
+ return IPACM_FAILURE;
+ }
+ }
+
+ IPACMDBG_H(" support downstream iface %s, cur %d\n", dev_name,
+ IPACM_OffloadManager::num_offload_v4_tethered_iface);
+#endif
/* add MTU rules for ipv4 */
handle_private_subnet_android(IPA_IP_v4);