summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaitanya Pratapa <cpratapa@codeaurora.org>2019-11-26 11:11:48 -0800
committerChaitanya Pratapa <cpratapa@codeaurora.org>2020-03-02 17:07:49 -0800
commitb367a24706b9b3dd5065b0d5d20ba1a8974c80e4 (patch)
treeb2385743d3a405191ee32c3e19240b8292db2bd5
parent0cacc4ff148565e65a00affab57a43a87960e0f1 (diff)
downloadipacfg-mgr-b367a24706b9b3dd5065b0d5d20ba1a8974c80e4.tar.gz
ipacm: convert Android.mk files to Android.bp
As part of soong modernisation, requirement is to use Android.bp framework instead of Android.mk. Make changes to convert Android.mk to Android.bp files. Change-Id: I8f2d40159360afd0631c0c50cb823455a45396ef
-rw-r--r--hal/Android.bp28
-rw-r--r--hal/Android.mk31
-rw-r--r--ipacm/Android.bp71
-rw-r--r--ipacm/inc/IPACM_Config.h4
-rw-r--r--ipacm/inc/IPACM_Defs.h4
-rw-r--r--ipacm/src/Android.mk141
-rw-r--r--ipacm/src/IPACM_Config.cpp23
-rw-r--r--ipacm/src/IPACM_Conntrack_NATApp.cpp5
-rw-r--r--ipacm/src/IPACM_Filtering.cpp498
-rw-r--r--ipacm/src/IPACM_Iface.cpp86
-rw-r--r--ipacm/src/IPACM_IfaceManager.cpp5
-rw-r--r--ipacm/src/IPACM_Lan.cpp804
-rw-r--r--ipacm/src/IPACM_Main.cpp10
-rw-r--r--ipacm/src/IPACM_Wan.cpp238
-rw-r--r--ipacm/src/IPACM_Wlan.cpp62
-rw-r--r--ipacm_vendor_product.mk37
-rw-r--r--ipanat/Android.bp28
-rw-r--r--ipanat/inc/ipa_nat_drvi.h3
-rw-r--r--ipanat/src/Android.mk43
19 files changed, 1041 insertions, 1080 deletions
diff --git a/hal/Android.bp b/hal/Android.bp
new file mode 100644
index 0000000..f7559b2
--- /dev/null
+++ b/hal/Android.bp
@@ -0,0 +1,28 @@
+cc_library_shared {
+ name: "liboffloadhal",
+ srcs: [
+ "src/CtUpdateAmbassador.cpp",
+ "src/HAL.cpp",
+ "src/IpaEventRelay.cpp",
+ "src/LocalLogBuffer.cpp",
+ "src/OffloadStatistics.cpp",
+ "src/PrefixParser.cpp",
+ ],
+
+ shared_libs: [
+ "libhwbinder",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libcutils",
+ "libdl",
+ "libbase",
+ "libutils",
+ "libhardware_legacy",
+ "libhardware",
+ "android.hardware.tetheroffload.config@1.0",
+ "android.hardware.tetheroffload.control@1.0",
+ ],
+ export_include_dirs: ["inc"],
+ vendor: true,
+}
diff --git a/hal/Android.mk b/hal/Android.mk
deleted file mode 100644
index 6ebca46..0000000
--- a/hal/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_ARM_MODE := arm
-LOCAL_SRC_FILES := src/CtUpdateAmbassador.cpp \
- src/HAL.cpp \
- src/IpaEventRelay.cpp \
- src/LocalLogBuffer.cpp \
- src/OffloadStatistics.cpp \
- src/PrefixParser.cpp
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
-LOCAL_MODULE := liboffloadhal
-
-#LOCAL_CPP_FLAGS := -Wall -Werror
-LOCAL_SHARED_LIBRARIES := libhwbinder \
- libhidlbase \
- libhidltransport \
- liblog \
- libcutils \
- libdl \
- libbase \
- libutils \
- libhardware_legacy \
- libhardware \
- android.hardware.tetheroffload.config@1.0 \
- android.hardware.tetheroffload.control@1.0
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-include $(BUILD_SHARED_LIBRARY)
diff --git a/ipacm/Android.bp b/ipacm/Android.bp
new file mode 100644
index 0000000..b0d705b
--- /dev/null
+++ b/ipacm/Android.bp
@@ -0,0 +1,71 @@
+
+cc_binary {
+ name: "ipacm",
+
+ local_include_dirs: ["src"] + ["inc"],
+ header_libs: ["qti_kernel_headers"],
+
+ cflags: ["-v"] + ["-DFEATURE_IPA_ANDROID"] + ["-DFEATURE_IPACM_RESTART"] + [
+ "-DFEATURE_IPACM_HAL",
+ "-Wall",
+ "-Werror",
+ "-Wno-error=macro-redefined",
+ ],
+
+ srcs: [
+ "src/IPACM_Main.cpp",
+ "src/IPACM_EvtDispatcher.cpp",
+ "src/IPACM_Config.cpp",
+ "src/IPACM_CmdQueue.cpp",
+ "src/IPACM_Filtering.cpp",
+ "src/IPACM_Routing.cpp",
+ "src/IPACM_Header.cpp",
+ "src/IPACM_Lan.cpp",
+ "src/IPACM_Iface.cpp",
+ "src/IPACM_Wlan.cpp",
+ "src/IPACM_Wan.cpp",
+ "src/IPACM_IfaceManager.cpp",
+ "src/IPACM_Neighbor.cpp",
+ "src/IPACM_Netlink.cpp",
+ "src/IPACM_Xml.cpp",
+ "src/IPACM_Conntrack_NATApp.cpp",
+ "src/IPACM_ConntrackClient.cpp",
+ "src/IPACM_ConntrackListener.cpp",
+ "src/IPACM_Log.cpp",
+ "src/IPACM_OffloadManager.cpp",
+ "src/IPACM_LanToLan.cpp",
+ ],
+
+ init_rc: ["src/ipacm.rc"],
+ clang: true,
+ vendor: true,
+
+ shared_libs: [
+ "liboffloadhal",
+ "libipanat",
+ "libxml2",
+ "libnfnetlink",
+ "libnetfilter_conntrack",
+ "libhidlbase",
+ "liblog",
+ "libcutils",
+ "libdl",
+ "libbase",
+ "libutils",
+ "libhardware_legacy",
+ "libhardware",
+ "android.hardware.tetheroffload.config@1.0",
+ "android.hardware.tetheroffload.control@1.0",
+ ],
+}
+
+//###############################################################################
+
+prebuilt_etc {
+ name: "IPACM_cfg.xml",
+
+ vendor: true,
+ owner: "ipacm",
+ src: "src/IPACM_cfg.xml",
+
+}
diff --git a/ipacm/inc/IPACM_Config.h b/ipacm/inc/IPACM_Config.h
index 2792f62..1915fbc 100644
--- a/ipacm/inc/IPACM_Config.h
+++ b/ipacm/inc/IPACM_Config.h
@@ -261,6 +261,10 @@ public:
enum ipa_hw_type GetIPAVer(bool get = false);
+ bool isEthBridgingSupported();
+
+ bool isIPAv3Supported();
+
int Init(void);
inline bool isPrivateSubnet(uint32_t ip_addr)
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index b1daf35..a3cbba1 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -97,11 +97,7 @@ extern "C"
#define IPA_DEVICE_NAME "/dev/ipa"
#define MAX_NUM_PROP 2
-#ifndef FEATURE_IPA_V3
-#define IPA_MAX_FLT_RULE 50
-#else
#define IPA_MAX_FLT_RULE 100
-#endif
#define TCP_FIN_SHIFT 16
#define TCP_SYN_SHIFT 17
diff --git a/ipacm/src/Android.mk b/ipacm/src/Android.mk
deleted file mode 100644
index 6d0bf80..0000000
--- a/ipacm/src/Android.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-TARGET_DISABLE_IPACM := false
-
-ifeq ($(TARGET_USES_QMAA),true)
-ifneq ($(TARGET_USES_QMAA_OVERRIDE_DATA),true)
- TARGET_DISABLE_IPACM := true
-endif #TARGET_USES_QMAA_OVERRIDE_DATA
-endif #TARGET_USES_QMAA
-
-
-ifneq ($(TARGET_DISABLE_IPACM),true)
-ifneq ($(TARGET_HAS_LOW_RAM),true)
-BOARD_PLATFORM_LIST := msm8909
-BOARD_PLATFORM_LIST += msm8916
-BOARD_PLATFORM_LIST += msm8917
-BOARD_PLATFORM_LIST += qm215
-BOARD_IPAv3_LIST := msm8998
-BOARD_IPAv3_LIST += sdm845
-BOARD_IPAv3_LIST += sdm710
-BOARD_IPAv3_LIST += msmnile
-BOARD_IPAv3_LIST += kona
-BOARD_IPAv3_LIST += lahaina
-BOARD_IPAv3_LIST += $(MSMSTEPPE)
-BOARD_IPAv3_LIST += $(TRINKET)
-BOARD_IPAv3_LIST += lito
-BOARD_IPAv3_LIST += atoll
-BOARD_IPAv3_LIST += bengal
-BOARD_ETH_BRIDGE_LIST := msmnile
-BOARD_ETH_BRIDGE_LIST += kona
-
-ifneq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
-ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
-ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH)))
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../src
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/../inc
-
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
-
-LOCAL_CFLAGS := -v
-LOCAL_CFLAGS += -DFEATURE_IPA_ANDROID
-LOCAL_CFLAGS += -DFEATURE_IPACM_RESTART
-
-ifeq ($(call is-board-platform-in-list,$(BOARD_ETH_BRIDGE_LIST)),true)
-LOCAL_CFLAGS += -DFEATURE_ETH_BRIDGE_LE
-endif
-
-LOCAL_CFLAGS += -DFEATURE_IPACM_HAL -Wall -Werror -Wno-error=macro-redefined
-ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
-LOCAL_CFLAGS += -DDEBUG
-endif
-
-ifeq ($(call is-board-platform-in-list,$(BOARD_IPAv3_LIST)),true)
-LOCAL_CFLAGS += -DFEATURE_IPA_V3
-endif
-
-filetoadd = bionic/libc/kernel/arch-arm/asm/posix_types.h
-LOCAL_CFLAGS += $(shell if [ -a $(filetoadd) ] ; then echo -include $(filetoadd) ; fi ;)
-filetoadd = bionic/libc/kernel/arch-arm/asm/byteorder.h
-LOCAL_CFLAGS += $(shell if [ -a $(filetoadd) ] ; then echo -include $(filetoadd) ; fi ;)
-
-LOCAL_SRC_FILES := IPACM_Main.cpp \
- IPACM_EvtDispatcher.cpp \
- IPACM_Config.cpp \
- IPACM_CmdQueue.cpp \
- IPACM_Filtering.cpp \
- IPACM_Routing.cpp \
- IPACM_Header.cpp \
- IPACM_Lan.cpp \
- IPACM_Iface.cpp \
- IPACM_Wlan.cpp \
- IPACM_Wan.cpp \
- IPACM_IfaceManager.cpp \
- IPACM_Neighbor.cpp \
- IPACM_Netlink.cpp \
- IPACM_Xml.cpp \
- IPACM_Conntrack_NATApp.cpp\
- IPACM_ConntrackClient.cpp \
- IPACM_ConntrackListener.cpp \
- IPACM_Log.cpp \
- IPACM_OffloadManager.cpp \
- IPACM_LanToLan.cpp
-
-LOCAL_MODULE := ipacm
-LOCAL_INIT_RC := ipacm.rc
-LOCAL_CLANG := false
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := liboffloadhal
-LOCAL_SHARED_LIBRARIES += libipanat
-LOCAL_SHARED_LIBRARIES += libxml2
-LOCAL_SHARED_LIBRARIES += libnfnetlink
-LOCAL_SHARED_LIBRARIES += libnetfilter_conntrack
-LOCAL_SHARED_LIBRARIES += libhidlbase \
- liblog \
- libcutils \
- libdl \
- libbase \
- libutils \
- libhardware_legacy \
- libhardware \
- android.hardware.tetheroffload.config@1.0 \
- android.hardware.tetheroffload.control@1.0
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
-
-LOCAL_CLANG := true
-include $(BUILD_EXECUTABLE)
-
-################################################################################
-
-define ADD_TEST
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := $1
-LOCAL_SRC_FILES := $1
-LOCAL_MODULE_CLASS := ipacm
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
-include $(BUILD_PREBUILT)
-
-endef
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := IPACM_cfg.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-LOCAL_MODULE_OWNER := ipacm
-include $(BUILD_PREBUILT)
-
-endif # $(TARGET_ARCH)
-endif
-endif
-endif
-endif
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index 781f1cb..c396c6c 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -905,3 +905,26 @@ enum ipa_hw_type IPACM_Config::GetIPAVer(bool get)
IPACMDBG_H("IPA version is %d.\n", ver);
return ver;
}
+
+bool IPACM_Config::isEthBridgingSupported()
+{
+ enum ipa_hw_type hw_type;
+
+ hw_type = GetIPAVer();
+
+#ifdef IPA_HW_v4_7
+ return ((hw_type >= IPA_HW_v4_5) &&
+ (hw_type != IPA_HW_v4_7));
+#else
+ return (hw_type >= IPA_HW_v4_5);
+#endif
+}
+
+bool IPACM_Config::isIPAv3Supported()
+{
+ enum ipa_hw_type hw_type;
+
+ hw_type = GetIPAVer();
+
+ return (hw_type >= IPA_HW_v3_0);
+}
diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp
index c1f47e1..a9c7140 100644
--- a/ipacm/src/IPACM_Conntrack_NATApp.cpp
+++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp
@@ -546,9 +546,8 @@ int NatApp::AddConnection(const nat_table_entry *rule)
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_SRC_PORT;
flt_rule_entry.rule.attrib.src_port = rule->target_port;
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_PORT;
diff --git a/ipacm/src/IPACM_Filtering.cpp b/ipacm/src/IPACM_Filtering.cpp
index a158d74..8aa25a6 100644
--- a/ipacm/src/IPACM_Filtering.cpp
+++ b/ipacm/src/IPACM_Filtering.cpp
@@ -46,6 +46,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IPACM_Filtering.h"
#include <IPACM_Log.h>
#include "IPACM_Defs.h"
+#include "IPACM_Iface.h"
const char *IPACM_Filtering::DEVICE_NAME = "/dev/ipa";
@@ -234,156 +235,162 @@ fail_tbl:
bool IPACM_Filtering::AddFilteringRuleAfter_hw_index(struct ipa_ioc_add_flt_rule_after *ruleTable, int hw_counter_index)
{
bool ret = true;
-#ifdef FEATURE_IPA_V3
int retval=0, cnt = 0, len = 0;
struct ipa_ioc_add_flt_rule_after_v2 *ruleTable_v2;
struct ipa_flt_rule_add_v2 flt_rule_entry;
- IPACMDBG("Printing filter add attributes\n");
- IPACMDBG("ep: %d\n", ruleTable->ep);
- IPACMDBG("ip type: %d\n", ruleTable->ip);
- IPACMDBG("Number of rules: %d\n", ruleTable->num_rules);
- IPACMDBG("add_after_hdl: %d\n", ruleTable->add_after_hdl);
- IPACMDBG("commit value: %d\n", ruleTable->commit);
-
- /* change to v2 format*/
- len = sizeof(struct ipa_ioc_add_flt_rule_after_v2);
- ruleTable_v2 = (struct ipa_ioc_add_flt_rule_after_v2*)malloc(len);
- if (ruleTable_v2 == NULL)
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- IPACMERR("Error Locate ipa_ioc_add_flt_rule_after_v2 memory...\n");
- return false;
- }
- memset(ruleTable_v2, 0, len);
- ruleTable_v2->rules = (uint64_t)calloc(ruleTable->num_rules, sizeof(struct ipa_flt_rule_add_v2));
- if (!ruleTable_v2->rules) {
- IPACMERR("Failed to allocate memory for filtering rules\n");
- ret = false;
- goto fail_tbl;
- }
-
- ruleTable_v2->commit = ruleTable->commit;
- ruleTable_v2->ep = ruleTable->ep;
- ruleTable_v2->ip = ruleTable->ip;
- ruleTable_v2->num_rules = ruleTable->num_rules;
- ruleTable_v2->add_after_hdl = ruleTable->add_after_hdl;
- ruleTable_v2->flt_rule_size = sizeof(struct ipa_flt_rule_add_v2);
+ IPACMDBG("Printing filter add attributes\n");
+ IPACMDBG("ep: %d\n", ruleTable->ep);
+ IPACMDBG("ip type: %d\n", ruleTable->ip);
+ IPACMDBG("Number of rules: %d\n", ruleTable->num_rules);
+ IPACMDBG("add_after_hdl: %d\n", ruleTable->add_after_hdl);
+ IPACMDBG("commit value: %d\n", ruleTable->commit);
- for (cnt=0; cnt < ruleTable->num_rules; cnt++)
- {
- memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add_v2));
- flt_rule_entry.at_rear = ruleTable->rules[cnt].at_rear;
- flt_rule_entry.rule.retain_hdr = ruleTable->rules[cnt].rule.retain_hdr;
- flt_rule_entry.rule.to_uc = ruleTable->rules[cnt].rule.to_uc;
- flt_rule_entry.rule.action = ruleTable->rules[cnt].rule.action;
- flt_rule_entry.rule.rt_tbl_hdl = ruleTable->rules[cnt].rule.rt_tbl_hdl;
- flt_rule_entry.rule.rt_tbl_idx = ruleTable->rules[cnt].rule.rt_tbl_idx;
- flt_rule_entry.rule.eq_attrib_type = ruleTable->rules[cnt].rule.eq_attrib_type;
- flt_rule_entry.rule.max_prio = ruleTable->rules[cnt].rule.max_prio;
- flt_rule_entry.rule.hashable = ruleTable->rules[cnt].rule.hashable;
- flt_rule_entry.rule.rule_id = ruleTable->rules[cnt].rule.rule_id;
- flt_rule_entry.rule.set_metadata = ruleTable->rules[cnt].rule.set_metadata;
- flt_rule_entry.rule.pdn_idx = ruleTable->rules[cnt].rule.pdn_idx;
- memcpy(&flt_rule_entry.rule.eq_attrib,
- &ruleTable->rules[cnt].rule.eq_attrib,
- sizeof(flt_rule_entry.rule.eq_attrib));
- memcpy(&flt_rule_entry.rule.attrib,
- &ruleTable->rules[cnt].rule.attrib,
- sizeof(flt_rule_entry.rule.attrib));
- IPACMDBG("Filter rule:%d attrib mask: 0x%x\n", cnt,
- ruleTable->rules[cnt].rule.attrib.attrib_mask);
- /* 0 means disable hw-counter-sats */
- if (hw_counter_index != 0)
+ /* change to v2 format*/
+ len = sizeof(struct ipa_ioc_add_flt_rule_after_v2);
+ ruleTable_v2 = (struct ipa_ioc_add_flt_rule_after_v2*)malloc(len);
+ if (ruleTable_v2 == NULL)
{
- flt_rule_entry.rule.enable_stats = 1;
- flt_rule_entry.rule.cnt_idx = hw_counter_index;
+ IPACMERR("Error Locate ipa_ioc_add_flt_rule_after_v2 memory...\n");
+ return false;
+ }
+ memset(ruleTable_v2, 0, len);
+ ruleTable_v2->rules = (uint64_t)calloc(ruleTable->num_rules, sizeof(struct ipa_flt_rule_add_v2));
+ if (!ruleTable_v2->rules) {
+ IPACMERR("Failed to allocate memory for filtering rules\n");
+ ret = false;
+ goto fail_tbl;
}
- /* copy to v2 table*/
- memcpy((void *)(ruleTable_v2->rules + (cnt * sizeof(struct ipa_flt_rule_add_v2))),
- &flt_rule_entry, sizeof(flt_rule_entry));
- }
-
- retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE_AFTER_V2, ruleTable_v2);
- if (retval != 0)
- {
- IPACMERR("Failed adding Filtering rule %pK\n", ruleTable_v2);
- PERROR("unable to add filter rule:");
+ ruleTable_v2->commit = ruleTable->commit;
+ ruleTable_v2->ep = ruleTable->ep;
+ ruleTable_v2->ip = ruleTable->ip;
+ ruleTable_v2->num_rules = ruleTable->num_rules;
+ ruleTable_v2->add_after_hdl = ruleTable->add_after_hdl;
+ ruleTable_v2->flt_rule_size = sizeof(struct ipa_flt_rule_add_v2);
- for (int cnt = 0; cnt < ruleTable_v2->num_rules; cnt++)
+ for (cnt=0; cnt < ruleTable->num_rules; cnt++)
{
- if (((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status != 0)
+ memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add_v2));
+ flt_rule_entry.at_rear = ruleTable->rules[cnt].at_rear;
+ flt_rule_entry.rule.retain_hdr = ruleTable->rules[cnt].rule.retain_hdr;
+ flt_rule_entry.rule.to_uc = ruleTable->rules[cnt].rule.to_uc;
+ flt_rule_entry.rule.action = ruleTable->rules[cnt].rule.action;
+ flt_rule_entry.rule.rt_tbl_hdl = ruleTable->rules[cnt].rule.rt_tbl_hdl;
+ flt_rule_entry.rule.rt_tbl_idx = ruleTable->rules[cnt].rule.rt_tbl_idx;
+ flt_rule_entry.rule.eq_attrib_type = ruleTable->rules[cnt].rule.eq_attrib_type;
+ flt_rule_entry.rule.max_prio = ruleTable->rules[cnt].rule.max_prio;
+ flt_rule_entry.rule.hashable = ruleTable->rules[cnt].rule.hashable;
+ flt_rule_entry.rule.rule_id = ruleTable->rules[cnt].rule.rule_id;
+ flt_rule_entry.rule.set_metadata = ruleTable->rules[cnt].rule.set_metadata;
+ flt_rule_entry.rule.pdn_idx = ruleTable->rules[cnt].rule.pdn_idx;
+ memcpy(&flt_rule_entry.rule.eq_attrib,
+ &ruleTable->rules[cnt].rule.eq_attrib,
+ sizeof(flt_rule_entry.rule.eq_attrib));
+ memcpy(&flt_rule_entry.rule.attrib,
+ &ruleTable->rules[cnt].rule.attrib,
+ sizeof(flt_rule_entry.rule.attrib));
+ IPACMDBG("Filter rule:%d attrib mask: 0x%x\n", cnt,
+ ruleTable->rules[cnt].rule.attrib.attrib_mask);
+ /* 0 means disable hw-counter-sats */
+ if (hw_counter_index != 0)
{
- IPACMERR("Adding Filter rule:%d failed with status:%d\n",
- cnt, ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status);
+ flt_rule_entry.rule.enable_stats = 1;
+ flt_rule_entry.rule.cnt_idx = hw_counter_index;
}
+
+ /* copy to v2 table*/
+ memcpy((void *)(ruleTable_v2->rules + (cnt * sizeof(struct ipa_flt_rule_add_v2))),
+ &flt_rule_entry, sizeof(flt_rule_entry));
}
- ret = false;
- goto fail_rule;
- }
- /* copy results from v2 to v1 format */
- for (int cnt = 0; cnt < ruleTable->num_rules; cnt++)
- {
- /* copy status to v1 format */
- ruleTable->rules[cnt].status = ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status;
- ruleTable->rules[cnt].flt_rule_hdl = ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].flt_rule_hdl;
+ retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE_AFTER_V2, ruleTable_v2);
+ if (retval != 0)
+ {
+ IPACMERR("Failed adding Filtering rule %pK\n", ruleTable_v2);
+ PERROR("unable to add filter rule:");
- if(((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status != 0)
+ for (int cnt = 0; cnt < ruleTable_v2->num_rules; cnt++)
+ {
+ if (((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status != 0)
+ {
+ IPACMERR("Adding Filter rule:%d failed with status:%d\n",
+ cnt, ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status);
+ }
+ }
+ ret = false;
+ goto fail_rule;
+ }
+
+ /* copy results from v2 to v1 format */
+ for (int cnt = 0; cnt < ruleTable->num_rules; cnt++)
{
- IPACMERR("Adding Filter rule:%d failed with status:%d\n",
- cnt, ((struct ipa_flt_rule_add_v2 *) ruleTable_v2->rules)[cnt].status);
+ /* copy status to v1 format */
+ ruleTable->rules[cnt].status = ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status;
+ ruleTable->rules[cnt].flt_rule_hdl = ((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].flt_rule_hdl;
+
+ if(((struct ipa_flt_rule_add_v2 *)ruleTable_v2->rules)[cnt].status != 0)
+ {
+ IPACMERR("Adding Filter rule:%d failed with status:%d\n",
+ cnt, ((struct ipa_flt_rule_add_v2 *) ruleTable_v2->rules)[cnt].status);
+ }
}
- }
- IPACMDBG("Added Filtering rule %pK\n", ruleTable_v2);
+ IPACMDBG("Added Filtering rule %pK\n", ruleTable_v2);
-fail_rule:
- if((void *)ruleTable_v2->rules != NULL)
- free((void *)ruleTable_v2->rules);
-fail_tbl:
- if (ruleTable_v2 != NULL)
- free(ruleTable_v2);
-#else
- if (ruleTable)
- IPACMERR("Not support adding Filtering rule %pK\n", ruleTable);
-#endif
+ fail_rule:
+ if((void *)ruleTable_v2->rules != NULL)
+ free((void *)ruleTable_v2->rules);
+ fail_tbl:
+ if (ruleTable_v2 != NULL)
+ free(ruleTable_v2);
+ }
+ else
+ {
+ if (ruleTable)
+ IPACMERR("Not support adding Filtering rule %pK\n", ruleTable);
+ }
return ret;
}
#endif //IPA_IOCTL_SET_FNR_COUNTER_INFO
bool IPACM_Filtering::AddFilteringRuleAfter(struct ipa_ioc_add_flt_rule_after const *ruleTable)
{
-#ifdef FEATURE_IPA_V3
int retval = 0;
- IPACMDBG("Printing filter add attributes\n");
- IPACMDBG("ip type: %d\n", ruleTable->ip);
- IPACMDBG("Number of rules: %d\n", ruleTable->num_rules);
- IPACMDBG("End point: %d\n", ruleTable->ep);
- IPACMDBG("commit value: %d\n", ruleTable->commit);
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ IPACMDBG("Printing filter add attributes\n");
+ IPACMDBG("ip type: %d\n", ruleTable->ip);
+ IPACMDBG("Number of rules: %d\n", ruleTable->num_rules);
+ IPACMDBG("End point: %d\n", ruleTable->ep);
+ IPACMDBG("commit value: %d\n", ruleTable->commit);
- retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE_AFTER, ruleTable);
+ retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE_AFTER, ruleTable);
- for (int cnt = 0; cnt<ruleTable->num_rules; cnt++)
- {
- if(ruleTable->rules[cnt].status != 0)
+ for (int cnt = 0; cnt<ruleTable->num_rules; cnt++)
{
- IPACMERR("Adding Filter rule:%d failed with status:%d\n",
- cnt, ruleTable->rules[cnt].status);
+ if(ruleTable->rules[cnt].status != 0)
+ {
+ IPACMERR("Adding Filter rule:%d failed with status:%d\n",
+ cnt, ruleTable->rules[cnt].status);
+ }
}
- }
- if (retval != 0)
+ if (retval != 0)
+ {
+ IPACMERR("Failed adding Filtering rule %pK\n", ruleTable);
+ return false;
+ }
+ IPACMDBG("Added Filtering rule %pK\n", ruleTable);
+ }
+ else
{
- IPACMERR("Failed adding Filtering rule %pK\n", ruleTable);
- return false;
+ if (ruleTable)
+ IPACMERR("Not support adding Filtering rule %pK\n", ruleTable);
}
- IPACMDBG("Added Filtering rule %pK\n", ruleTable);
-#else
- if (ruleTable)
- IPACMERR("Not support adding Filtering rule %pK\n", ruleTable);
-#endif
return true;
}
@@ -501,9 +508,7 @@ bool IPACM_Filtering::AddWanDLFilteringRule(struct ipa_ioc_add_flt_rule const *r
{
int ret = 0, cnt, num_rules = 0, pos = 0;
ipa_install_fltr_rule_req_msg_v01 qmi_rule_msg;
-#ifdef FEATURE_IPA_V3
ipa_install_fltr_rule_req_ex_msg_v01 qmi_rule_ex_msg;
-#endif
memset(&qmi_rule_msg, 0, sizeof(qmi_rule_msg));
int fd_wwan_ioctl = open(WWAN_QMI_IOCTL_DEVICE_NAME, O_RDWR);
@@ -525,175 +530,178 @@ bool IPACM_Filtering::AddWanDLFilteringRule(struct ipa_ioc_add_flt_rule const *r
}
/* if it is not IPA v3, use old QMI format */
-#ifndef FEATURE_IPA_V3
- if(num_rules > QMI_IPA_MAX_FILTERS_V01)
- {
- IPACMERR("The number of filtering rules exceed limit.\n");
- close(fd_wwan_ioctl);
- return false;
- }
- else
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- if (num_rules > 0)
+ if(num_rules > QMI_IPA_MAX_FILTERS_V01)
{
- qmi_rule_msg.filter_spec_list_valid = true;
+ IPACMERR("The number of filtering rules exceed limit.\n");
+ close(fd_wwan_ioctl);
+ return false;
}
else
{
- qmi_rule_msg.filter_spec_list_valid = false;
- }
+ if (num_rules > 0)
+ {
+ qmi_rule_msg.filter_spec_list_valid = true;
+ }
+ else
+ {
+ qmi_rule_msg.filter_spec_list_valid = false;
+ }
- qmi_rule_msg.filter_spec_list_len = num_rules;
- qmi_rule_msg.source_pipe_index_valid = 0;
+ qmi_rule_msg.filter_spec_list_len = num_rules;
+ qmi_rule_msg.source_pipe_index_valid = 0;
- IPACMDBG_H("Get %d WAN DL filtering rules in total.\n", num_rules);
+ IPACMDBG_H("Get %d WAN DL filtering rules in total.\n", num_rules);
- if(rule_table_v4 != NULL)
- {
- for(cnt = rule_table_v4->num_rules - 1; cnt >= 0; cnt--)
+ if(rule_table_v4 != NULL)
{
- if (pos < QMI_IPA_MAX_FILTERS_V01)
- {
- qmi_rule_msg.filter_spec_list[pos].filter_spec_identifier = pos;
- qmi_rule_msg.filter_spec_list[pos].ip_type = QMI_IPA_IP_TYPE_V4_V01;
- qmi_rule_msg.filter_spec_list[pos].filter_action = GetQmiFilterAction(rule_table_v4->rules[cnt].rule.action);
- qmi_rule_msg.filter_spec_list[pos].is_routing_table_index_valid = 1;
- qmi_rule_msg.filter_spec_list[pos].route_table_index = rule_table_v4->rules[cnt].rule.rt_tbl_idx;
- qmi_rule_msg.filter_spec_list[pos].is_mux_id_valid = 1;
- qmi_rule_msg.filter_spec_list[pos].mux_id = mux_id;
- memcpy(&qmi_rule_msg.filter_spec_list[pos].filter_rule,
- &rule_table_v4->rules[cnt].rule.eq_attrib,
- sizeof(struct ipa_filter_rule_type_v01));
- pos++;
- }
- else
+ for(cnt = rule_table_v4->num_rules - 1; cnt >= 0; cnt--)
{
- IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_V01, pos);
+ if (pos < QMI_IPA_MAX_FILTERS_V01)
+ {
+ qmi_rule_msg.filter_spec_list[pos].filter_spec_identifier = pos;
+ qmi_rule_msg.filter_spec_list[pos].ip_type = QMI_IPA_IP_TYPE_V4_V01;
+ qmi_rule_msg.filter_spec_list[pos].filter_action = GetQmiFilterAction(rule_table_v4->rules[cnt].rule.action);
+ qmi_rule_msg.filter_spec_list[pos].is_routing_table_index_valid = 1;
+ qmi_rule_msg.filter_spec_list[pos].route_table_index = rule_table_v4->rules[cnt].rule.rt_tbl_idx;
+ qmi_rule_msg.filter_spec_list[pos].is_mux_id_valid = 1;
+ qmi_rule_msg.filter_spec_list[pos].mux_id = mux_id;
+ memcpy(&qmi_rule_msg.filter_spec_list[pos].filter_rule,
+ &rule_table_v4->rules[cnt].rule.eq_attrib,
+ sizeof(struct ipa_filter_rule_type_v01));
+ pos++;
+ }
+ else
+ {
+ IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_V01, pos);
+ }
}
}
- }
- if(rule_table_v6 != NULL)
- {
- for(cnt = rule_table_v6->num_rules - 1; cnt >= 0; cnt--)
+ if(rule_table_v6 != NULL)
{
- if (pos < QMI_IPA_MAX_FILTERS_V01)
+ for(cnt = rule_table_v6->num_rules - 1; cnt >= 0; cnt--)
{
- qmi_rule_msg.filter_spec_list[pos].filter_spec_identifier = pos;
- qmi_rule_msg.filter_spec_list[pos].ip_type = QMI_IPA_IP_TYPE_V6_V01;
- qmi_rule_msg.filter_spec_list[pos].filter_action = GetQmiFilterAction(rule_table_v6->rules[cnt].rule.action);
- qmi_rule_msg.filter_spec_list[pos].is_routing_table_index_valid = 1;
- qmi_rule_msg.filter_spec_list[pos].route_table_index = rule_table_v6->rules[cnt].rule.rt_tbl_idx;
- qmi_rule_msg.filter_spec_list[pos].is_mux_id_valid = 1;
- qmi_rule_msg.filter_spec_list[pos].mux_id = mux_id;
- memcpy(&qmi_rule_msg.filter_spec_list[pos].filter_rule,
- &rule_table_v6->rules[cnt].rule.eq_attrib,
- sizeof(struct ipa_filter_rule_type_v01));
- pos++;
- }
- else
- {
- IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_V01, pos);
+ if (pos < QMI_IPA_MAX_FILTERS_V01)
+ {
+ qmi_rule_msg.filter_spec_list[pos].filter_spec_identifier = pos;
+ qmi_rule_msg.filter_spec_list[pos].ip_type = QMI_IPA_IP_TYPE_V6_V01;
+ qmi_rule_msg.filter_spec_list[pos].filter_action = GetQmiFilterAction(rule_table_v6->rules[cnt].rule.action);
+ qmi_rule_msg.filter_spec_list[pos].is_routing_table_index_valid = 1;
+ qmi_rule_msg.filter_spec_list[pos].route_table_index = rule_table_v6->rules[cnt].rule.rt_tbl_idx;
+ qmi_rule_msg.filter_spec_list[pos].is_mux_id_valid = 1;
+ qmi_rule_msg.filter_spec_list[pos].mux_id = mux_id;
+ memcpy(&qmi_rule_msg.filter_spec_list[pos].filter_rule,
+ &rule_table_v6->rules[cnt].rule.eq_attrib,
+ sizeof(struct ipa_filter_rule_type_v01));
+ pos++;
+ }
+ else
+ {
+ IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_V01, pos);
+ }
}
}
- }
- ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE, &qmi_rule_msg);
- if (ret != 0)
- {
- IPACMERR("Failed adding Filtering rule %p with ret %d\n ", &qmi_rule_msg, ret);
- close(fd_wwan_ioctl);
- return false;
+ ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE, &qmi_rule_msg);
+ if (ret != 0)
+ {
+ IPACMERR("Failed adding Filtering rule %p with ret %d\n ", &qmi_rule_msg, ret);
+ close(fd_wwan_ioctl);
+ return false;
+ }
}
- }
/* if it is IPA v3, use new QMI format */
-#else
- if(num_rules > QMI_IPA_MAX_FILTERS_EX_V01)
- {
- IPACMERR("The number of filtering rules exceed limit.\n");
- close(fd_wwan_ioctl);
- return false;
}
else
{
- memset(&qmi_rule_ex_msg, 0, sizeof(qmi_rule_ex_msg));
-
- if (num_rules > 0)
+ if(num_rules > QMI_IPA_MAX_FILTERS_EX_V01)
{
- qmi_rule_ex_msg.filter_spec_ex_list_valid = true;
+ IPACMERR("The number of filtering rules exceed limit.\n");
+ close(fd_wwan_ioctl);
+ return false;
}
else
{
- qmi_rule_ex_msg.filter_spec_ex_list_valid = false;
- }
- qmi_rule_ex_msg.filter_spec_ex_list_len = num_rules;
- qmi_rule_ex_msg.source_pipe_index_valid = 0;
+ memset(&qmi_rule_ex_msg, 0, sizeof(qmi_rule_ex_msg));
- IPACMDBG_H("Get %d WAN DL filtering rules in total.\n", num_rules);
-
- if(rule_table_v4 != NULL)
- {
- for(cnt = rule_table_v4->num_rules - 1; cnt >= 0; cnt--)
+ if (num_rules > 0)
{
- if (pos < QMI_IPA_MAX_FILTERS_EX_V01)
- {
- qmi_rule_ex_msg.filter_spec_ex_list[pos].ip_type = QMI_IPA_IP_TYPE_V4_V01;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_action = GetQmiFilterAction(rule_table_v4->rules[cnt].rule.action);
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_routing_table_index_valid = 1;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].route_table_index = rule_table_v4->rules[cnt].rule.rt_tbl_idx;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_mux_id_valid = 1;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].mux_id = mux_id;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].rule_id = rule_table_v4->rules[cnt].rule.rule_id;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_rule_hashable = rule_table_v4->rules[cnt].rule.hashable;
- memcpy(&qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_rule,
- &rule_table_v4->rules[cnt].rule.eq_attrib,
- sizeof(struct ipa_filter_rule_type_v01));
+ qmi_rule_ex_msg.filter_spec_ex_list_valid = true;
+ }
+ else
+ {
+ qmi_rule_ex_msg.filter_spec_ex_list_valid = false;
+ }
+ qmi_rule_ex_msg.filter_spec_ex_list_len = num_rules;
+ qmi_rule_ex_msg.source_pipe_index_valid = 0;
- pos++;
- }
- else
+ IPACMDBG_H("Get %d WAN DL filtering rules in total.\n", num_rules);
+
+ if(rule_table_v4 != NULL)
+ {
+ for(cnt = rule_table_v4->num_rules - 1; cnt >= 0; cnt--)
{
- IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_EX_V01, pos);
+ if (pos < QMI_IPA_MAX_FILTERS_EX_V01)
+ {
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].ip_type = QMI_IPA_IP_TYPE_V4_V01;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_action = GetQmiFilterAction(rule_table_v4->rules[cnt].rule.action);
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_routing_table_index_valid = 1;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].route_table_index = rule_table_v4->rules[cnt].rule.rt_tbl_idx;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_mux_id_valid = 1;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].mux_id = mux_id;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].rule_id = rule_table_v4->rules[cnt].rule.rule_id;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_rule_hashable = rule_table_v4->rules[cnt].rule.hashable;
+ memcpy(&qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_rule,
+ &rule_table_v4->rules[cnt].rule.eq_attrib,
+ sizeof(struct ipa_filter_rule_type_v01));
+
+ pos++;
+ }
+ else
+ {
+ IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_EX_V01, pos);
+ }
}
}
- }
- if(rule_table_v6 != NULL)
- {
- for(cnt = rule_table_v6->num_rules - 1; cnt >= 0; cnt--)
+ if(rule_table_v6 != NULL)
{
- if (pos < QMI_IPA_MAX_FILTERS_EX_V01)
+ for(cnt = rule_table_v6->num_rules - 1; cnt >= 0; cnt--)
{
- qmi_rule_ex_msg.filter_spec_ex_list[pos].ip_type = QMI_IPA_IP_TYPE_V6_V01;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_action = GetQmiFilterAction(rule_table_v6->rules[cnt].rule.action);
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_routing_table_index_valid = 1;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].route_table_index = rule_table_v6->rules[cnt].rule.rt_tbl_idx;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_mux_id_valid = 1;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].mux_id = mux_id;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].rule_id = rule_table_v6->rules[cnt].rule.rule_id;
- qmi_rule_ex_msg.filter_spec_ex_list[pos].is_rule_hashable = rule_table_v6->rules[cnt].rule.hashable;
- memcpy(&qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_rule,
- &rule_table_v6->rules[cnt].rule.eq_attrib,
- sizeof(struct ipa_filter_rule_type_v01));
-
- pos++;
- }
- else
- {
- IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_EX_V01, pos);
+ if (pos < QMI_IPA_MAX_FILTERS_EX_V01)
+ {
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].ip_type = QMI_IPA_IP_TYPE_V6_V01;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_action = GetQmiFilterAction(rule_table_v6->rules[cnt].rule.action);
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_routing_table_index_valid = 1;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].route_table_index = rule_table_v6->rules[cnt].rule.rt_tbl_idx;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_mux_id_valid = 1;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].mux_id = mux_id;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].rule_id = rule_table_v6->rules[cnt].rule.rule_id;
+ qmi_rule_ex_msg.filter_spec_ex_list[pos].is_rule_hashable = rule_table_v6->rules[cnt].rule.hashable;
+ memcpy(&qmi_rule_ex_msg.filter_spec_ex_list[pos].filter_rule,
+ &rule_table_v6->rules[cnt].rule.eq_attrib,
+ sizeof(struct ipa_filter_rule_type_v01));
+
+ pos++;
+ }
+ else
+ {
+ IPACMERR(" QMI only support max %d rules, current (%d)\n ",QMI_IPA_MAX_FILTERS_EX_V01, pos);
+ }
}
}
- }
- ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE_EX, &qmi_rule_ex_msg);
- if (ret != 0)
- {
- IPACMERR("Failed adding Filtering rule %pK with ret %d\n ", &qmi_rule_ex_msg, ret);
- close(fd_wwan_ioctl);
- return false;
+ ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE_EX, &qmi_rule_ex_msg);
+ if (ret != 0)
+ {
+ IPACMERR("Failed adding Filtering rule %pK with ret %d\n ", &qmi_rule_ex_msg, ret);
+ close(fd_wwan_ioctl);
+ return false;
+ }
}
}
-#endif
close(fd_wwan_ioctl);
return true;
diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp
index efa941c..0d4f54f 100644
--- a/ipacm/src/IPACM_Iface.cpp
+++ b/ipacm/src/IPACM_Iface.cpp
@@ -133,9 +133,8 @@ int IPACM_Iface::handle_software_routing_enable(bool mhip)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
sizeof(flt_rule_entry.rule.attrib));
@@ -772,10 +771,11 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = false;
- flt_rule_entry.rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = false;
+ flt_rule_entry.rule.hashable = false;
+ }
IPACMDBG_H("rx property attrib mask:0x%x\n", rx_prop->rx[0].attrib.attrib_mask);
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
@@ -791,19 +791,21 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
flt_rule_entry.rule.attrib.u.v4.dst_addr_mask = 0xF0000000;
flt_rule_entry.rule.attrib.u.v4.dst_addr = 0xE0000000;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[1]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
/* Configuring Broadcast Filtering Rule */
flt_rule_entry.rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
flt_rule_entry.rule.attrib.u.v4.dst_addr = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[2]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
#ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO
@@ -886,10 +888,11 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
/* Configuring fe80::/10 Link-Scoped Unicast Filtering Rule */
@@ -901,10 +904,11 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[1]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
/* Configuring fec0::/10 Reserved by IETF Filtering Rule */
@@ -916,10 +920,11 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[2]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
/* Configuring fd00::/8 Unique Local Ipv6 Address */
@@ -931,10 +936,11 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
flt_rule_entry.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
memcpy(&(m_pFilteringTable->rules[3]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
#ifdef FEATURE_IPA_ANDROID
@@ -964,11 +970,10 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
+ else
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<14);
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;
@@ -979,11 +984,10 @@ int IPACM_Iface::init_fl_rule(ipa_ip_type iptype)
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<7);
+ else
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<8);
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;
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index 3e825dd..2857f39 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -406,9 +406,8 @@ int IPACM_IfaceManager::create_iface_instance(ipacm_ifacemgr_data *param)
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN_V6, wl);
#endif
IPACM_EvtDispatcher::registr(IPA_PRIVATE_SUBNET_CHANGE_EVENT, wl); // register for IPA_PRIVATE_SUBNET_CHANGE_EVENT event
-#ifdef FEATURE_ETH_BRIDGE_LE
- IPACM_EvtDispatcher::registr(IPA_CFG_CHANGE_EVENT, wl);
-#endif
+ if (IPACM_Iface::ipacmcfg->isEthBridgingSupported())
+ IPACM_EvtDispatcher::registr(IPA_CFG_CHANGE_EVENT, wl);
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, wl);
IPACM_EvtDispatcher::registr(IPA_WLAN_LINK_DOWN_EVENT, wl);
#ifndef FEATURE_IPA_ANDROID
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 41c3723..0a532fd 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.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
@@ -342,20 +342,21 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param)
}
#endif
-#ifdef FEATURE_ETH_BRIDGE_LE
- if(rx_prop != NULL)
- {
- free(rx_prop);
- }
- if(tx_prop != NULL)
- {
- free(tx_prop);
- }
- if(iface_query != NULL)
+ if (IPACM_Iface::ipacmcfg->isEthBridgingSupported())
{
- free(iface_query);
+ if(rx_prop != NULL)
+ {
+ free(rx_prop);
+ }
+ if(tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
+ if(iface_query != NULL)
+ {
+ free(iface_query);
+ }
}
-#endif
delete this;
}
break;
@@ -1273,12 +1274,15 @@ int IPACM_Lan::handle_wan_down(ipacm_wan_iface_type backhaul_mode)
return IPACM_FAILURE;
}
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
-#ifndef FEATURE_IPA_V3
- flt_index.filter_index_list_len = 0;
-#else /* defined (FEATURE_IPA_V3) */
- flt_index.rule_id_valid = 1;
- flt_index.rule_id_len = 0;
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_index.filter_index_list_len = 0;
+ }
+ else /* IPAv3 */
+ {
+ flt_index.rule_id_valid = 1;
+ flt_index.rule_id_len = 0;
+ }
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
if ((int)flt_index.embedded_pipe_index == -1)
@@ -1371,9 +1375,8 @@ int IPACM_Lan::handle_addr_evt(ipacm_event_data_addr *data)
strlcpy(rt_rule->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.name, sizeof(rt_rule->rt_tbl_name));
rt_rule_entry->rule.attrib.u.v4.dst_addr = data->ipv4_addr;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -1449,9 +1452,8 @@ int IPACM_Lan::handle_addr_evt(ipacm_event_data_addr *data)
ipv6_addr[num_dft_rt_v6][1] = data->ipv6_addr[1];
ipv6_addr[num_dft_rt_v6][2] = data->ipv6_addr[2];
ipv6_addr[num_dft_rt_v6][3] = data->ipv6_addr[3];
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -1581,9 +1583,8 @@ int IPACM_Lan::handle_private_subnet(ipa_ip_type iptype)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
/* Support private subnet feature including guest-AP can't talk to primary AP etc */
flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_default_v4.hdl;
IPACMDBG_H(" private filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_default_v4.name);
@@ -1707,9 +1708,8 @@ int IPACM_Lan::handle_wan_up(ipa_ip_type ip_type)
{
flt_rule_entry.rule.action = IPA_PASS_TO_SRC_NAT; //IPA_PASS_TO_ROUTING
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_wan_v4.hdl;
memcpy(&flt_rule_entry.rule.attrib,
@@ -1796,9 +1796,8 @@ int IPACM_Lan::handle_wan_up(ipa_ip_type ip_type)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_v6.hdl;
memcpy(&flt_rule_entry.rule.attrib,
@@ -2458,9 +2457,8 @@ int IPACM_Lan::handle_eth_client_route_rule(uint8_t *mac_addr, ipa_ip_type iptyp
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -2490,9 +2488,8 @@ int IPACM_Lan::handle_eth_client_route_rule(uint8_t *mac_addr, ipa_ip_type iptyp
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -2773,9 +2770,8 @@ int IPACM_Lan::handle_odu_route_add()
{
rt_rule_entry->rule.attrib.u.v4.dst_addr = 0;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -2798,9 +2794,8 @@ int IPACM_Lan::handle_odu_route_add()
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -3281,25 +3276,25 @@ fail:
IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
IPACMDBG_H("Finished delete dependency \n ");
}
-#ifndef FEATURE_ETH_BRIDGE_LE
- free(rx_prop);
-#endif
+ if (!(IPACM_Iface::ipacmcfg->isEthBridgingSupported()))
+ free(rx_prop);
}
if (eth_client != NULL)
{
free(eth_client);
}
-#ifndef FEATURE_ETH_BRIDGE_LE
- if (tx_prop != NULL)
+ if (!(IPACM_Iface::ipacmcfg->isEthBridgingSupported()))
{
- free(tx_prop);
- }
- if (iface_query != NULL)
- {
- free(iface_query);
+ if (tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
+ if (iface_query != NULL)
+ {
+ free(iface_query);
+ }
}
-#endif
is_active = false;
post_del_self_evt();
@@ -3356,12 +3351,15 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp
}
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
-#ifndef FEATURE_IPA_V3
- flt_index.filter_index_list_len = prop->num_ext_props;
-#else /* defined (FEATURE_IPA_V3) */
- flt_index.rule_id_valid = 1;
- flt_index.rule_id_len = prop->num_ext_props;
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_index.filter_index_list_len = prop->num_ext_props;
+ }
+ else /* IPAv3 */
+ {
+ flt_index.rule_id_valid = 1;
+ flt_index.rule_id_len = prop->num_ext_props;
+ }
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
if ((int)flt_index.embedded_pipe_index == -1)
@@ -3377,13 +3375,16 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp
qmap_id = IPACM_Iface::ipacmcfg->GetQmapId();
xlat_debug = IPACM_Wan::getXlat_Mux_Id();
flt_index.embedded_call_mux_id = qmap_id;
-#ifndef FEATURE_IPA_V3
- IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d, xlat_mux id: %d, wan-debug %d\n",
- flt_index.source_pipe_index, flt_index.filter_index_list_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id, xlat_mux_id, xlat_debug);
-#else /* defined (FEATURE_IPA_V3) */
- IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d, xlat_mux id: %d, wan-debug %d\n",
- flt_index.source_pipe_index, flt_index.rule_id_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id, xlat_mux_id, xlat_debug);
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d, xlat_mux id: %d, wan-debug %d\n",
+ flt_index.source_pipe_index, flt_index.filter_index_list_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id, xlat_mux_id, xlat_debug);
+ }
+ else /* IPAv3 */
+ {
+ IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d, xlat_mux id: %d, wan-debug %d\n",
+ flt_index.source_pipe_index, flt_index.rule_id_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id, xlat_mux_id, xlat_debug);
+ }
len = sizeof(struct ipa_ioc_add_flt_rule) + prop->num_ext_props * sizeof(struct ipa_flt_rule_add);
pFilteringTable = (struct ipa_ioc_add_flt_rule*)malloc(len);
if (pFilteringTable == NULL)
@@ -3402,10 +3403,9 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp
memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add)); // Zero All Fields
flt_rule_entry.at_rear = 1;
-#ifdef FEATURE_IPA_V3
- if (flt_rule_entry.rule.eq_attrib.ipv4_frag_eq_present)
- flt_rule_entry.at_rear = 0;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ if (flt_rule_entry.rule.eq_attrib.ipv4_frag_eq_present)
+ flt_rule_entry.at_rear = 0;
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
@@ -3482,25 +3482,28 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp
{
flt_rule_entry.rule.eq_attrib.num_offset_meq_32++;
eq_index = flt_rule_entry.rule.eq_attrib.num_offset_meq_32 - 1;
-#ifdef FEATURE_IPA_V3
- if(eq_index == 0)
- {
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<5);
- }
- else
- {
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<6);
- }
-#else
- if(eq_index == 0)
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<2);
+ if(eq_index == 0)
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<5);
+ }
+ else
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<6);
+ }
}
else
{
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3);
+ if(eq_index == 0)
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<2);
+ }
+ else
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3);
+ }
}
-#endif
flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].offset = 12;
flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].mask = prefix[IPA_IP_v4].v4Mask;
flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].value = prefix[IPA_IP_v4].v4Addr;
@@ -3518,88 +3521,95 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp
{
flt_rule_entry.rule.eq_attrib.num_offset_meq_128++;
eq_index = flt_rule_entry.rule.eq_attrib.num_offset_meq_128 - 1;
-#ifdef FEATURE_IPA_V3
- if(eq_index == 0)
- {
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3);
- }
- else
- {
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<4);
- }
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0)
- = prefix[IPA_IP_v6].v6Mask[3];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4)
- = prefix[IPA_IP_v6].v6Mask[2];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8)
- = prefix[IPA_IP_v6].v6Mask[1];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12)
- = prefix[IPA_IP_v6].v6Mask[0];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0)
- = prefix[IPA_IP_v6].v6Addr[3];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4)
- = prefix[IPA_IP_v6].v6Addr[2];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8)
- = prefix[IPA_IP_v6].v6Addr[1];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12)
- = prefix[IPA_IP_v6].v6Addr[0];
-#else
- if(eq_index == 0)
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
+ if(eq_index == 0)
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3);
+ }
+ else
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<4);
+ }
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0)
+ = prefix[IPA_IP_v6].v6Mask[3];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4)
+ = prefix[IPA_IP_v6].v6Mask[2];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8)
+ = prefix[IPA_IP_v6].v6Mask[1];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12)
+ = prefix[IPA_IP_v6].v6Mask[0];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0)
+ = prefix[IPA_IP_v6].v6Addr[3];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4)
+ = prefix[IPA_IP_v6].v6Addr[2];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8)
+ = prefix[IPA_IP_v6].v6Addr[1];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12)
+ = prefix[IPA_IP_v6].v6Addr[0];
}
else
{
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<10);
+ if(eq_index == 0)
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
+ }
+ else
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<10);
+ }
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0)
+ = prefix[IPA_IP_v6].v6Mask[0];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4)
+ = prefix[IPA_IP_v6].v6Mask[1];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8)
+ = prefix[IPA_IP_v6].v6Mask[2];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12)
+ = prefix[IPA_IP_v6].v6Mask[3];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0)
+ = prefix[IPA_IP_v6].v6Addr[0];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4)
+ = prefix[IPA_IP_v6].v6Addr[1];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8)
+ = prefix[IPA_IP_v6].v6Addr[2];
+ *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12)
+ = prefix[IPA_IP_v6].v6Addr[3];
}
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0)
- = prefix[IPA_IP_v6].v6Mask[0];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4)
- = prefix[IPA_IP_v6].v6Mask[1];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8)
- = prefix[IPA_IP_v6].v6Mask[2];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12)
- = prefix[IPA_IP_v6].v6Mask[3];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0)
- = prefix[IPA_IP_v6].v6Addr[0];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4)
- = prefix[IPA_IP_v6].v6Addr[1];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8)
- = prefix[IPA_IP_v6].v6Addr[2];
- *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12)
- = prefix[IPA_IP_v6].v6Addr[3];
-#endif
flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].offset = 8;
}
else
{
IPACMERR("Run out of MEQ128 equation.\n");
- flt_rule_entry.rule.eq_attrib.num_offset_meq_128--;
+ flt_rule_entry.rule.eq_attrib.num_offset_meq_128--;
}
}
-#endif
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = prop->prop[cnt].is_rule_hashable;
- flt_rule_entry.rule.rule_id = prop->prop[cnt].rule_id;
- if(rx_prop->rx[0].attrib.attrib_mask & IPA_FLT_META_DATA) //turn on meta-data equation
+#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
- 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.hashable = prop->prop[cnt].is_rule_hashable;
+ flt_rule_entry.rule.rule_id = prop->prop[cnt].rule_id;
+ if(rx_prop->rx[0].attrib.attrib_mask & IPA_FLT_META_DATA) //turn on meta-data equation
+ {
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
+ 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;
+ }
}
-#endif
memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
-#ifndef FEATURE_IPA_V3
- flt_index.filter_index_list[cnt].filter_index = index;
- flt_index.filter_index_list[cnt].filter_handle = prop->prop[cnt].filter_hdl;
-#else /* defined (FEATURE_IPA_V3) */
- flt_index.rule_id[cnt] = prop->prop[cnt].rule_id;
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_index.filter_index_list[cnt].filter_index = index;
+ flt_index.filter_index_list[cnt].filter_handle = prop->prop[cnt].filter_hdl;
+ }
+ else /* IPAv3 */
+ {
+ flt_index.rule_id[cnt] = prop->prop[cnt].rule_id;
+ }
index++;
}
@@ -3717,12 +3727,15 @@ int IPACM_Lan::handle_wan_down_v6(ipacm_wan_iface_type backhaul_mode)
return IPACM_FAILURE;
}
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
-#ifndef FEATURE_IPA_V3
- flt_index.filter_index_list_len = 0;
-#else /* defined (FEATURE_IPA_V3) */
- flt_index.rule_id_valid = 1;
- flt_index.rule_id_len = 0;
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_index.filter_index_list_len = 0;
+ }
+ else /* IPAv3 */
+ {
+ flt_index.rule_id_valid = 1;
+ flt_index.rule_id_len = 0;
+ }
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
if ((int)flt_index.embedded_pipe_index == -1)
@@ -3947,9 +3960,8 @@ int IPACM_Lan::install_ipv4_icmp_flt_rule()
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_PROTOCOL;
@@ -4020,9 +4032,8 @@ int IPACM_Lan::install_ipv6_icmp_flt_rule()
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = false;
memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR;
flt_rule_entry.rule.attrib.u.v6.next_hdr = (uint8_t)IPACM_FIREWALL_IPPROTO_ICMP6;
@@ -4099,9 +4110,8 @@ int IPACM_Lan::add_dummy_private_subnet_flt_rule(ipa_ip_type iptype)
flt_rule.flt_rule_hdl = -1;
flt_rule.status = -1;
flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule.rule.hashable = true;
memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib,
sizeof(flt_rule.rule.attrib));
@@ -4320,9 +4330,8 @@ int IPACM_Lan::install_ipv6_prefix_flt_rule(uint32_t* prefix)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
flt_rule_entry.rule.attrib.u.v6.dst_addr[0] = prefix[0];
@@ -5036,9 +5045,8 @@ int IPACM_Lan::eth_bridge_add_rt_rule(uint8_t *mac, char *rt_tbl_name, uint32_t
rt_rule.at_rear = false;
rt_rule.status = -1;
rt_rule.rt_rule_hdl = -1;
-#ifdef FEATURE_IPA_V3
- rt_rule.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule.rule.hashable = true;
rt_rule.rule.hdr_hdl = 0;
rt_rule.rule.hdr_proc_ctx_hdl = hdr_proc_ctx_hdl;
@@ -5170,9 +5178,8 @@ int IPACM_Lan::eth_bridge_modify_rt_rule(uint8_t *mac, uint32_t hdr_proc_ctx_hdl
rt_rule_entry->rule.hdr_hdl = 0;
rt_rule_entry->rule.hdr_proc_ctx_hdl = hdr_proc_ctx_hdl;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
memcpy(&rt_rule_entry->rule.attrib, &tx_prop->tx[index].attrib,
sizeof(rt_rule_entry->rule.attrib));
if(peer_l2_hdr_type == IPA_HDR_L2_ETHERNET_II)
@@ -5211,90 +5218,92 @@ end:
int IPACM_Lan::eth_bridge_add_flt_rule(uint8_t *mac, uint32_t rt_tbl_hdl, ipa_ip_type iptype, uint32_t *flt_rule_hdl)
{
int res = IPACM_SUCCESS;
-
- IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- IPACMDBG_H("Received rt_tbl_hdl :%d iptype %d\n", rt_tbl_hdl,iptype);
- *flt_rule_hdl = 0;
-
-#ifdef FEATURE_IPA_V3
int len;
struct ipa_flt_rule_add flt_rule_entry;
struct ipa_ioc_add_flt_rule_after *pFilteringTable = NULL;
bool result;
- if (rx_prop == NULL || tx_prop == NULL)
+ IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ IPACMDBG_H("Received rt_tbl_hdl :%d iptype %d\n", rt_tbl_hdl,iptype);
+ *flt_rule_hdl = 0;
+
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
- return IPACM_FAILURE;
- }
+ if (rx_prop == NULL || tx_prop == NULL)
+ {
+ IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
+ return IPACM_FAILURE;
+ }
- len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
- pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
- if (!pFilteringTable)
- {
- IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
- return IPACM_FAILURE;
- }
- memset(pFilteringTable, 0, len);
+ len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
+ pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
+ if (!pFilteringTable)
+ {
+ IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
+ return IPACM_FAILURE;
+ }
+ memset(pFilteringTable, 0, len);
- /* add mac based rule*/
- pFilteringTable->commit = 1;
- pFilteringTable->ep = rx_prop->rx[0].src_pipe;
- pFilteringTable->ip = iptype;
- pFilteringTable->num_rules = 1;
- pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[iptype];
+ /* add mac based rule*/
+ pFilteringTable->commit = 1;
+ pFilteringTable->ep = rx_prop->rx[0].src_pipe;
+ pFilteringTable->ip = iptype;
+ pFilteringTable->num_rules = 1;
+ pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[iptype];
- memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
- flt_rule_entry.at_rear = 1;
+ memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
+ flt_rule_entry.at_rear = 1;
- flt_rule_entry.rule.retain_hdr = 0;
- flt_rule_entry.rule.to_uc = 0;
- flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
- flt_rule_entry.rule.eq_attrib_type = 0;
- flt_rule_entry.rule.rt_tbl_hdl = rt_tbl_hdl;
- flt_rule_entry.rule.hashable = true;
+ flt_rule_entry.rule.retain_hdr = 0;
+ flt_rule_entry.rule.to_uc = 0;
+ flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
+ flt_rule_entry.rule.eq_attrib_type = 0;
+ flt_rule_entry.rule.rt_tbl_hdl = rt_tbl_hdl;
+ flt_rule_entry.rule.hashable = true;
- memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
- if(tx_prop->tx[0].hdr_l2_type == IPA_HDR_L2_ETHERNET_II)
- {
- flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
- }
- else
- {
- flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
- }
+ memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+ if(tx_prop->tx[0].hdr_l2_type == IPA_HDR_L2_ETHERNET_II)
+ {
+ flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
+ }
+ else
+ {
+ flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
+ }
- memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
- memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
+ memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
+ memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
- memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
+ memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
#ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO
- /* use index hw-counter */
- if(ipa_if_cate == WLAN_IF && IPACM_Iface::ipacmcfg->hw_fnr_stats_support)
- {
- IPACMDBG_H("hw-index-enable %d, counter %d\n", IPACM_Iface::ipacmcfg->hw_fnr_stats_support, IPACM_Iface::ipacmcfg->hw_counter_offset + UL_ALL);
- result = m_filtering.AddFilteringRuleAfter_hw_index(pFilteringTable, IPACM_Iface::ipacmcfg->hw_counter_offset + UL_ALL);
- } else {
- result = m_filtering.AddFilteringRuleAfter(pFilteringTable);
- }
+ /* use index hw-counter */
+ if(ipa_if_cate == WLAN_IF && IPACM_Iface::ipacmcfg->hw_fnr_stats_support)
+ {
+ IPACMDBG_H("hw-index-enable %d, counter %d\n", IPACM_Iface::ipacmcfg->hw_fnr_stats_support, IPACM_Iface::ipacmcfg->hw_counter_offset + UL_ALL);
+ result = m_filtering.AddFilteringRuleAfter_hw_index(pFilteringTable, IPACM_Iface::ipacmcfg->hw_counter_offset + UL_ALL);
+ } else {
+ result = m_filtering.AddFilteringRuleAfter(pFilteringTable);
+ }
#else
- result = m_filtering.AddFilteringRuleAfter(pFilteringTable);
+ result = m_filtering.AddFilteringRuleAfter(pFilteringTable);
#endif
- if (result == false)
- {
- IPACMERR("Failed to add client filtering rules.\n");
- res = IPACM_FAILURE;
- goto end;
- }
- *flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
+ if (result == false)
+ {
+ IPACMERR("Failed to add client filtering rules.\n");
+ res = IPACM_FAILURE;
+ goto end;
+ }
+ *flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
end:
- free(pFilteringTable);
-#else
- IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- IPACMDBG_H("Not support rt_tbl_hdl %d flt_rule_hdl %p ip-type %d\n", rt_tbl_hdl, flt_rule_hdl, iptype);
-#endif
+ free(pFilteringTable);
+ }
+ else
+ {
+ IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ IPACMDBG_H("Not support rt_tbl_hdl %d flt_rule_hdl %p ip-type %d\n", rt_tbl_hdl, flt_rule_hdl, iptype);
+ }
return res;
}
@@ -5895,78 +5904,79 @@ int IPACM_Lan::add_l2tp_flt_rule(uint8_t *dst_mac, uint32_t *flt_rule_hdl)
struct ipa_ioc_add_flt_rule_after *pFilteringTable = NULL;
ipa_ioc_get_rt_tbl rt_tbl;
-#ifdef FEATURE_IPA_V3
- if (rx_prop == NULL || tx_prop == NULL)
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
- return IPACM_FAILURE;
- }
+ if (rx_prop == NULL || tx_prop == NULL)
+ {
+ IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
+ return IPACM_FAILURE;
+ }
- len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
- pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
- if (!pFilteringTable)
- {
- IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
- return IPACM_FAILURE;
- }
- memset(pFilteringTable, 0, len);
+ len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
+ pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
+ if (!pFilteringTable)
+ {
+ IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
+ return IPACM_FAILURE;
+ }
+ memset(pFilteringTable, 0, len);
- pFilteringTable->commit = 1;
- pFilteringTable->ep = rx_prop->rx[0].src_pipe;
- pFilteringTable->ip = IPA_IP_v6;
- pFilteringTable->num_rules = 1;
- pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[IPA_IP_v6];
+ pFilteringTable->commit = 1;
+ pFilteringTable->ep = rx_prop->rx[0].src_pipe;
+ pFilteringTable->ip = IPA_IP_v6;
+ pFilteringTable->num_rules = 1;
+ pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[IPA_IP_v6];
- fd_ipa = open(IPA_DEVICE_NAME, O_RDWR);
- if(fd_ipa == 0)
- {
- IPACMERR("Failed to open %s\n",IPA_DEVICE_NAME);
- free(pFilteringTable);
- return IPACM_FAILURE;
- }
+ fd_ipa = open(IPA_DEVICE_NAME, O_RDWR);
+ if(fd_ipa == 0)
+ {
+ IPACMERR("Failed to open %s\n",IPA_DEVICE_NAME);
+ free(pFilteringTable);
+ return IPACM_FAILURE;
+ }
- rt_tbl.ip = IPA_IP_v6;
- snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
- rt_tbl.name[IPA_RESOURCE_NAME_MAX-1] = '\0';
- IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
- if(m_routing.GetRoutingTable(&rt_tbl) == false)
- {
- IPACMERR("Failed to get routing table from name\n");
- free(pFilteringTable);
- close(fd_ipa);
- return IPACM_FAILURE;
- }
+ rt_tbl.ip = IPA_IP_v6;
+ snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
+ rt_tbl.name[IPA_RESOURCE_NAME_MAX-1] = '\0';
+ IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
+ if(m_routing.GetRoutingTable(&rt_tbl) == false)
+ {
+ IPACMERR("Failed to get routing table from name\n");
+ free(pFilteringTable);
+ close(fd_ipa);
+ return IPACM_FAILURE;
+ }
- memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
- flt_rule_entry.at_rear = 1;
+ memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
+ flt_rule_entry.at_rear = 1;
- flt_rule_entry.rule.retain_hdr = 0;
- flt_rule_entry.rule.to_uc = 0;
- flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
- flt_rule_entry.rule.eq_attrib_type = 0;
- flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
- flt_rule_entry.rule.hashable = false; //ETH->WLAN direction rules need to be non-hashable due to encapsulation
+ flt_rule_entry.rule.retain_hdr = 0;
+ flt_rule_entry.rule.to_uc = 0;
+ flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
+ flt_rule_entry.rule.eq_attrib_type = 0;
+ flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
+ flt_rule_entry.rule.hashable = false; //ETH->WLAN direction rules need to be non-hashable due to encapsulation
- memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+ memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
- /* flt rule is matching dst MAC within 62 bytes header */
- flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_L2TP;
- memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
- memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, dst_mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
+ /* flt rule is matching dst MAC within 62 bytes header */
+ flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_L2TP;
+ memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
+ memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, dst_mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
+
+ memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
+ if(m_filtering.AddFilteringRuleAfter(pFilteringTable) == false)
+ {
+ IPACMERR("Failed to add client filtering rules.\n");
+ free(pFilteringTable);
+ close(fd_ipa);
+ return IPACM_FAILURE;
+ }
+ *flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
- memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
- if(m_filtering.AddFilteringRuleAfter(pFilteringTable) == false)
- {
- IPACMERR("Failed to add client filtering rules.\n");
free(pFilteringTable);
close(fd_ipa);
- return IPACM_FAILURE;
}
- *flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
-
- free(pFilteringTable);
- close(fd_ipa);
-#endif
return IPACM_SUCCESS;
}
@@ -5990,122 +6000,123 @@ int IPACM_Lan::add_l2tp_flt_rule(ipa_ip_type iptype, uint8_t *dst_mac, uint32_t
struct ipa_ioc_add_flt_rule_after *pFilteringTable = NULL;
ipa_ioc_get_rt_tbl rt_tbl;
-#ifdef FEATURE_IPA_V3
- if (rx_prop == NULL || tx_prop == NULL)
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
{
- IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
- return IPACM_FAILURE;
- }
+ if (rx_prop == NULL || tx_prop == NULL)
+ {
+ IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
+ return IPACM_FAILURE;
+ }
- IPACMDBG_H("Dst client MAC 0x%02x%02x%02x%02x%02x%02x.\n", dst_mac[0], dst_mac[1],
- dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5]);
+ IPACMDBG_H("Dst client MAC 0x%02x%02x%02x%02x%02x%02x.\n", dst_mac[0], dst_mac[1],
+ dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5]);
- len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
- pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
- if (!pFilteringTable)
- {
- IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
- return IPACM_FAILURE;
- }
- memset(pFilteringTable, 0, len);
+ len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
+ pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
+ if (!pFilteringTable)
+ {
+ IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
+ return IPACM_FAILURE;
+ }
+ memset(pFilteringTable, 0, len);
- pFilteringTable->commit = 1;
- pFilteringTable->ep = rx_prop->rx[0].src_pipe;
- pFilteringTable->ip = iptype;
- pFilteringTable->num_rules = 1;
- pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[iptype];
+ pFilteringTable->commit = 1;
+ pFilteringTable->ep = rx_prop->rx[0].src_pipe;
+ pFilteringTable->ip = iptype;
+ pFilteringTable->num_rules = 1;
+ pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[iptype];
- /* =========== add first pass flt rule (match dst MAC) ============= */
- rt_tbl.ip = iptype;
- snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
- IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
+ /* =========== add first pass flt rule (match dst MAC) ============= */
+ rt_tbl.ip = iptype;
+ snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
+ IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
- if(m_routing.GetRoutingTable(&rt_tbl) == false)
- {
- IPACMERR("Failed to get routing table.\n");
- return IPACM_FAILURE;
- }
+ if(m_routing.GetRoutingTable(&rt_tbl) == false)
+ {
+ IPACMERR("Failed to get routing table.\n");
+ return IPACM_FAILURE;
+ }
- memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
- flt_rule_entry.at_rear = 1;
+ memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
+ flt_rule_entry.at_rear = 1;
- flt_rule_entry.rule.retain_hdr = 0;
- flt_rule_entry.rule.to_uc = 0;
- flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
- flt_rule_entry.rule.eq_attrib_type = 0;
- flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
- flt_rule_entry.rule.hashable = false; //WLAN->ETH direction rules are set to non-hashable to keep consistent with the other direction
+ flt_rule_entry.rule.retain_hdr = 0;
+ flt_rule_entry.rule.to_uc = 0;
+ flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
+ flt_rule_entry.rule.eq_attrib_type = 0;
+ flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
+ flt_rule_entry.rule.hashable = false; //WLAN->ETH direction rules are set to non-hashable to keep consistent with the other direction
- memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
- if(tx_prop->tx[0].hdr_l2_type == IPA_HDR_L2_ETHERNET_II)
- {
- flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
- }
- else
- {
- flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
- }
+ memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+ if(tx_prop->tx[0].hdr_l2_type == IPA_HDR_L2_ETHERNET_II)
+ {
+ flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
+ }
+ else
+ {
+ flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
+ }
- memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, dst_mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
- memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
+ memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, dst_mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
+ memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
- memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
- if (false == m_filtering.AddFilteringRuleAfter(pFilteringTable))
- {
- IPACMERR("Failed to add first pass filtering rules.\n");
- free(pFilteringTable);
- return IPACM_FAILURE;
- }
- *first_pass_flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
+ memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
+ if (false == m_filtering.AddFilteringRuleAfter(pFilteringTable))
+ {
+ IPACMERR("Failed to add first pass filtering rules.\n");
+ free(pFilteringTable);
+ return IPACM_FAILURE;
+ }
+ *first_pass_flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
- /* =========== add second pass flt rule (match VLAN interface IPv6 address at client side) ============= */
- if(*second_pass_flt_rule_hdl != 0)
- {
- IPACMDBG_H("Second pass flt rule was added before, return.\n");
- free(pFilteringTable);
- return IPACM_SUCCESS;
- }
+ /* =========== add second pass flt rule (match VLAN interface IPv6 address at client side) ============= */
+ if(*second_pass_flt_rule_hdl != 0)
+ {
+ IPACMDBG_H("Second pass flt rule was added before, return.\n");
+ free(pFilteringTable);
+ return IPACM_SUCCESS;
+ }
- rt_tbl.ip = IPA_IP_v6;
- snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
- IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
+ rt_tbl.ip = IPA_IP_v6;
+ snprintf(rt_tbl.name, sizeof(rt_tbl.name), "l2tp");
+ IPACMDBG_H("This flt rule points to rt tbl %s.\n", rt_tbl.name);
- if(m_routing.GetRoutingTable(&rt_tbl) == false)
- {
- IPACMERR("Failed to get routing table.\n");
- return IPACM_FAILURE;
- }
+ if(m_routing.GetRoutingTable(&rt_tbl) == false)
+ {
+ IPACMERR("Failed to get routing table.\n");
+ return IPACM_FAILURE;
+ }
- pFilteringTable->ip = IPA_IP_v6;
- pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[IPA_IP_v6];
+ pFilteringTable->ip = IPA_IP_v6;
+ pFilteringTable->add_after_hdl = eth_bridge_flt_rule_offset[IPA_IP_v6];
- memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
- flt_rule_entry.at_rear = 1;
+ memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
+ flt_rule_entry.at_rear = 1;
- flt_rule_entry.rule.retain_hdr = 0;
- flt_rule_entry.rule.to_uc = 0;
- flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
- flt_rule_entry.rule.eq_attrib_type = 0;
- flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
- flt_rule_entry.rule.hashable = false; //WLAN->ETH direction rules are set to non-hashable to keep consistent with the other direction
+ flt_rule_entry.rule.retain_hdr = 0;
+ flt_rule_entry.rule.to_uc = 0;
+ flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
+ flt_rule_entry.rule.eq_attrib_type = 0;
+ flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
+ flt_rule_entry.rule.hashable = false; //WLAN->ETH direction rules are set to non-hashable to keep consistent with the other direction
- memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
- flt_rule_entry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
+ memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+ flt_rule_entry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- memcpy(flt_rule_entry.rule.attrib.u.v6.dst_addr, vlan_client_ipv6_addr, sizeof(flt_rule_entry.rule.attrib.u.v6.dst_addr));
- memset(flt_rule_entry.rule.attrib.u.v6.dst_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.u.v6.dst_addr_mask));
+ memcpy(flt_rule_entry.rule.attrib.u.v6.dst_addr, vlan_client_ipv6_addr, sizeof(flt_rule_entry.rule.attrib.u.v6.dst_addr));
+ memset(flt_rule_entry.rule.attrib.u.v6.dst_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.u.v6.dst_addr_mask));
+
+ memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
+ if (false == m_filtering.AddFilteringRuleAfter(pFilteringTable))
+ {
+ IPACMERR("Failed to add client filtering rules.\n");
+ free(pFilteringTable);
+ return IPACM_FAILURE;
+ }
+ *second_pass_flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
- memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
- if (false == m_filtering.AddFilteringRuleAfter(pFilteringTable))
- {
- IPACMERR("Failed to add client filtering rules.\n");
free(pFilteringTable);
- return IPACM_FAILURE;
}
- *second_pass_flt_rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
-
- free(pFilteringTable);
-#endif
return IPACM_SUCCESS;
}
@@ -6328,9 +6339,8 @@ int IPACM_Lan::add_connection(int client_index, int v6_num)
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
flt_rule_entry.rule.attrib.u.v6.dst_addr[0] = get_client_memptr(eth_client, client_index)->v6_addr[v6_num][0];
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = get_client_memptr(eth_client, client_index)->v6_addr[v6_num][1];
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index afdf26d..696f518 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -951,11 +951,11 @@ int main(int argc, char **argv)
IPACMDBG_H(" START IPACM_OffloadManager and link to android framework\n");
#endif
-#ifdef FEATURE_ETH_BRIDGE_LE
- IPACM_LanToLan* lan2lan = IPACM_LanToLan::get_instance();
- IPACMDBG_H("Staring IPACM_LanToLan instance %p\n", lan2lan);
-#endif
-
+ if (IPACM_Iface::ipacmcfg->isEthBridgingSupported())
+ {
+ IPACM_LanToLan* lan2lan = IPACM_LanToLan::get_instance();
+ IPACMDBG_H("Staring IPACM_LanToLan instance %p\n", lan2lan);
+ }
CtList = new IPACM_ConntrackListener();
IPACMDBG_H("Staring IPA main\n");
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index be3bffc..847e08d 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -295,9 +295,8 @@ int IPACM_Wan::handle_addr_evt(ipacm_event_data_addr *data)
ipv6_addr[num_dft_rt_v6][1] = data->ipv6_addr[1];
ipv6_addr[num_dft_rt_v6][2] = data->ipv6_addr[2];
ipv6_addr[num_dft_rt_v6][3] = data->ipv6_addr[3];
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
if(m_is_sta_mode == Q6_WAN)
{
strlcpy(hdr.name, tx_prop->tx[0].hdr_name, sizeof(hdr.name));
@@ -491,9 +490,8 @@ int IPACM_Wan::handle_addr_evt(ipacm_event_data_addr *data)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
@@ -599,9 +597,8 @@ int IPACM_Wan::handle_addr_evt(ipacm_event_data_addr *data)
strlcpy(rt_rule->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.name, sizeof(rt_rule->rt_tbl_name));
rt_rule_entry->rule.attrib.u.v4.dst_addr = data->ipv4_addr;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
if(m_is_sta_mode == Q6_WAN)
{
/* query qmap header*/
@@ -854,9 +851,8 @@ int IPACM_Wan::handle_addr_evt_mhi_q6(ipacm_event_data_addr *data)
ipv6_addr[0][1] = data->ipv6_addr[1];
ipv6_addr[0][2] = data->ipv6_addr[2];
ipv6_addr[0][3] = data->ipv6_addr[3];
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -935,9 +931,8 @@ int IPACM_Wan::handle_addr_evt_mhi_q6(ipacm_event_data_addr *data)
strlcpy(rt_rule->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.name, sizeof(rt_rule->rt_tbl_name));
rt_rule_entry->rule.attrib.u.v4.dst_addr = data->ipv4_addr;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -1987,9 +1982,8 @@ int IPACM_Wan::handle_route_add_evt(ipa_ip_type iptype)
{
rt_rule_entry->rule.attrib.u.v4.dst_addr = 0;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
#ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO
/* use index hw-counter */
if((m_is_sta_mode == WLAN_WAN) && IPACM_Iface::ipacmcfg->hw_fnr_stats_support)
@@ -2024,9 +2018,8 @@ int IPACM_Wan::handle_route_add_evt(ipa_ip_type iptype)
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
#ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO
/* use index hw-counter */
if((m_is_sta_mode == WLAN_WAN) && IPACM_Iface::ipacmcfg->hw_fnr_stats_support)
@@ -2098,9 +2091,8 @@ int IPACM_Wan::handle_route_add_evt(ipa_ip_type iptype)
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -2591,10 +2583,11 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add));
flt_rule_entry.at_rear = true;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = false;
- flt_rule_entry.rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = false;
+ flt_rule_entry.rule.hashable = false;
+ }
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
@@ -2686,10 +2679,11 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
}
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = true;
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = true;
+ flt_rule_entry.rule.hashable = true;
+ }
flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.hdl;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
@@ -2783,9 +2777,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
{
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&firewall_config.extd_firewall_entries[i].attrib,
sizeof(struct ipa_rule_attrib));
@@ -2953,9 +2946,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
}
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.hdl;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
@@ -3020,9 +3012,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.rule.retain_hdr = 1;
flt_rule_entry.rule.eq_attrib_type = 0;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
sizeof(struct ipa_rule_attrib));
@@ -3093,9 +3084,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.at_rear = true;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
sizeof(struct ipa_rule_attrib));
@@ -3183,10 +3173,9 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
{
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
- flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_wan_v6.hdl;
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
+ flt_rule_entry.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_wan_v6.hdl;
memcpy(&flt_rule_entry.rule.attrib,
&firewall_config.extd_firewall_entries[i].attrib,
sizeof(struct ipa_rule_attrib));
@@ -3304,9 +3293,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.rule.retain_hdr = 1;
flt_rule_entry.rule.eq_attrib_type = 0;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
sizeof(struct ipa_rule_attrib));
@@ -3368,9 +3356,8 @@ int IPACM_Wan::config_dft_firewall_rules(ipa_ip_type iptype)
flt_rule_entry.at_rear = true;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
sizeof(struct ipa_rule_attrib));
@@ -3467,9 +3454,8 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
{
memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add));
flt_rule_entry.at_rear = true;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.at_rear = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.at_rear = false;
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
@@ -3477,10 +3463,11 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
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.at_rear = false;
- flt_rule_entry.rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ flt_rule_entry.at_rear = false;
+ flt_rule_entry.rule.hashable = false;
+ }
memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx));
rt_tbl_idx.ip = IPA_IP_v6;
strlcpy(rt_tbl_idx.name, IPACM_Iface::ipacmcfg->rt_tbl_wan_dl.name, IPA_RESOURCE_NAME_MAX);
@@ -3546,9 +3533,8 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
{
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx));
rt_tbl_idx.ip = iptype;
if(flt_rule_entry.rule.action == IPA_PASS_TO_ROUTING)
@@ -3683,9 +3669,8 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
flt_rule_entry.rule.action = IPA_PASS_TO_DST_NAT;
}
}
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx));
rt_tbl_idx.ip = iptype;
@@ -3758,9 +3743,8 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx));
rt_tbl_idx.ip = iptype;
@@ -3871,9 +3855,8 @@ int IPACM_Wan::config_dft_firewall_rules_ex(struct ipa_flt_rule_add *rules, int
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
memset(&rt_tbl_idx, 0, sizeof(rt_tbl_idx));
rt_tbl_idx.ip = iptype;
/* firewall disable, all traffic are allowed */
@@ -4025,9 +4008,8 @@ int IPACM_Wan::add_icmp_alg_rules(struct ipa_flt_rule_add *rules, int rule_offse
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
/* Configuring ICMP filtering rule */
@@ -4143,9 +4125,8 @@ int IPACM_Wan::add_icmp_alg_rules(struct ipa_flt_rule_add *rules, int rule_offse
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
/* Configuring ICMP filtering rule */
@@ -4225,15 +4206,18 @@ int IPACM_Wan::query_ext_prop()
for (cnt = 0; cnt < ext_prop->num_ext_props; cnt++)
{
-#ifndef FEATURE_IPA_V3
- IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, is_xlat_rule: %d flt_hdl: %d\n",
- cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action,
- ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].is_xlat_rule, ext_prop->ext[cnt].filter_hdl);
-#else /* defined (FEATURE_IPA_V3) */
- IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, is_xlat_rule: %d rule_id: %d\n",
- cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action,
- ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].is_xlat_rule, ext_prop->ext[cnt].rule_id);
-#endif
+ if (!IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ {
+ IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, is_xlat_rule: %d flt_hdl: %d\n",
+ cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action,
+ ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].is_xlat_rule, ext_prop->ext[cnt].filter_hdl);
+ }
+ else /* IPA_V3 */
+ {
+ IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, is_xlat_rule: %d rule_id: %d\n",
+ cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action,
+ ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].is_xlat_rule, ext_prop->ext[cnt].rule_id);
+ }
}
if(IPACM_Wan::is_ext_prop_set == false)
@@ -4346,9 +4330,8 @@ int IPACM_Wan::add_dft_filtering_rule(struct ipa_flt_rule_add *rules, int rule_o
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
IPACMDBG_H("rx property attrib mask:0x%x\n", rx_prop->rx[0].attrib.attrib_mask);
@@ -4429,9 +4412,8 @@ int IPACM_Wan::add_dft_filtering_rule(struct ipa_flt_rule_add *rules, int rule_o
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
/* Configuring Multicast Filtering Rule */
@@ -4628,11 +4610,10 @@ int IPACM_Wan::add_tcpv6_filtering_rule(struct ipa_flt_rule_add *rules, int rule
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<7);
+ else
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<8);
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;
@@ -5142,9 +5123,8 @@ int IPACM_Wan::config_dft_embms_rules(ipa_ioc_add_flt_rule *pFilteringTable_v4,
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
memcpy(&flt_rule_entry.rule.attrib,
@@ -5191,9 +5171,8 @@ int IPACM_Wan::config_dft_embms_rules(ipa_ioc_add_flt_rule *pFilteringTable_v4,
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
memcpy(&flt_rule_entry.rule.attrib,
@@ -5926,9 +5905,8 @@ int IPACM_Wan::install_wan_filtering_rule(bool is_sw_routing)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
@@ -5988,9 +5966,8 @@ int IPACM_Wan::install_wan_filtering_rule(bool is_sw_routing)
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
@@ -6618,9 +6595,8 @@ int IPACM_Wan::handle_wan_client_route_rule(uint8_t *mac_addr, ipa_ip_type iptyp
rt_rule_entry->rule.hdr_hdl = get_client_memptr(wan_client, wan_index)->hdr_hdl_v4;
rt_rule_entry->rule.attrib.u.v4.dst_addr = get_client_memptr(wan_client, wan_index)->v4_addr;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -6668,9 +6644,8 @@ int IPACM_Wan::handle_wan_client_route_rule(uint8_t *mac_addr, ipa_ip_type iptyp
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -7244,9 +7219,8 @@ int IPACM_Wan::handle_coalesce_evt()
strlcpy(rt_rule->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_lan_v4.name, sizeof(rt_rule->rt_tbl_name));
rt_rule_entry->rule.attrib.u.v4.dst_addr = wan_v4_addr;
rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
/* query qmap header*/
memset(&hdr, 0, sizeof(hdr));
strlcpy(hdr.name, tx_prop->tx[0].hdr_name, sizeof(hdr.name));
@@ -7376,9 +7350,8 @@ fail:
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = false;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = false;
strlcpy(hdr.name, tx_prop->tx[0].hdr_name, sizeof(hdr.name));
hdr.name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if(m_header.GetHeaderHandle(&hdr) == false)
@@ -7519,9 +7492,8 @@ int IPACM_Wan::add_offload_frag_rule()
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
IPACMDBG_H("rx property attrib mask:0x%x\n", rx_prop->rx[0].attrib.attrib_mask);
memcpy(&flt_rule_entry.rule.attrib,
&rx_prop->rx[0].attrib,
@@ -7660,9 +7632,8 @@ int IPACM_Wan::add_icmpv6_exception_rule()
flt_rule_entry.flt_rule_hdl = -1;
flt_rule_entry.status = -1;
flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
- flt_rule_entry.rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
IPACMDBG_H("rx property attrib mask:0x%x\n", rx_prop->rx[0].attrib.attrib_mask);
memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR;
@@ -7833,11 +7804,10 @@ int IPACM_Wan::add_tcp_fin_rst_exception_rule()
sizeof(flt_rule_entry.rule.eq_attrib));
/* set the bit mask to use MEQ32_IHL offset */
- #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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<7);
+ else
+ flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<8);
/* add offset to compare TCP flags */
flt_rule_entry.rule.eq_attrib.num_ihl_offset_meq_32 = 1;
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index d5d38ca..689cc78 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -206,20 +206,21 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param)
IPACMDBG_H("Received IPA_LAN_DELETE_SELF event.\n");
IPACMDBG_H("ipa_WLAN (%s):ipa_index (%d) instance close \n", IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, ipa_if_num);
-#ifdef FEATURE_ETH_BRIDGE_LE
- if(rx_prop != NULL)
+ if (IPACM_Iface::ipacmcfg->isEthBridgingSupported())
{
- free(rx_prop);
- }
- if(tx_prop != NULL)
- {
- free(tx_prop);
- }
- if(iface_query != NULL)
- {
- free(iface_query);
+ if(rx_prop != NULL)
+ {
+ free(rx_prop);
+ }
+ if(tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
+ if(iface_query != NULL)
+ {
+ free(iface_query);
+ }
}
-#endif
delete this;
}
break;
@@ -1633,9 +1634,8 @@ int IPACM_Wlan::handle_wlan_client_route_rule(uint8_t *mac_addr, ipa_ip_type ipt
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
if (false == m_routing.AddRoutingRule(rt_rule))
{
IPACMERR("Routing rule addition failed!\n");
@@ -1685,9 +1685,8 @@ int IPACM_Wlan::handle_wlan_client_route_rule(uint8_t *mac_addr, ipa_ip_type ipt
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[2] = 0xFFFFFFFF;
rt_rule_entry->rule.attrib.u.v6.dst_addr_mask[3] = 0xFFFFFFFF;
-#ifdef FEATURE_IPA_V3
- rt_rule_entry->rule.hashable = true;
-#endif
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ rt_rule_entry->rule.hashable = true;
#ifdef IPA_IOCTL_SET_FNR_COUNTER_INFO
/* use index hw-counter */
if(IPACM_Iface::ipacmcfg->hw_fnr_stats_support)
@@ -2137,9 +2136,8 @@ fail:
IPACMDBG_H("depend Got pipe %d rm index : %d \n", rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
}
-#ifndef FEATURE_ETH_BRIDGE_LE
- free(rx_prop);
-#endif
+ if (!(IPACM_Iface::ipacmcfg->isEthBridgingSupported()))
+ free(rx_prop);
}
for (i = 0; i < num_wifi_client; i++)
@@ -2153,17 +2151,18 @@ fail:
{
free(wlan_client);
}
-#ifndef FEATURE_ETH_BRIDGE_LE
- if (tx_prop != NULL)
+ if (!(IPACM_Iface::ipacmcfg->isEthBridgingSupported()))
{
- free(tx_prop);
- }
+ if (tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
- if (iface_query != NULL)
- {
- free(iface_query);
+ if (iface_query != NULL)
+ {
+ free(iface_query);
+ }
}
-#endif
is_active = false;
post_del_self_evt();
@@ -2504,9 +2503,8 @@ int IPACM_Wlan::add_connection(int client_index, int v6_num)
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
+ if (IPACM_Iface::ipacmcfg->isIPAv3Supported())
+ flt_rule_entry.rule.hashable = true;
flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
flt_rule_entry.rule.attrib.u.v6.dst_addr[0] = get_client_memptr(wlan_client, client_index)->v6_addr[v6_num][0];
flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = get_client_memptr(wlan_client, client_index)->v6_addr[v6_num][1];
diff --git a/ipacm_vendor_product.mk b/ipacm_vendor_product.mk
index 96c6116..9fe88b1 100644
--- a/ipacm_vendor_product.mk
+++ b/ipacm_vendor_product.mk
@@ -1,6 +1,43 @@
+TARGET_DISABLE_IPACM := false
+
#IPACM_DATA
IPACM_DATA += IPACM_cfg.xml
IPACM_DATA += ipacm
IPACM_DATA += ipacm.rc
+ifeq ($(TARGET_USES_QMAA),true)
+ifneq ($(TARGET_USES_QMAA_OVERRIDE_DATA),true)
+ TARGET_DISABLE_IPACM := true
+endif #TARGET_USES_QMAA_OVERRIDE_DATA
+endif #TARGET_USES_QMAA
+
+ifneq ($(TARGET_DISABLE_IPACM),true)
+ifneq ($(TARGET_HAS_LOW_RAM),true)
+BOARD_PLATFORM_LIST := msm8909
+BOARD_PLATFORM_LIST += msm8916
+BOARD_PLATFORM_LIST += msm8917
+BOARD_PLATFORM_LIST += qm215
+BOARD_IPAv3_LIST := msm8998
+BOARD_IPAv3_LIST += sdm845
+BOARD_IPAv3_LIST += sdm710
+BOARD_IPAv3_LIST += msmnile
+BOARD_IPAv3_LIST += kona
+BOARD_IPAv3_LIST += $(MSMSTEPPE)
+BOARD_IPAv3_LIST += $(TRINKET)
+BOARD_IPAv3_LIST += lito
+BOARD_IPAv3_LIST += atoll
+BOARD_IPAv3_LIST += bengal
+BOARD_ETH_BRIDGE_LIST := msmnile
+BOARD_ETH_BRIDGE_LIST += kona
+
+ifneq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
+ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
+ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH)))
+
PRODUCT_PACKAGES += $(IPACM_DATA)
+
+endif # $(TARGET_ARCH)
+endif
+endif
+endif
+endif \ No newline at end of file
diff --git a/ipanat/Android.bp b/ipanat/Android.bp
new file mode 100644
index 0000000..310304d
--- /dev/null
+++ b/ipanat/Android.bp
@@ -0,0 +1,28 @@
+
+
+cc_library_shared {
+ name: "libipanat",
+
+ header_libs: ["qti_kernel_headers"],
+
+ srcs: [
+ "src/ipa_nat_drv.c",
+ "src/ipa_nat_drvi.c",
+ ],
+
+ shared_libs:
+ ["libcutils",
+ "libdl",
+ "libbase",
+ "libutils",
+ ],
+ export_include_dirs: ["inc"],
+ vendor: true,
+ cflags: [
+ "-DDEBUG",
+ "-Wall",
+ "-Werror",
+ ] + ["-DFEATURE_IPA_ANDROID"],
+
+ clang: true,
+}
diff --git a/ipanat/inc/ipa_nat_drvi.h b/ipanat/inc/ipa_nat_drvi.h
index 8015c98..292a47b 100644
--- a/ipanat/inc/ipa_nat_drvi.h
+++ b/ipanat/inc/ipa_nat_drvi.h
@@ -30,9 +30,9 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef IPA_NAT_DRVI_H
#define IPA_NAT_DRVI_H
-#include <unistd.h>
#include <stdio.h>
#include <sys/ioctl.h>
+#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <linux/msm_ipa.h>
@@ -40,6 +40,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/inotify.h>
#include <errno.h>
#include <pthread.h>
+#include <unistd.h>
#include "ipa_nat_logi.h"
diff --git a/ipanat/src/Android.mk b/ipanat/src/Android.mk
deleted file mode 100644
index aaa8409..0000000
--- a/ipanat/src/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-BOARD_PLATFORM_LIST := msm8909
-BOARD_PLATFORM_LIST += msm8916
-BOARD_PLATFORM_LIST += msm8917
-TARGET_DISABLE_IPANAT := false
-
-ifeq ($(TARGET_USES_QMAA),true)
-ifneq ($(TARGET_USES_QMAA_OVERRIDE_DATA),true)
- TARGET_DISABLE_IPANAT := true
-endif #TARGET_USES_QMAA_OVERRIDE_DATA
-endif #TARGET_USES_QMAA
-
-ifneq ($(TARGET_DISABLE_IPANAT),true)
-ifneq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
-ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
-ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH)))
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../inc
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
-
-LOCAL_SRC_FILES := ipa_nat_drv.c \
- ipa_nat_drvi.c
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../inc
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_CFLAGS := -DDEBUG -Wall -Werror
-LOCAL_CFLAGS += -DFEATURE_IPA_ANDROID
-LOCAL_MODULE := libipanat
-LOCAL_MODULE_TAGS := optional
-LOCAL_PRELINK_MODULE := false
-LOCAL_CLANG := true
-include $(BUILD_SHARED_LIBRARY)
-
-endif # $(TARGET_ARCH)
-endif
-endif
-endif