From e543626ddd00a5819cf8697d70dce162ddf5c51f Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Thu, 19 Jul 2018 11:05:02 +0100 Subject: msm8996-common: Update IPACM * Tag: LA.UM.6.6.r1-09200-89xx.0 Change-Id: I53cfaae340eb31b1304984d4696ef8a6a8e567b3 --- data-ipa-cfg-mgr/ipacm/src/IPACM_Iface.cpp | 30 +++++++++++++ data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp | 2 + data-ipa-cfg-mgr/ipacm/src/IPACM_Wan.cpp | 69 +++++++++++++++++++++++++++++- data-ipa-cfg-mgr/ipacm/src/IPACM_Wlan.cpp | 2 + 4 files changed, 102 insertions(+), 1 deletion(-) (limited to 'data-ipa-cfg-mgr/ipacm/src') diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Iface.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Iface.cpp index db3aa0d..53d6686 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Iface.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Iface.cpp @@ -902,6 +902,36 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype) flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<rules[6]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); + + /* Add the ipv6 tcp 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_EXCEPTION; +#ifdef FEATURE_IPA_V3 + flt_rule_entry.rule.hashable = true; +#endif + 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; + + memcpy(&(m_pFilteringTable->rules[7]), &flt_rule_entry, + sizeof(struct ipa_flt_rule_add)); #endif if (m_filtering.AddFilteringRule(m_pFilteringTable) == false) { diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp index 0391fbe..8c57ca5 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp @@ -2869,8 +2869,10 @@ 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 } diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Wan.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Wan.cpp index e8610b2..f04f45b 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Wan.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Wan.cpp @@ -1709,6 +1709,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", @@ -1716,11 +1717,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", @@ -1728,6 +1731,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); @@ -1766,22 +1770,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; @@ -3751,8 +3759,56 @@ int IPACM_Wan::add_dft_filtering_rule(struct ipa_flt_rule_add *rules, int rule_o 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)); + + 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); + 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: @@ -4634,8 +4690,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"); @@ -4678,6 +4737,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]; @@ -4689,6 +4751,7 @@ int IPACM_Wan::handle_down_evt_ex() IPACMDBG_H("post_wan_down_tether_v4 iface(%d: %s)\n", i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } +#endif #endif if(IPACM_Wan::wan_up_v6) { @@ -4730,6 +4793,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]; @@ -4741,6 +4807,7 @@ int IPACM_Wan::handle_down_evt_ex() IPACMDBG_H("post_wan_down_tether_v6 iface(%d: %s)\n", i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } +#endif #endif if(IPACM_Wan::wan_up) { diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Wlan.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Wlan.cpp index eea2f00..7dc3695 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Wlan.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Wlan.cpp @@ -1734,8 +1734,10 @@ 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 } -- cgit v1.2.3