diff options
author | Robin Peng <robinpeng@google.com> | 2018-12-19 15:27:04 +0800 |
---|---|---|
committer | Cyan_Hsieh <cyanhsieh@google.com> | 2018-12-24 14:18:05 +0800 |
commit | 540d8768a39dd74014866b1a81a60fefe5053710 (patch) | |
tree | 9d2f9b36f152996c46299dce2773f47dc109b0c8 | |
parent | ce02f0150343472caa230e7f6ff244c92ac98705 (diff) | |
parent | ada76e45c840024e231e6460f903dfc1f63ea6e0 (diff) | |
download | ipacfg-mgr-540d8768a39dd74014866b1a81a60fefe5053710.tar.gz |
Merge remote-tracking branch 'goog/qcom/release/LA.UM.7.8.9.C1.08.00.00.516.007'
Conflicts:
ipacm/src/IPACM_Iface.cpp
ipacm/src/IPACM_OffloadManager.cpp
Bug: 121228685
Change-Id: I8c74e755102e2d238379e6d1bc490ea15870616d
-rw-r--r-- | ipacm/inc/IPACM_Defs.h | 3 | ||||
-rw-r--r-- | ipacm/inc/IPACM_Iface.h | 2 | ||||
-rw-r--r-- | ipacm/inc/IPACM_OffloadManager.h | 4 | ||||
-rw-r--r-- | ipacm/inc/IPACM_Wan.h | 5 | ||||
-rw-r--r-- | ipacm/src/IPACM_Config.cpp | 1 | ||||
-rw-r--r-- | ipacm/src/IPACM_Iface.cpp | 23 | ||||
-rw-r--r-- | ipacm/src/IPACM_IfaceManager.cpp | 4 | ||||
-rw-r--r-- | ipacm/src/IPACM_Lan.cpp | 14 | ||||
-rw-r--r-- | ipacm/src/IPACM_Main.cpp | 11 | ||||
-rw-r--r-- | ipacm/src/IPACM_OffloadManager.cpp | 64 | ||||
-rw-r--r-- | ipacm/src/IPACM_Wan.cpp | 74 | ||||
-rw-r--r-- | ipacm/src/IPACM_Wlan.cpp | 43 |
12 files changed, 224 insertions, 24 deletions
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h index 149c03a..051184d 100644 --- a/ipacm/inc/IPACM_Defs.h +++ b/ipacm/inc/IPACM_Defs.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -195,6 +195,7 @@ typedef enum IPA_HANDLE_VLAN_CLIENT_INFO, /* ipacm_event_data_all */ IPA_HANDLE_VLAN_IFACE_INFO, /* ipacm_event_data_all */ #endif + IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE, IPA_LAN_DELETE_SELF, /* ipacm_event_data_fid */ IPACM_EVENT_MAX } ipa_cm_event_id; diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h index 8ff7450..a562613 100644 --- a/ipacm/inc/IPACM_Iface.h +++ b/ipacm/inc/IPACM_Iface.h @@ -59,7 +59,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define IPV4_DEFAULT_FILTERTING_RULES 3 #ifdef FEATURE_IPA_ANDROID -#define IPV6_DEFAULT_FILTERTING_RULES 7 +#define IPV6_DEFAULT_FILTERTING_RULES 8 #else #define IPV6_DEFAULT_FILTERTING_RULES 4 #endif diff --git a/ipacm/inc/IPACM_OffloadManager.h b/ipacm/inc/IPACM_OffloadManager.h index 4947a83..e5ab22f 100644 --- a/ipacm/inc/IPACM_OffloadManager.h +++ b/ipacm/inc/IPACM_OffloadManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -94,6 +94,8 @@ public: bool search_framwork_cache(char * interface_name); + bool push_framework_event(const char * if_name, _ipacm_offload_prefix prefix); + private: std::list<std::string> valid_ifaces; diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h index a4d0557..2049df3 100644 --- a/ipacm/inc/IPACM_Wan.h +++ b/ipacm/inc/IPACM_Wan.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2013, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -53,9 +53,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV4 2 #ifdef FEATURE_IPA_ANDROID -#define IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6 6 +#define IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6 7 #define IPA_V2_NUM_TCP_WAN_FILTER_RULE_IPV6 3 #define IPA_V2_NUM_MULTICAST_WAN_FILTER_RULE_IPV6 3 +#define IPA_V2_NUM_FRAG_WAN_FILTER_RULE_IPV6 1 #else #define IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6 3 #endif diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp index ad0cdd3..90d3647 100644 --- a/ipacm/src/IPACM_Config.cpp +++ b/ipacm/src/IPACM_Config.cpp @@ -106,6 +106,7 @@ const char *ipacm_event_name[] = { __stringify(IPA_ETH_BRIDGE_CLIENT_ADD), /* ipacm_event_eth_bridge*/ __stringify(IPA_ETH_BRIDGE_CLIENT_DEL), /* ipacm_event_eth_bridge*/ __stringify(IPA_ETH_BRIDGE_WLAN_SCC_MCC_SWITCH), /* ipacm_event_eth_bridge*/ + __stringify(IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE), /* ipacm_event_iface*/ __stringify(IPA_LAN_DELETE_SELF), /* ipacm_event_data_fid */ #ifdef FEATURE_L2TP __stringify(IPA_ADD_VLAN_IFACE), /* ipa_ioc_vlan_iface_info */ diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp index bee69ed..468f9ad 100644 --- a/ipacm/src/IPACM_Iface.cpp +++ b/ipacm/src/IPACM_Iface.cpp @@ -850,6 +850,20 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype) memcpy(&(m_pFilteringTable->rules[3]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); #ifdef FEATURE_IPA_ANDROID + /* Add the ipv6 tcp fragment filtering rule. */ + + IPACMDBG_H("Adding IPv6 TCP fragment filter rule\n"); + + flt_rule_entry.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_DST_ADDR); + + flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR; + flt_rule_entry.rule.attrib.u.v6.next_hdr = IPACM_FIREWALL_IPPROTO_TCP; + + flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_FRAGMENT; + + memcpy(&(m_pFilteringTable->rules[4]), &flt_rule_entry, + sizeof(struct ipa_flt_rule_add)); + IPACMDBG_H("Add TCP ctrl rules: total num %d\n", IPV6_DEFAULT_FILTERTING_RULES); memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add)); @@ -891,17 +905,18 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype) /* add TCP FIN rule*/ flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_FIN_SHIFT); flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_FIN_SHIFT); - memcpy(&(m_pFilteringTable->rules[4]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + memcpy(&(m_pFilteringTable->rules[5]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); /* add TCP SYN rule*/ flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_SYN_SHIFT); flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_SYN_SHIFT); - memcpy(&(m_pFilteringTable->rules[5]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + memcpy(&(m_pFilteringTable->rules[6]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); /* add TCP RST rule*/ flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_RST_SHIFT); flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_RST_SHIFT); - memcpy(&(m_pFilteringTable->rules[6]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + memcpy(&(m_pFilteringTable->rules[7]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + #endif if (m_filtering.AddFilteringRule(m_pFilteringTable) == false) { @@ -1032,4 +1047,4 @@ void IPACM_Iface::delete_iface(void) IPACMDBG_H("netdev (%s):ipa_index (%d) instance close \n", IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, ipa_if_num); delete this; -}
\ No newline at end of file +} diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp index e7660b1..248bb78 100644 --- a/ipacm/src/IPACM_IfaceManager.cpp +++ b/ipacm/src/IPACM_IfaceManager.cpp @@ -417,6 +417,9 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param) #else IPACM_EvtDispatcher::registr(IPA_TETHERING_STATS_UPDATE_EVENT, wl); #endif +#ifdef FEATURE_IPACM_HAL + IPACM_EvtDispatcher::registr(IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE, 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); @@ -474,6 +477,7 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param) IPACM_EvtDispatcher::registr(IPA_WLAN_SWITCH_TO_MCC, w); #ifdef FEATURE_IPACM_HAL IPACM_EvtDispatcher::registr(IPA_SSR_NOTICE, w); + IPACM_EvtDispatcher::registr(IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE, w); #endif #endif } diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp index 3a5a51a..fd06b1b 100644 --- a/ipacm/src/IPACM_Lan.cpp +++ b/ipacm/src/IPACM_Lan.cpp @@ -590,7 +590,8 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) if (data_wan_tether->is_sta == false) { ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4); - handle_wan_up_ex(ext_prop, IPA_IP_v4, 0); + handle_wan_up_ex(ext_prop, IPA_IP_v4, + IPACM_Wan::getXlat_Mux_Id()); } else { handle_wan_up(IPA_IP_v4); } @@ -772,7 +773,14 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) if (IPACM_Wan::backhaul_is_sta_mode == false) /* LTE */ { ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(data->prefix.iptype); - handle_wan_up_ex(ext_prop, data->prefix.iptype, 0); + if (data->prefix.iptype == IPA_IP_v4) + { + handle_wan_up_ex(ext_prop, data->prefix.iptype, + IPACM_Wan::getXlat_Mux_Id()); + } + else { + handle_wan_up_ex(ext_prop, data->prefix.iptype, 0); + } } else { handle_wan_up(data->prefix.iptype); /* STA */ } @@ -2905,9 +2913,11 @@ 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 +#ifndef FEATURE_IPACM_HAL /* Clean-up tethered-iface list */ IPACM_Wan::delete_tether_iface(IPA_IP_v4, ipa_if_num); #endif +#endif } if (IPACM_Wan::isWanUP_V6(ipa_if_num) && rx_prop != NULL) diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp index 34b2dda..1292d04 100644 --- a/ipacm/src/IPACM_Main.cpp +++ b/ipacm/src/IPACM_Main.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -730,6 +730,13 @@ void* ipa_driver_msg_notifier(void *param) OffloadMng->elrInstance->onOffloadSupportAvailable(); } continue; +#ifdef IPA_WLAN_FW_SSR_EVENT_MAX + case WLAN_FWR_SSR_BEFORE_SHUTDOWN: + IPACMDBG_H("Received WLAN_FWR_SSR_BEFORE_SHUTDOWN\n"); + evt_data.event = IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE; + evt_data.evt_data = NULL; + break; +#endif #endif #ifdef FEATURE_L2TP case ADD_VLAN_IFACE: @@ -1073,4 +1080,4 @@ int ipa_reset() IPACMDBG_H("send IPA_IOC_CLEANUP \n"); close(fd); return IPACM_SUCCESS; -}
\ No newline at end of file +} diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp index 571df8a..d9a9f4b 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp @@ -366,16 +366,16 @@ RET IPACM_OffloadManager::setUpstream(const char *upstream_name, const Prefix& g if(upstream_name == NULL) { if (default_gw_index == INVALID_IFACE) { + result = FAIL_INPUT_CHECK; for (index = 0; index < MAX_EVENT_CACHE; index++) { if (event_cache[index].valid == true && event_cache[index ].event == IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT) { event_cache[index].valid = false; - memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache)); - return SUCCESS; + result = SUCCESS; } } IPACMERR("no previous upstream set before\n"); - return FAIL_INPUT_CHECK; + return result; } if (gw_addr_v4.fam == V4 && upstream_v4_up == true) { IPACMDBG_H("clean upstream for ipv4-fam(%d) upstream_v4_up(%d)\n", gw_addr_v4.fam, upstream_v4_up); @@ -599,8 +599,9 @@ RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, ui { err_type = errno; close(fd); - IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s err_type: %d\n", strerror(errno), err_type); + IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s err_type: %d\n", strerror(err_type), err_type); if (err_type == ENODEV) { + IPACMDBG_H("Invalid argument.\n"); return FAIL_UNSUPPORTED; } else { @@ -672,11 +673,11 @@ int IPACM_OffloadManager::post_route_evt(enum ipa_ip_type iptype, int index, ipa IPACMDBG_H("IPV6 gateway: %08x:%08x:%08x:%08x \n", evt_data_route->ipv6_addr_gw[0], evt_data_route->ipv6_addr_gw[1], evt_data_route->ipv6_addr_gw[2], evt_data_route->ipv6_addr_gw[3]); #endif - if (event == WAN_UPSTREAM_ROUTE_ADD) { + if (event == IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT) { IPACMDBG_H("Received WAN_UPSTREAM_ROUTE_ADD: fid(%d) tether_fid(%d) ip-type(%d)\n", evt_data_route->if_index, evt_data_route->if_index_tether, evt_data_route->iptype); } - else if (event == WAN_UPSTREAM_ROUTE_DEL) { + else if (event == IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT) { IPACMDBG_H("Received WAN_UPSTREAM_ROUTE_DEL: fid(%d) tether_fid(%d) ip-type(%d)\n", evt_data_route->if_index, evt_data_route->if_index_tether, evt_data_route->iptype); @@ -875,3 +876,54 @@ int IPACM_OffloadManager::push_iface_up(const char * if_name, bool upstream) return IPACM_SUCCESS; } +bool IPACM_OffloadManager::push_framework_event(const char * if_name, _ipacm_offload_prefix prefix) +{ + bool ret = false; + + for(int i = 0; i < MAX_EVENT_CACHE ;i++) + { + if(event_cache[latest_cache_index].valid == false) + { + //do the copy + event_cache[latest_cache_index].valid = true; + event_cache[latest_cache_index].event = IPA_DOWNSTREAM_ADD; + memcpy(event_cache[latest_cache_index].dev_name, if_name, + sizeof(event_cache[latest_cache_index].dev_name)); + memcpy(&event_cache[latest_cache_index].prefix_cache, &prefix, + sizeof(event_cache[latest_cache_index].prefix_cache)); + + if (prefix.iptype == IPA_IP_v4) { + IPACMDBG_H("cache event(%d) subnet info v4Addr (%x) v4Mask (%x) dev(%s) on entry (%d)\n", + event_cache[latest_cache_index].event, + event_cache[latest_cache_index].prefix_cache.v4Addr, + event_cache[latest_cache_index].prefix_cache.v4Mask, + event_cache[latest_cache_index].dev_name, + latest_cache_index); + } else { + IPACMDBG_H("cache event (%d) v6Addr: %08x:%08x:%08x:%08x \n", + event_cache[latest_cache_index].event, + event_cache[latest_cache_index].prefix_cache.v6Addr[0], + event_cache[latest_cache_index].prefix_cache.v6Addr[1], + event_cache[latest_cache_index].prefix_cache.v6Addr[2], + event_cache[latest_cache_index].prefix_cache.v6Addr[3]); + IPACMDBG_H("subnet v6Mask: %08x:%08x:%08x:%08x dev(%s) on entry(%d),\n", + event_cache[latest_cache_index].prefix_cache.v6Mask[0], + event_cache[latest_cache_index].prefix_cache.v6Mask[1], + event_cache[latest_cache_index].prefix_cache.v6Mask[2], + event_cache[latest_cache_index].prefix_cache.v6Mask[3], + event_cache[latest_cache_index].dev_name, + latest_cache_index); + } + latest_cache_index = (latest_cache_index + 1)% MAX_EVENT_CACHE; + ret = true; + break; + } + latest_cache_index = (latest_cache_index + 1)% MAX_EVENT_CACHE; + if(i == MAX_EVENT_CACHE - 1) + { + IPACMDBG_H(" run out of event cache (%d)\n", i); + ret = false; + } + } + return ret; +} diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp index a902457..1a34388 100644 --- a/ipacm/src/IPACM_Wan.cpp +++ b/ipacm/src/IPACM_Wan.cpp @@ -1263,6 +1263,7 @@ void IPACM_Wan::event_callback(ipa_cm_event_id event, void *param) #ifdef FEATURE_IPACM_HAL /* WA for WLAN to clean up NAT instance during SSR */ case IPA_SSR_NOTICE: //sky + case IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE: IPACMDBG_H("Received IPA_SSR_NOTICE event.\n"); if(m_is_sta_mode == WLAN_WAN) { @@ -1713,6 +1714,7 @@ int IPACM_Wan::post_wan_up_tether_evt(ipa_ip_type iptype, int ipa_if_num_tether) if (iptype == IPA_IP_v4) { evt_data.event = IPA_HANDLE_WAN_UP_TETHER; +#ifndef FEATURE_IPACM_HAL /* Add support tether ifaces to its array*/ IPACM_Wan::ipa_if_num_tether_v4[IPACM_Wan::ipa_if_num_tether_v4_total] = ipa_if_num_tether; IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v4_total(%d) on wan_iface(%s)\n", @@ -1720,11 +1722,13 @@ int IPACM_Wan::post_wan_up_tether_evt(ipa_ip_type iptype, int ipa_if_num_tether) IPACM_Wan::ipa_if_num_tether_v4_total, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name); IPACM_Wan::ipa_if_num_tether_v4_total++; +#endif } else { evt_data.event = IPA_HANDLE_WAN_UP_V6_TETHER; memcpy(wanup_data->ipv6_prefix, ipv6_prefix, sizeof(wanup_data->ipv6_prefix)); +#ifndef FEATURE_IPACM_HAL /* Add support tether ifaces to its array*/ IPACM_Wan::ipa_if_num_tether_v6[IPACM_Wan::ipa_if_num_tether_v6_total] = ipa_if_num_tether; IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v6_total(%d) on wan_iface(%s)\n", @@ -1732,6 +1736,7 @@ int IPACM_Wan::post_wan_up_tether_evt(ipa_ip_type iptype, int ipa_if_num_tether) IPACM_Wan::ipa_if_num_tether_v6_total, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name); IPACM_Wan::ipa_if_num_tether_v6_total++; +#endif } evt_data.evt_data = (void *)wanup_data; IPACM_EvtDispatcher::PostEvt(&evt_data); @@ -1770,22 +1775,26 @@ int IPACM_Wan::post_wan_down_tether_evt(ipa_ip_type iptype, int ipa_if_num_tethe if (iptype == IPA_IP_v4) { +#ifndef FEATURE_IPACM_HAL if(delete_tether_iface(iptype, ipa_if_num_tether)) { IPACMDBG_H("Not finding the tethered client on ipv4.\n"); free(wandown_data); return IPACM_SUCCESS; } +#endif evt_data.event = IPA_HANDLE_WAN_DOWN_TETHER; } else { +#ifndef FEATURE_IPACM_HAL if(delete_tether_iface(iptype, ipa_if_num_tether)) { IPACMDBG_H("Not finding the tethered client on ipv6.\n"); free(wandown_data); return IPACM_SUCCESS; } +#endif evt_data.event = IPA_HANDLE_WAN_DOWN_V6_TETHER; } evt_data.evt_data = (void *)wandown_data; @@ -3755,13 +3764,63 @@ int IPACM_Wan::add_dft_filtering_rule(struct ipa_flt_rule_add *rules, int rule_o sizeof(flt_rule_entry.rule.eq_attrib)); memcpy(&(rules[rule_offset + 2]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + + /* Add the fragment filtering rule. */ + memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add)); + + flt_rule_entry.at_rear = true; + flt_rule_entry.flt_rule_hdl = -1; + flt_rule_entry.status = -1; + + flt_rule_entry.rule.retain_hdr = 1; + flt_rule_entry.rule.to_uc = 0; + flt_rule_entry.rule.eq_attrib_type = 1; + flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING; +#ifdef FEATURE_IPA_V3 + flt_rule_entry.rule.hashable = true; +#endif + flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx; + flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<1); + flt_rule_entry.rule.eq_attrib.protocol_eq_present = 1; + flt_rule_entry.rule.eq_attrib.protocol_eq = IPACM_FIREWALL_IPPROTO_TCP; + flt_rule_entry.rule.attrib.u.v6.next_hdr = (uint8_t)IPACM_FIREWALL_IPPROTO_TCP; + + /* Configuring fragment Filtering Rule */ + memcpy(&flt_rule_entry.rule.attrib, + &rx_prop->rx[0].attrib, + sizeof(flt_rule_entry.rule.attrib)); + /* remove meta data mask since we only install default flt rules once for all modem PDN*/ + flt_rule_entry.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA); + + flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_FRAGMENT; + + memset(&flt_eq, 0, sizeof(flt_eq)); + memcpy(&flt_eq.attrib, &flt_rule_entry.rule.attrib, sizeof(flt_eq.attrib)); + flt_eq.ip = iptype; + if(0 != ioctl(m_fd_ipa, IPA_IOC_GENERATE_FLT_EQ, &flt_eq)) + { + IPACMERR("Failed to get eq_attrib\n"); + res = IPACM_FAILURE; + goto fail; + } + + memcpy(&flt_rule_entry.rule.eq_attrib, + &flt_eq.eq_attrib, + sizeof(flt_rule_entry.rule.eq_attrib)); + + memcpy(&(rules[rule_offset + 3]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + #ifdef FEATURE_IPA_ANDROID IPACM_Wan::num_v6_flt_rule += IPA_V2_NUM_MULTICAST_WAN_FILTER_RULE_IPV6; IPACMDBG_H("Constructed %d default filtering rules for ip type %d\n", IPA_V2_NUM_MULTICAST_WAN_FILTER_RULE_IPV6, iptype); #else IPACM_Wan::num_v6_flt_rule += IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6; - IPACMDBG_H("Constructed %d default filtering rules for ip type %d\n", IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6, iptype); + IPACMDBG_H("Constructed %d default filtering rules for ip type %d\n", + IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6, iptype); #endif + IPACM_Wan::num_v6_flt_rule += IPA_V2_NUM_FRAG_WAN_FILTER_RULE_IPV6; + IPACMDBG_H("Constructed %d default filtering rules for ip type %d\n", + IPA_V2_NUM_FRAG_WAN_FILTER_RULE_IPV6, iptype); } fail: @@ -4646,8 +4705,11 @@ fail: int IPACM_Wan::handle_down_evt_ex() { int res = IPACM_SUCCESS; - uint32_t i, tether_total; + uint32_t i; +#ifndef FEATURE_IPACM_HAL + uint32_t tether_total; int ipa_if_num_tether_tmp[IPA_MAX_IFACE_ENTRIES]; +#endif IPACMDBG_H(" wan handle_down_evt \n"); @@ -4690,6 +4752,9 @@ int IPACM_Wan::handle_down_evt_ex() handle_route_del_evt_ex(IPA_IP_v4); #ifdef FEATURE_IPA_ANDROID /* posting wan_down_tether for all lan clients */ +#ifdef FEATURE_IPACM_HAL + post_wan_down_tether_evt(IPA_IP_v4, 0); +#else for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++) { ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v4[i]; @@ -4702,6 +4767,7 @@ int IPACM_Wan::handle_down_evt_ex() i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } #endif +#endif if(IPACM_Wan::wan_up_v6) { IPACMDBG_H("modem v6-call still up(%s), not reset\n", IPACM_Wan::wan_up_dev_name); @@ -4742,6 +4808,9 @@ int IPACM_Wan::handle_down_evt_ex() handle_route_del_evt_ex(IPA_IP_v6); #ifdef FEATURE_IPA_ANDROID /* posting wan_down_tether for all lan clients */ +#ifdef FEATURE_IPACM_HAL + post_wan_down_tether_evt(IPA_IP_v6, 0); +#else for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++) { ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v6[i]; @@ -4754,6 +4823,7 @@ int IPACM_Wan::handle_down_evt_ex() i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } #endif +#endif if(IPACM_Wan::wan_up) { IPACMDBG_H("modem v4-call still up(%s), not reset\n", IPACM_Wan::wan_up_dev_name); diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp index 829416d..b787bad 100644 --- a/ipacm/src/IPACM_Wlan.cpp +++ b/ipacm/src/IPACM_Wlan.cpp @@ -49,7 +49,9 @@ Skylar Chang #include <IPACM_Lan.h> #include <IPACM_IfaceManager.h> #include <IPACM_ConntrackListener.h> - +#ifdef FEATURE_IPACM_HAL +#include "IPACM_OffloadManager.h" +#endif /* static member to store the number of total wifi clients within all APs*/ int IPACM_Wlan::total_num_wifi_clients = 0; @@ -149,6 +151,9 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param) int wlan_index; ipacm_ext_prop* ext_prop; ipacm_event_iface_up_tehter* data_wan_tether; +#ifdef FEATURE_IPACM_HAL + IPACM_OffloadManager* OffloadMng; +#endif switch (event) { @@ -383,7 +388,8 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param) if(data_wan_tether->is_sta == false) { ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4); - handle_wan_up_ex(ext_prop, IPA_IP_v4, 0); + handle_wan_up_ex(ext_prop, IPA_IP_v4, + IPACM_Wan::getXlat_Mux_Id()); } else { handle_wan_up(IPA_IP_v4); } @@ -577,7 +583,14 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param) if (IPACM_Wan::backhaul_is_sta_mode == false) /* LTE */ { ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(data->prefix.iptype); - handle_wan_up_ex(ext_prop, data->prefix.iptype, 0); + if (data->prefix.iptype == IPA_IP_v4) + { + handle_wan_up_ex(ext_prop, data->prefix.iptype, + IPACM_Wan::getXlat_Mux_Id()); + } + else { + handle_wan_up_ex(ext_prop, data->prefix.iptype, 0); + } } else { handle_wan_up(data->prefix.iptype); /* STA */ } @@ -933,6 +946,28 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param) IPACM_Iface::ipacmcfg->DelNatIfaces(dev_name); // delete NAT-iface } break; + case IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE: + { + IPACMDBG_H("Received IPA_WLAN_FWR_SSR_BEFORE_SHUTDOWN_NOTICE.\n"); + + /* internal push add_downstream event in cache */ + OffloadMng = IPACM_OffloadManager::GetInstance(); + if (OffloadMng == NULL) { + IPACMERR("failed to get IPACM_OffloadManager instance !\n"); + } else { + IPACMDBG_H("Update iface %s add_downstream cache events\n", dev_name); + if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX) + { + OffloadMng->push_framework_event(dev_name, prefix[IPA_IP_v4]); + } + else if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX) + { + OffloadMng->push_framework_event(dev_name, prefix[IPA_IP_v6]); + } + } + IPACM_Iface::ipacmcfg->DelNatIfaces(dev_name); // delete NAT-iface + } + break; #endif default: break; @@ -1754,9 +1789,11 @@ 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 +#ifndef FEATURE_IPACM_HAL /* Clean-up tethered-iface list */ IPACM_Wan::delete_tether_iface(IPA_IP_v4, ipa_if_num); #endif +#endif } if (IPACM_Wan::isWanUP_V6(ipa_if_num) && rx_prop != NULL) |