Merge "IPACM: call ioctl IPA_IOC_PUT_RT_TBL"
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index 17d24a3..29ce787 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -112,6 +112,7 @@
{
iface_table = NULL;
alg_table = NULL;
+ pNatIfaces = NULL;
memset(&ipa_client_rm_map_tbl, 0, sizeof(ipa_client_rm_map_tbl));
memset(&ipa_rm_tbl, 0, sizeof(ipa_rm_tbl));
ipa_rm_a2_check=0;
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index d6ad9a5..ef5e0a0 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -83,6 +83,11 @@
case IPA_BRIDGE_LINK_UP_EVENT:
IPACMDBG_H(" Save the bridge0 mac info in IPACM_cfg \n");
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data_all->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_BRIDGE_LINK_UP_EVENT: not supported iface id: %d\n", data_all->if_index);
+ break;
+ }
/* check if iface is bridge interface*/
if (strcmp(IPACM_Iface::ipacmcfg->ipa_virtual_iface_name, IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name) == 0)
{
@@ -98,6 +103,11 @@
case IPA_LINK_UP_EVENT:
IPACMDBG_H("Recieved IPA_LINK_UP_EVENT event: link up %d: \n", evt_data->if_index);
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(evt_data->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_LINK_UP_EVENT: not supported iface id: %d\n", evt_data->if_index);
+ break;
+ }
/* LTE-backhaul */
if(IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat == EMBMS_IF)
{
@@ -115,6 +125,11 @@
case IPA_USB_LINK_UP_EVENT:
IPACMDBG_H("Recieved IPA_USB_LINK_UP_EVENT event: link up %d: \n", evt_data->if_index);
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(evt_data->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_USB_LINK_UP_EVENT: not supported iface id: %d\n", evt_data->if_index);
+ break;
+ }
/* check if it's WAN_IF */
if(IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat == WAN_IF)
{
@@ -134,6 +149,11 @@
case IPA_WLAN_AP_LINK_UP_EVENT:
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(evt_data->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_WLAN_AP_LINK_UP_EVENT: not supported iface id: %d\n", evt_data->if_index);
+ break;
+ }
/* change iface category from unknown to WLAN_IF */
if(IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat == UNKNOWN_IF)
{
@@ -151,6 +171,11 @@
case IPA_WLAN_STA_LINK_UP_EVENT:
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(StaData->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_WLAN_STA_LINK_UP_EVENT: not supported iface id: %d\n", StaData->if_index);
+ break;
+ }
/* change iface category from unknown to WAN_IF */
if(IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat == UNKNOWN_IF)
{
@@ -175,6 +200,11 @@
/* Add new instance open for eMBMS iface and wan iface */
case IPA_WAN_EMBMS_LINK_UP_EVENT:
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(evt_data->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_WAN_EMBMS_LINK_UP_EVENT: not supported iface id: %d\n", evt_data->if_index);
+ break;
+ }
/* change iface category from unknown to EMBMS_IF */
if ((IPACM_Iface::ipacmcfg->ipacm_odu_enable == true) && (IPACM_Iface::ipacmcfg->ipacm_odu_embms_enable == true))
{
@@ -250,6 +280,7 @@
#endif
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, lan);
IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, lan);
+ /* IPA_LAN_DELETE_SELF should be always last */
IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, lan);
IPACMDBG_H("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", lan->dev_name, lan->ipa_if_num);
registr(ipa_interface_index, lan);
@@ -272,6 +303,7 @@
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN_V6, ETH);
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, ETH);
IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, ETH);
+ /* IPA_LAN_DELETE_SELF should be always last */
IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, ETH);
IPACMDBG_H("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", ETH->dev_name, ETH->ipa_if_num);
registr(ipa_interface_index, ETH);
@@ -297,6 +329,7 @@
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN_V6, odu);
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, odu);
IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, odu);
+ /* IPA_LAN_DELETE_SELF should be always last */
IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, odu);
IPACMDBG_H("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", odu->dev_name, odu->ipa_if_num);
registr(ipa_interface_index, odu);
@@ -312,6 +345,7 @@
IPACM_EvtDispatcher::registr(IPA_SW_ROUTING_ENABLE, odu);
IPACM_EvtDispatcher::registr(IPA_SW_ROUTING_DISABLE, odu);
IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, odu);
+ /* IPA_LAN_DELETE_SELF should be always last */
IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, odu);
IPACMDBG_H("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", odu->dev_name, odu->ipa_if_num);
registr(ipa_interface_index, odu);
@@ -352,17 +386,18 @@
#endif
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, wl);
IPACM_EvtDispatcher::registr(IPA_WLAN_LINK_DOWN_EVENT, wl);
- IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, wl);
#ifndef FEATURE_IPA_ANDROID
IPACM_EvtDispatcher::registr(IPA_WLAN_SWITCH_TO_SCC, wl);
IPACM_EvtDispatcher::registr(IPA_WLAN_SWITCH_TO_MCC, wl);
#else
IPACM_EvtDispatcher::registr(IPA_TETHERING_STATS_UPDATE_EVENT, wl);
#endif
+ /* IPA_LAN_DELETE_SELF should be always last */
+ IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, wl);
IPACMDBG_H("ipa_WLAN (%s):ipa_index (%d) instance open/registr ok\n", wl->dev_name, wl->ipa_if_num);
registr(ipa_interface_index, wl);
/* solve the new_addr comes earlier issue */
- IPACM_Iface::iface_addr_query(if_index);
+ IPACM_Iface::iface_addr_query(if_index);
}
break;
diff --git a/ipacm/src/IPACM_Neighbor.cpp b/ipacm/src/IPACM_Neighbor.cpp
index 6a49502..b4587d3 100644
--- a/ipacm/src/IPACM_Neighbor.cpp
+++ b/ipacm/src/IPACM_Neighbor.cpp
@@ -71,6 +71,11 @@
{
ipacm_event_data_wlan_ex *data = (ipacm_event_data_wlan_ex *)param;
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data->if_index);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("IPA_WLAN_CLIENT_ADD_EVENT_EX: not supported iface id: %d\n", data->if_index);
+ break;
+ }
uint8_t client_mac_addr[6];
IPACMDBG_H("Received IPA_WLAN_CLIENT_ADD_EVENT\n");
@@ -132,9 +137,14 @@
IPACM_EvtDispatcher::PostEvt(&evt_data);
/* ask for replaced iface name*/
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data_all->if_index);
- IPACMDBG_H("Posted event %d, with %s for ipv4 client re-connect\n",
- evt_data.event,
- IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("not supported iface id: %d\n", data_all->if_index);
+ } else {
+ IPACMDBG_H("Posted event %d, with %s for ipv4 client re-connect\n",
+ evt_data.event,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ }
}
}
break;
@@ -156,7 +166,11 @@
ipacm_event_data_all *data = (ipacm_event_data_all *)param;
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data->if_index);
-
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("not supported iface id: %d\n", data->if_index);
+ break;
+ }
if (data->iptype == IPA_IP_v4)
{
if (data->ipv4_addr != 0) /* not 0.0.0.0 */
@@ -224,9 +238,15 @@
/* ask for replaced iface name*/
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data_all->if_index);
- IPACMDBG_H("Posted event %d, with %s for ipv4\n",
- evt_data.event,
- IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("not supported iface id: %d\n", data_all->if_index);
+ } else {
+ IPACMDBG_H("Posted event %d,\
+ with %s for ipv4\n",
+ evt_data.event,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ }
break;
}
}
@@ -385,9 +405,15 @@
IPACM_EvtDispatcher::PostEvt(&evt_data);
/* ask for replaced iface name*/
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data_all->if_index);
- IPACMDBG_H("Posted event %d, with %s for ipv6\n",
- evt_data.event,
- IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("not supported iface id: %d\n", data_all->if_index);
+ } else {
+ IPACMDBG_H("Posted event %d,\
+ with %s for ipv6\n",
+ evt_data.event,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ }
break;
};
}
@@ -470,9 +496,15 @@
IPACM_EvtDispatcher::PostEvt(&evt_data);
/* ask for replaced iface name*/
ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data_all->if_index);
- IPACMDBG_H("Posted event %d, with %s for ipv4 client re-connect\n",
- evt_data.event,
- IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ /* check for failure return */
+ if (IPACM_FAILURE == ipa_interface_index) {
+ IPACMERR("not supported iface id: %d\n", data_all->if_index);
+ } else {
+ IPACMDBG_H("Posted event %d,\
+ with %s for ipv4 client re-connect\n",
+ evt_data.event,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name);
+ }
}
}
/* delete cache neighbor entry */