summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkylar Chang <chiaweic@codeaurora.org>2017-05-25 12:04:24 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-07-22 12:51:20 -0700
commitdce23103b4e93cbeb3804ed47db5a177f4d3a689 (patch)
tree808e3f83b7be41f959ae0ae6f6827338faeac43b
parent57c1cea0fbae5070864fff71edce30b8e5cc5bb0 (diff)
downloadipacfg-mgr-dce23103b4e93cbeb3804ed47db5a177f4d3a689.tar.gz
IPACM: handle the timing issue on upstream_del
When CNE send upstream_del event to IPACM after tethered iface down, WAN instance is unable to clean up its v4/v6 tethered list. Add the support to handle this timing issue. Change-Id: I7601c70749e0cd30ef951c99d2ea601ecc4c9201
-rw-r--r--ipacm/inc/IPACM_Wan.h60
-rw-r--r--ipacm/src/IPACM_Lan.cpp8
-rw-r--r--ipacm/src/IPACM_Wan.cpp50
-rw-r--r--ipacm/src/IPACM_Wlan.cpp8
4 files changed, 82 insertions, 44 deletions
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index 3ed58fe..fde97f6 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -107,7 +107,6 @@ public:
#ifdef FEATURE_IPACM_HAL
return wan_up;
#else
-
int i;
for (i=0; i < ipa_if_num_tether_v4_total;i++)
{
@@ -146,6 +145,65 @@ public:
#endif
}
+#ifdef FEATURE_IPA_ANDROID
+ static int delete_tether_iface(ipa_ip_type iptype, int ipa_if_num_tether)
+ {
+ int i, j;
+
+ if (iptype == IPA_IP_v4)
+ {
+ /* delete support tether ifaces to its array*/
+ for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++)
+ {
+ if(IPACM_Wan::ipa_if_num_tether_v4[i] == ipa_if_num_tether)
+ {
+ IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
+ break;
+ }
+ }
+ if(i == IPACM_Wan::ipa_if_num_tether_v4_total)
+ {
+ IPACMDBG_H("Not finding the tethered ipv4 client.\n");
+ return IPACM_FAILURE;
+ }
+ for(j = i+1; j < IPACM_Wan::ipa_if_num_tether_v4_total; j++)
+ {
+ IPACM_Wan::ipa_if_num_tether_v4[j-1] = IPACM_Wan::ipa_if_num_tether_v4[j];
+ }
+ IPACM_Wan::ipa_if_num_tether_v4_total--;
+ IPACMDBG_H("Now the total num of ipa_if_num_tether_v4_total is %d\n",
+ IPACM_Wan::ipa_if_num_tether_v4_total);
+ }
+ else
+ {
+ /* delete support tether ifaces to its array*/
+ for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++)
+ {
+ if(IPACM_Wan::ipa_if_num_tether_v6[i] == ipa_if_num_tether)
+ {
+ IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
+ break;
+ }
+ }
+ if(i == IPACM_Wan::ipa_if_num_tether_v6_total)
+ {
+ IPACMDBG_H("Not finding the tethered ipv6 client.\n");
+ return IPACM_FAILURE;
+ }
+ for(j = i+1; j < IPACM_Wan::ipa_if_num_tether_v6_total; j++)
+ {
+ IPACM_Wan::ipa_if_num_tether_v6[j-1] = IPACM_Wan::ipa_if_num_tether_v6[j];
+ }
+ IPACM_Wan::ipa_if_num_tether_v6_total--;
+ IPACMDBG_H("Now the total num of ipa_if_num_tether_v6_total is %d\n",
+ IPACM_Wan::ipa_if_num_tether_v6_total);
+ }
+ return IPACM_SUCCESS;
+ }
+#endif
+
static uint32_t getWANIP()
{
return curr_wan_ip;
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 2f561cc..cc9a4dc 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -2725,12 +2725,20 @@ int IPACM_Lan::handle_down_evt()
{
IPACMDBG_H("LAN IF goes down, backhaul type %d\n", IPACM_Wan::backhaul_is_sta_mode);
handle_wan_down(IPACM_Wan::backhaul_is_sta_mode);
+#ifdef FEATURE_IPA_ANDROID
+ /* Clean-up tethered-iface list */
+ IPACM_Wan::delete_tether_iface(IPA_IP_v4, ipa_if_num);
+#endif
}
if (IPACM_Wan::isWanUP_V6(ipa_if_num) && rx_prop != NULL)
{
IPACMDBG_H("LAN IF goes down, backhaul type %d\n", IPACM_Wan::backhaul_is_sta_mode);
handle_wan_down_v6(IPACM_Wan::backhaul_is_sta_mode);
+#ifdef FEATURE_IPA_ANDROID
+ /* Clean-up tethered-iface list */
+ IPACM_Wan::delete_tether_iface(IPA_IP_v6, ipa_if_num);
+#endif
}
/* delete default filter rules */
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 3cda91e..201ac8d 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -1705,12 +1705,12 @@ int IPACM_Wan::post_wan_up_tether_evt(ipa_ip_type iptype, int ipa_if_num_tether)
return IPACM_SUCCESS;
}
+
/* wan default route/filter rule configuration */
int IPACM_Wan::post_wan_down_tether_evt(ipa_ip_type iptype, int ipa_if_num_tether)
{
ipacm_cmd_q_data evt_data;
ipacm_event_iface_up_tehter *wandown_data;
- int i, j;
wandown_data = (ipacm_event_iface_up_tehter *)malloc(sizeof(ipacm_event_iface_up_tehter));
if (wandown_data == NULL)
@@ -1736,59 +1736,23 @@ int IPACM_Wan::post_wan_down_tether_evt(ipa_ip_type iptype, int ipa_if_num_tethe
if (iptype == IPA_IP_v4)
{
- evt_data.event = IPA_HANDLE_WAN_DOWN_TETHER;
- /* delete support tether ifaces to its array*/
- for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++)
- {
- if(IPACM_Wan::ipa_if_num_tether_v4[i] == ipa_if_num_tether)
- {
- IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
- IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
- break;
- }
- }
- if(i == IPACM_Wan::ipa_if_num_tether_v4_total)
+ if(delete_tether_iface(iptype, ipa_if_num_tether))
{
- IPACMDBG_H("Not finding the tether client.\n");
+ IPACMDBG_H("Not finding the tethered client on ipv4.\n");
free(wandown_data);
return IPACM_SUCCESS;
}
- for(j = i+1; j < IPACM_Wan::ipa_if_num_tether_v4_total; j++)
- {
- IPACM_Wan::ipa_if_num_tether_v4[j-1] = IPACM_Wan::ipa_if_num_tether_v4[j];
- }
- IPACM_Wan::ipa_if_num_tether_v4_total--;
- IPACMDBG_H("Now the total num of ipa_if_num_tether_v4_total is %d on wan-iface(%s)\n",
- IPACM_Wan::ipa_if_num_tether_v4_total,
- IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
+ evt_data.event = IPA_HANDLE_WAN_DOWN_TETHER;
}
else
{
- evt_data.event = IPA_HANDLE_WAN_DOWN_V6_TETHER;
- /* delete support tether ifaces to its array*/
- for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++)
- {
- if(IPACM_Wan::ipa_if_num_tether_v6[i] == ipa_if_num_tether)
- {
- IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
- IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
- break;
- }
- }
- if(i == IPACM_Wan::ipa_if_num_tether_v6_total)
+ if(delete_tether_iface(iptype, ipa_if_num_tether))
{
- IPACMDBG_H("Not finding the tether client.\n");
+ IPACMDBG_H("Not finding the tethered client on ipv6.\n");
free(wandown_data);
return IPACM_SUCCESS;
}
- for(j = i+1; j < IPACM_Wan::ipa_if_num_tether_v6_total; j++)
- {
- IPACM_Wan::ipa_if_num_tether_v6[j-1] = IPACM_Wan::ipa_if_num_tether_v6[j];
- }
- IPACM_Wan::ipa_if_num_tether_v6_total--;
- IPACMDBG_H("Now the total num of ipa_if_num_tether_v6_total is %d on wan-iface(%s)\n",
- IPACM_Wan::ipa_if_num_tether_v6_total,
- IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
+ evt_data.event = IPA_HANDLE_WAN_DOWN_V6_TETHER;
}
evt_data.evt_data = (void *)wandown_data;
IPACM_EvtDispatcher::PostEvt(&evt_data);
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 54a2e66..9188980 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -1697,12 +1697,20 @@ int IPACM_Wlan::handle_down_evt()
{
IPACMDBG_H("LAN IF goes down, backhaul type %d\n", IPACM_Wan::backhaul_is_sta_mode);
IPACM_Lan::handle_wan_down(IPACM_Wan::backhaul_is_sta_mode);
+#ifdef FEATURE_IPA_ANDROID
+ /* Clean-up tethered-iface list */
+ IPACM_Wan::delete_tether_iface(IPA_IP_v4, ipa_if_num);
+#endif
}
if (IPACM_Wan::isWanUP_V6(ipa_if_num) && rx_prop != NULL)
{
IPACMDBG_H("LAN IF goes down, backhaul type %d\n", IPACM_Wan::backhaul_is_sta_mode);
handle_wan_down_v6(IPACM_Wan::backhaul_is_sta_mode);
+#ifdef FEATURE_IPA_ANDROID
+ /* Clean-up tethered-iface list */
+ IPACM_Wan::delete_tether_iface(IPA_IP_v6, ipa_if_num);
+#endif
}
IPACMDBG_H("finished deleting wan filtering rules\n ");