Snap for 5180536 from 318d13f8bce5b5ceb1a6fc9cd6392ee3ef760217 to pi-platform-release Change-Id: I589a82f35aa3260e8ed313b69c5274ff5abe9e50
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 @@ 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 2e18f51..a562613 100644 --- a/ipacm/inc/IPACM_Iface.h +++ b/ipacm/inc/IPACM_Iface.h
@@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2016, 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 @@ -59,7 +59,7 @@ #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 @@ -144,6 +144,7 @@ /* software routing disable */ virtual int handle_software_routing_disable(void); + void delete_iface(void); private:
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 @@ 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 @@ #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 @@ __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 e24f7d9..468f9ad 100644 --- a/ipacm/src/IPACM_Iface.cpp +++ b/ipacm/src/IPACM_Iface.cpp
@@ -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 @@ -850,6 +850,20 @@ 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 @@ /* 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) { @@ -1026,3 +1041,10 @@ return; } + +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; +}
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp index 85033a3..248bb78 100644 --- a/ipacm/src/IPACM_IfaceManager.cpp +++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2016, 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 @@ -257,6 +257,12 @@ { IPACMDBG_H("Creating Lan interface\n"); IPACM_Lan *lan = new IPACM_Lan(ipa_interface_index); + if (lan->rx_prop == NULL && lan->tx_prop == NULL) + { + /* close the netdev instance if IPA not support*/ + lan->delete_iface(); + return IPACM_FAILURE; + } IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, lan); //IPACM_EvtDispatcher::registr(IPA_ROUTE_ADD_EVENT, lan); //IPACM_EvtDispatcher::registr(IPA_ROUTE_DEL_EVENT, lan); @@ -365,6 +371,14 @@ { IPACMDBG_H("Creating WLan interface\n"); IPACM_Wlan *wl = new IPACM_Wlan(ipa_interface_index); + if (wl->rx_prop == NULL && wl->tx_prop == NULL) + { + /* reset the AP-iface category to unknown */ + IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat = UNKNOWN_IF; + /* close the netdev instance if IPA not support*/ + wl->delete_iface(); + return IPACM_FAILURE; + } IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, wl); IPACM_EvtDispatcher::registr(IPA_ROUTE_DEL_EVENT, wl); IPACM_EvtDispatcher::registr(IPA_WLAN_CLIENT_ADD_EVENT, wl); @@ -403,6 +417,9 @@ #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); @@ -421,6 +438,14 @@ if(is_sta_mode == WLAN_WAN) { w = new IPACM_Wan(ipa_interface_index, is_sta_mode, param->mac_addr); + if (w->rx_prop == NULL && w->tx_prop == NULL) + { + /* reset the AP-iface category to unknown */ + IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat = UNKNOWN_IF; + /* close the netdev instance if IPA not support*/ + w->delete_iface(); + return IPACM_FAILURE; + } } else { @@ -452,6 +477,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 5efe20f..d9a9f4b 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -366,16 +366,16 @@ 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); @@ -573,7 +573,7 @@ RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */) { wan_ioctl_set_data_quota quota; - int fd = -1,rc = 0; + int fd = -1, rc = 0, err_type = 0; if ((fd = open(DEVICE_NAME, O_RDWR)) < 0) { @@ -597,9 +597,10 @@ if(rc != 0) { + err_type = errno; close(fd); - IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s rc: %d\n", strerror(errno),rc); - if (errno == ENODEV) { + 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; } @@ -672,11 +673,11 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 090aee2..b787bad 100644 --- a/ipacm/src/IPACM_Wlan.cpp +++ b/ipacm/src/IPACM_Wlan.cpp
@@ -49,7 +49,9 @@ #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; @@ -133,6 +135,7 @@ { IPACM_EvtDispatcher::deregistr(this); IPACM_IfaceManager::deregistr(this); + IPACM_Wlan::num_wlan_ap_iface--; return; } @@ -148,6 +151,9 @@ 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) { @@ -196,7 +202,6 @@ ipacm_event_data_fid *data = (ipacm_event_data_fid *)param; if(data->if_index == ipa_if_num) { - IPACM_Wlan::num_wlan_ap_iface--; IPACMDBG_H("Now the number of wlan AP iface is %d\n", IPACM_Wlan::num_wlan_ap_iface); IPACMDBG_H("Received IPA_LAN_DELETE_SELF event.\n"); @@ -383,7 +388,8 @@ 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 @@ 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 @@ 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 @@ 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)