diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2015-07-16 17:55:49 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2015-07-16 18:07:11 -0700 |
commit | db9914321f0ddaddf67e14b12b8fd6271baca805 (patch) | |
tree | db2ee73f67eec05fa54834f76c49a949f49f051d | |
parent | d5611c71c1d965ada3567dee743cf910331bccfe (diff) | |
download | ipacfg-mgr-db9914321f0ddaddf67e14b12b8fd6271baca805.tar.gz |
IPACM: Handle AF_BRIDGE netlink message
AF_BRIGE family netlink message should be processed
for LE targets. It is used by CPE interface while
device is booting with cable connected. But it should
be ignored in MSM target to avoid fake USB interface
down netlink message.
Change-Id: Iafd1f06819cbc010415368e0c919cd4d43e274e0
-rw-r--r-- | ipacm/src/IPACM_IfaceManager.cpp | 8 | ||||
-rw-r--r-- | ipacm/src/IPACM_Netlink.cpp | 29 |
2 files changed, 21 insertions, 16 deletions
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp index c8eb2c9..03233b5 100644 --- a/ipacm/src/IPACM_IfaceManager.cpp +++ b/ipacm/src/IPACM_IfaceManager.cpp @@ -267,7 +267,7 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param) { if(IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == true) { - IPACMDBG("Creating ODU interface in router mode\n"); + IPACMDBG_H("Creating ODU interface in router mode\n"); IPACM_Lan *odu = new IPACM_Lan(ipa_interface_index); IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, odu); IPACM_EvtDispatcher::registr(IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT, odu); @@ -289,14 +289,14 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param) IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, odu); IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, odu); IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, odu); - IPACMDBG("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", odu->dev_name, odu->ipa_if_num); + 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); /* solve the new_addr comes earlier issue */ IPACM_Iface::iface_addr_query(if_index); } else { - IPACMDBG("Creating ODU interface in bridge mode\n"); + IPACMDBG_H("Creating ODU interface in bridge mode\n"); IPACM_Lan *odu = new IPACM_Lan(ipa_interface_index); IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, odu); IPACM_EvtDispatcher::registr(IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT, odu); @@ -304,7 +304,7 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param) IPACM_EvtDispatcher::registr(IPA_SW_ROUTING_DISABLE, odu); IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, odu); IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, odu); - IPACMDBG("ipa_LAN (%s):ipa_index (%d) instance open/registr ok\n", odu->dev_name, odu->ipa_if_num); + 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); /* solve the new_addr comes earlier issue */ IPACM_Iface::iface_addr_query(if_index); diff --git a/ipacm/src/IPACM_Netlink.cpp b/ipacm/src/IPACM_Netlink.cpp index 13b1d6e..3dfc514 100644 --- a/ipacm/src/IPACM_Netlink.cpp +++ b/ipacm/src/IPACM_Netlink.cpp @@ -639,13 +639,16 @@ static int ipa_nl_decode_nlmsg IPACMDBG("RTM_NEWLINK, ifi_flags:%d\n", msg_ptr->nl_link_info.metainfo.ifi_flags); IPACMDBG("RTM_NEWLINK, ifi_index:%d\n", msg_ptr->nl_link_info.metainfo.ifi_index); IPACMDBG("RTM_NEWLINK, family:%d\n", msg_ptr->nl_link_info.metainfo.ifi_family); - + /* RTM_NEWLINK event with AF_BRIDGE family should be ignored in Android + but this should be processed in case of MDM for Ehernet interface. + */ +#ifdef FEATURE_IPA_ANDROID if (msg_ptr->nl_link_info.metainfo.ifi_family == AF_BRIDGE) { IPACMERR(" ignore this RTM_NEWLINK msg \n"); return IPACM_SUCCESS; } - +#endif if(IFF_UP & msg_ptr->nl_link_info.metainfo.ifi_change) { IPACMDBG("GOT useful newlink event\n"); @@ -707,7 +710,7 @@ static int ipa_nl_decode_nlmsg IPACMERR("Error while getting interface name\n"); return IPACM_FAILURE; } - IPACMDBG("Got a usb link_up event (Interface %s, %d) \n", dev_name, msg_ptr->nl_link_info.metainfo.ifi_index); + IPACMDBG("Got a usb link_up event (Interface %s, %d) \n", dev_name, msg_ptr->nl_link_info.metainfo.ifi_index); /*-------------------------------------------------------------------------- Post LAN iface (ECM) link up event @@ -715,7 +718,7 @@ static int ipa_nl_decode_nlmsg evt_data.event = IPA_USB_LINK_UP_EVENT; evt_data.evt_data = data_fid; IPACM_EvtDispatcher::PostEvt(&evt_data); - IPACMDBG("Posting usb IPA_LINK_UP_EVENT with if index: %d\n", + IPACMDBG_H("Posting usb IPA_LINK_UP_EVENT with if index: %d\n", data_fid->if_index); } else if(!(msg_ptr->nl_link_info.metainfo.ifi_flags & IFF_LOWER_UP)) @@ -734,17 +737,16 @@ static int ipa_nl_decode_nlmsg IPACMERR("Error while getting interface name\n"); return IPACM_FAILURE; } - IPACMDBG_H("Got a usb link_down event (Interface %s) \n", dev_name); + IPACMDBG_H("Got a usb link_down event (Interface %s) \n", dev_name); - /*-------------------------------------------------------------------------- - Post LAN iface (ECM) link down event - ---------------------------------------------------------------------------*/ - evt_data.event = IPA_LINK_DOWN_EVENT; + /*-------------------------------------------------------------------------- + Post LAN iface (ECM) link down event + ---------------------------------------------------------------------------*/ + evt_data.event = IPA_LINK_DOWN_EVENT; evt_data.evt_data = data_fid; IPACM_EvtDispatcher::PostEvt(&evt_data); IPACMDBG_H("Posting usb IPA_LINK_DOWN_EVENT with if index: %d\n", data_fid->if_index); - } } break; @@ -766,13 +768,16 @@ static int ipa_nl_decode_nlmsg IPACMDBG("RTM_DELLINK, ifi_flags:%d\n", msg_ptr->nl_link_info.metainfo.ifi_flags); IPACMDBG("RTM_DELLINK, ifi_index:%d\n", msg_ptr->nl_link_info.metainfo.ifi_index); IPACMDBG("RTM_DELLINK, family:%d\n", msg_ptr->nl_link_info.metainfo.ifi_family); - + /* RTM_NEWLINK event with AF_BRIDGE family should be ignored in Android + but this should be processed in case of MDM for Ehernet interface. + */ +#ifdef FEATURE_IPA_ANDROID if (msg_ptr->nl_link_info.metainfo.ifi_family == AF_BRIDGE) { IPACMERR(" ignore this RTM_DELLINK msg \n"); return IPACM_SUCCESS; } - +#endif ret_val = ipa_get_if_name(dev_name, msg_ptr->nl_link_info.metainfo.ifi_index); if(ret_val != IPACM_SUCCESS) { |