ipacm: not support xlat on 2st tethered iface
For current andorid limitation, andorid won't
support 2st tethered interface have ipv6 offload
, therefore make the change on offload manager
to block xlat offload on 2st tethered iface.
Change-Id: Id20fcc73172705b0d4f90452ec64da045d764d61
diff --git a/ipacm/inc/IPACM_OffloadManager.h b/ipacm/inc/IPACM_OffloadManager.h
index 88a411b..8ac904f 100644
--- a/ipacm/inc/IPACM_OffloadManager.h
+++ b/ipacm/inc/IPACM_OffloadManager.h
@@ -86,7 +86,7 @@
virtual RET getStats(const char * /* upstream */, bool /* reset */,
OffloadStatistics& /* ret */);
- static IPACM_OffloadManager *pInstance; //sky
+ static IPACM_OffloadManager *pInstance;
IpaEventListener *elrInstance;
@@ -96,6 +96,8 @@
bool push_framework_event(const char * if_name, _ipacm_offload_prefix prefix);
+ static int num_offload_v4_tethered_iface;
+
private:
std::list<std::string> valid_ifaces;
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index 1b917c6..be28fe0 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -249,6 +249,7 @@
static bool embms_is_on;
static bool backhaul_is_wan_bridge;
+ static bool is_xlat;
static bool isWan_Bridge_Mode()
{
@@ -260,6 +261,11 @@
static int ipa_if_num_tether_v4[IPA_MAX_IFACE_ENTRIES];
static uint32_t ipa_if_num_tether_v6_total;
static int ipa_if_num_tether_v6[IPA_MAX_IFACE_ENTRIES];
+
+ static bool isXlat()
+ {
+ return is_xlat;
+ }
#endif
private:
@@ -314,7 +320,7 @@
int header_name_count;
uint32_t num_wan_client;
uint8_t invalid_mac[IPA_MAC_ADDR_SIZE];
- bool is_xlat;
+ bool is_xlat_local;
/* update network stats for CNE */
int ipa_network_stats_fd;
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 827839b..ad3e5ff 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -750,6 +750,21 @@
if (ipa_interface_index == ipa_if_num)
{
IPACMDBG_H("Received IPA_DOWNSTREAM_ADD event.\n");
+#ifdef FEATURE_IPA_ANDROID
+ /* indicate v4-offload */
+ IPACM_OffloadManager::num_offload_v4_tethered_iface++;
+
+ /* xlat not support for 2st tethered iface */
+ if (IPACM_Wan::isXlat() && (data->prefix.iptype == IPA_IP_v4) && (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);
@@ -1205,6 +1220,14 @@
return IPACM_FAILURE;
}
+#ifdef FEATURE_IPA_ANDROID
+ /* indicate v4-offload remove */
+ if (IPACM_Wan::isXlat() && (IPACM_OffloadManager::num_offload_v4_tethered_iface > 0)) {
+ IPACM_OffloadManager::num_offload_v4_tethered_iface--;
+ IPACMDBG_H("num_offload_v4_tethered_iface %d\n", IPACM_OffloadManager::num_offload_v4_tethered_iface);
+ }
+#endif
+
if(is_sta_mode == false && modem_ul_v4_set == true)
{
if (num_wan_ul_fl_rule_v4 > MAX_WAN_UL_FILTER_RULES)
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index 1359d49..6accd70 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -51,6 +51,7 @@
/* NatApp class Implementation */
IPACM_OffloadManager *IPACM_OffloadManager::pInstance = NULL;
+int IPACM_OffloadManager::num_offload_v4_tethered_iface = 0;
IPACM_OffloadManager::IPACM_OffloadManager()
{
@@ -273,8 +274,8 @@
if(i == MAX_EVENT_CACHE - 1)
{
IPACMDBG_H(" run out of event cache (%d)\n", i);
- return FAIL_HARDWARE;
- }
+ return FAIL_HARDWARE;
+ }
}
return SUCCESS;
@@ -566,6 +567,7 @@
memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache));
latest_cache_index = 0;
valid_ifaces.clear();
+ IPACM_OffloadManager::num_offload_v4_tethered_iface = 0;
return result;
}
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 278f9ac..edd546d 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -77,6 +77,7 @@
bool IPACM_Wan::embms_is_on = false;
bool IPACM_Wan::backhaul_is_wan_bridge = false;
+bool IPACM_Wan::is_xlat = false;
uint32_t IPACM_Wan::backhaul_ipv6_prefix[2];
@@ -132,7 +133,7 @@
header_name_count = 0;
memset(invalid_mac, 0, sizeof(invalid_mac));
- is_xlat = false;
+ is_xlat_local = false;
hdr_hdl_dummy_v6 = 0;
hdr_proc_hdl_dummy_v6 = 0;
is_default_gateway = false;
@@ -565,9 +566,9 @@
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data->if_index);
if ((ipa_interface_index == ipa_if_num) && (m_is_sta_mode == Q6_WAN))
{
- is_xlat = true;
+ is_xlat_local = true;
IPACMDBG_H("WAN-LTE (%s) link up, iface: %d is_xlat: %d\n",
- IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name,data->if_index, is_xlat);
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name,data->if_index, is_xlat_local);
}
break;
}
@@ -962,7 +963,7 @@
handle_sta_header_add_evt();
handle_route_add_evt(data->iptype);
/* Add IPv6 routing table if XLAT is enabled */
- if(is_xlat && (m_is_sta_mode == Q6_WAN) && (active_v6 == false))
+ if(is_xlat_local && (m_is_sta_mode == Q6_WAN) && (active_v6 == false))
{
IPACMDBG_H("XLAT enabled: adding IPv6 routing table dev (%s)\n", dev_name);
handle_route_add_evt(IPA_IP_v6);
@@ -1051,7 +1052,7 @@
install_wan_filtering_rule(false);
handle_route_del_evt_ex(IPA_IP_v4);
- if(is_xlat && active_v6 == true)
+ if(is_xlat_local && active_v6 == true)
{
IPACMDBG_H("XLAT enabled: Delete IPv6 routing table dev (%s)\n", dev_name);
del_wan_firewall_rule(IPA_IP_v6);
@@ -1615,14 +1616,17 @@
wanup_data->ifname, wanup_data->ipv4_addr, wanup_data->is_sta);
memset(&evt_data, 0, sizeof(evt_data));
+ /* set backhaul type as xlat */
+ IPACM_Wan::is_xlat = is_xlat_local;
+
/* send xlat configuration for installing uplink rules */
- if(is_xlat && (m_is_sta_mode == Q6_WAN))
+ if(IPACM_Wan::is_xlat && (m_is_sta_mode == Q6_WAN))
{
IPACM_Wan::xlat_mux_id = ext_prop->ext[0].mux_id;
wanup_data->xlat_mux_id = IPACM_Wan::xlat_mux_id;
IPACMDBG_H("Set xlat configuraiton with below information:\n");
IPACMDBG_H("xlat_enabled: %d xlat_mux_id: %d \n",
- is_xlat, xlat_mux_id);
+ IPACM_Wan::is_xlat, xlat_mux_id);
}
else
{
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 427aef3..25b25fd 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -561,6 +561,21 @@
if(ipa_interface_index == ipa_if_num)
{
IPACMDBG_H("Received IPA_DOWNSTREAM_ADD event.\n");
+#ifdef FEATURE_IPA_ANDROID
+ /* indicate v4-offload */
+ IPACM_OffloadManager::num_offload_v4_tethered_iface++;
+
+ /* xlat not support for 2st tethered iface sky */
+ if (IPACM_Wan::isXlat() && (data->prefix.iptype == IPA_IP_v4) && (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);