diff options
author | Michael Bestas <mkbestas@lineageos.org> | 2020-03-18 19:04:14 +0200 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-03-18 19:04:14 +0200 |
commit | 58f731cb1ba1c84ba5f241f73f0853d1c1d09e8a (patch) | |
tree | 49b24caf8ad1afb2979004efb4b6be2ba4d6d967 | |
parent | 109aa1e7c66501568cc685c1ad92342e3b1398c3 (diff) | |
parent | 34180a4f5db2746e99b3aa1dec3b9518c6877335 (diff) | |
download | android_vendor_qcom_opensource_data-ipa-cfg-mgr-lineage-17.1.tar.gz android_vendor_qcom_opensource_data-ipa-cfg-mgr-lineage-17.1.tar.bz2 android_vendor_qcom_opensource_data-ipa-cfg-mgr-lineage-17.1.zip |
Merge tag 'LA.UM.8.1.r1-14500-sm8150.0' of https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/data-ipa-cfg-mgr into lineage-17.1HEADlineage-17.1
"LA.UM.8.1.r1-14500-sm8150.0"
Change-Id: I5069878624b0329212960e53d328143e6dd5c4b0
-rw-r--r-- | ipacm/inc/IPACM_Iface.h | 4 | ||||
-rw-r--r-- | ipacm/inc/IPACM_Wan.h | 2 | ||||
-rw-r--r-- | ipacm/src/IPACM_Iface.cpp | 55 | ||||
-rw-r--r-- | ipacm/src/IPACM_Lan.cpp | 7 | ||||
-rw-r--r-- | ipacm/src/IPACM_Wan.cpp | 103 |
5 files changed, 10 insertions, 161 deletions
diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h index 55d9e99..35d12db 100644 --- a/ipacm/inc/IPACM_Iface.h +++ b/ipacm/inc/IPACM_Iface.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2020, 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 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define IPV4_DEFAULT_FILTERTING_RULES 3 #ifdef FEATURE_IPA_ANDROID -#define IPV6_DEFAULT_FILTERTING_RULES 8 +#define IPV6_DEFAULT_FILTERTING_RULES 5 #else #define IPV6_DEFAULT_FILTERTING_RULES 4 #endif diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h index 31949c5..4eb5547 100644 --- a/ipacm/inc/IPACM_Wan.h +++ b/ipacm/inc/IPACM_Wan.h @@ -645,8 +645,6 @@ private: int add_dft_filtering_rule(struct ipa_flt_rule_add* rules, int rule_offset, ipa_ip_type iptype); - int add_tcpv6_filtering_rule(struct ipa_flt_rule_add* rules, int rule_offset); - int install_wan_filtering_rule(bool is_sw_routing); void handle_wlan_SCC_MCC_switch(bool, ipa_ip_type); diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp index efa941c..c63fa9b 100644 --- a/ipacm/src/IPACM_Iface.cpp +++ b/ipacm/src/IPACM_Iface.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2020, 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 @@ -949,59 +949,6 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype) 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)); - - 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.action = IPA_PASS_TO_EXCEPTION; - flt_rule_entry.rule.eq_attrib_type = 1; - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap = 0; - - if(rx_prop->rx[0].attrib.attrib_mask & IPA_FLT_META_DATA) - { -#ifdef FEATURE_IPA_V3 - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9); -#else - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<14); -#endif - flt_rule_entry.rule.eq_attrib.metadata_meq32_present = 1; - flt_rule_entry.rule.eq_attrib.metadata_meq32.offset = 0; - flt_rule_entry.rule.eq_attrib.metadata_meq32.value = rx_prop->rx[0].attrib.meta_data; - flt_rule_entry.rule.eq_attrib.metadata_meq32.mask = rx_prop->rx[0].attrib.meta_data_mask; - } - - 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; - -#ifdef FEATURE_IPA_V3 - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<7); -#else - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<8); -#endif - flt_rule_entry.rule.eq_attrib.num_ihl_offset_meq_32 = 1; - flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].offset = 12; - - /* 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[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[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[7]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); - #endif #ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO /* use index hw-counter */ diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp index ebaca87..7628f79 100644 --- a/ipacm/src/IPACM_Lan.cpp +++ b/ipacm/src/IPACM_Lan.cpp @@ -6457,6 +6457,7 @@ int IPACM_Lan::construct_mtu_rule(struct ipa_flt_rule *rule, ipa_ip_type iptype, rule->eq_attrib_type = 1; rule->eq_attrib.rule_eq_bitmap = 0; rule->action = IPA_PASS_TO_EXCEPTION; + rule->rt_tbl_hdl = -1; /* generate eq */ memset(&flt_eq, 0, sizeof(flt_eq)); @@ -6480,7 +6481,11 @@ int IPACM_Lan::construct_mtu_rule(struct ipa_flt_rule *rule, ipa_ip_type iptype, &flt_eq.eq_attrib, sizeof(rule->eq_attrib)); //add IHL offsets - rule->eq_attrib.rule_eq_bitmap |= (1<<10); +#ifdef FEATURE_IPA_V3 + rule->eq_attrib.rule_eq_bitmap |= (1<<10); +#else + rule->eq_attrib.rule_eq_bitmap |= (1<<4); +#endif rule->eq_attrib.num_ihl_offset_range_16 = 1; if (iptype == IPA_IP_v4) rule->eq_attrib.ihl_offset_range_16[0].offset = 0x82; diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp index 7f450e1..6e7c961 100644 --- a/ipacm/src/IPACM_Wan.cpp +++ b/ipacm/src/IPACM_Wan.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. +Copyright (c) 2013-2020 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 @@ -4273,9 +4273,6 @@ int IPACM_Wan::config_wan_firewall_rule(ipa_ip_type iptype) } else if(iptype == IPA_IP_v6) { -#ifdef FEATURE_IPA_ANDROID - add_tcpv6_filtering_rule(flt_rule_v6, IPACM_Wan::num_v6_flt_rule); -#endif IPACM_Wan::num_v6_flt_rule = IPA_V2_NUM_DEFAULT_WAN_FILTER_RULE_IPV6; if(IPACM_FAILURE == add_icmp_alg_rules(flt_rule_v6, IPACM_Wan::num_v6_flt_rule, IPA_IP_v6)) { @@ -4562,104 +4559,6 @@ fail: return res; } -int IPACM_Wan::add_tcpv6_filtering_rule(struct ipa_flt_rule_add *rules, int rule_offset) -{ - struct ipa_ioc_get_rt_tbl_indx rt_tbl_idx; - struct ipa_flt_rule_add flt_rule_entry; - struct ipa_ioc_generate_flt_eq flt_eq; - int res = IPACM_SUCCESS; - - if(rules == NULL) - { - IPACMERR("No filtering table available.\n"); - return IPACM_FAILURE; - } - if(rx_prop == NULL) - { - IPACMERR("No tx property.\n"); - return IPACM_FAILURE; - } - - memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx)); - strlcpy(rt_tbl_idx.name, IPACM_Iface::ipacmcfg->rt_tbl_wan_dl.name, IPA_RESOURCE_NAME_MAX); - rt_tbl_idx.name[IPA_RESOURCE_NAME_MAX-1] = '\0'; - rt_tbl_idx.ip = IPA_IP_v6; - if(0 != ioctl(m_fd_ipa, IPA_IOC_QUERY_RT_TBL_INDEX, &rt_tbl_idx)) - { - IPACMERR("Failed to get routing table index from name\n"); - res = IPACM_FAILURE; - goto fail; - } - - IPACMDBG_H("Routing table %s has index %d\n", rt_tbl_idx.name, rt_tbl_idx.idx); - 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; - flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx; - -#ifdef FEATURE_IPA_ANDROID - IPACMDBG_H("Add TCP ctrl rules: total num %d\n", IPA_V2_NUM_TCP_WAN_FILTER_RULE_IPV6); -#endif - memcpy(&flt_rule_entry.rule.attrib, - &rx_prop->rx[0].attrib, - sizeof(flt_rule_entry.rule.attrib)); - memset(&flt_eq, 0, sizeof(flt_eq)); - memcpy(&flt_eq.attrib, &flt_rule_entry.rule.attrib, sizeof(flt_eq.attrib)); - flt_eq.ip = IPA_IP_v6; - 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)); - - 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; - -#ifdef FEATURE_IPA_V3 - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<7); -#else - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<8); -#endif - flt_rule_entry.rule.eq_attrib.num_ihl_offset_meq_32 = 1; - flt_rule_entry.rule.eq_attrib.ihl_offset_meq_32[0].offset = 12; - - /* 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(&(rules[rule_offset]), &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(&(rules[rule_offset + 1]), &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(&(rules[rule_offset + 2]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add)); - -#ifdef FEATURE_IPA_ANDROID - IPACM_Wan::num_v6_flt_rule += IPA_V2_NUM_TCP_WAN_FILTER_RULE_IPV6; - IPACMDBG_H("Constructed %d ICMP filtering rules for ip type %d\n", IPA_V2_NUM_TCP_WAN_FILTER_RULE_IPV6, IPA_IP_v6); -#endif - -fail: - return res; -} - int IPACM_Wan::del_wan_firewall_rule(ipa_ip_type iptype) { if(iptype == IPA_IP_v4) |