Merge "ipa: Support ipanat and kernel-tests compilation in LA"
diff --git a/config/dataipa_GKI_consolidate.conf b/config/dataipa_GKI_consolidate.conf
new file mode 100644
index 0000000..2ecf261
--- /dev/null
+++ b/config/dataipa_GKI_consolidate.conf
@@ -0,0 +1,3 @@
+export CONFIG_IPA_DEBUG=y
+export CONFIG_IPA_UT=y
+export CONFIG_IPA_KERNEL_TESTS_MODULE=m
diff --git a/dataipa_binary_vendor_product.mk b/dataipa_binary_vendor_product.mk
new file mode 100644
index 0000000..4b4fc99
--- /dev/null
+++ b/dataipa_binary_vendor_product.mk
@@ -0,0 +1,4 @@
+ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
+PRODUCT_PACKAGES += ipa-kernel-tests
+$(warning "added ipa-kernel-tests")
+endif
diff --git a/dataipa_dlkm_vendor_board.mk b/dataipa_dlkm_vendor_board.mk
index 98c510b..4cb3172 100644
--- a/dataipa_dlkm_vendor_board.mk
+++ b/dataipa_dlkm_vendor_board.mk
@@ -7,5 +7,8 @@
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipanetm.ko
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/rndisipam.ko
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipa_clientsm.ko
+ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
+BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipatestm.ko
+endif
endif
endif
diff --git a/dataipa_dlkm_vendor_product.mk b/dataipa_dlkm_vendor_product.mk
index 620fa7a..cf22431 100644
--- a/dataipa_dlkm_vendor_product.mk
+++ b/dataipa_dlkm_vendor_product.mk
@@ -3,3 +3,6 @@
PRODUCT_PACKAGES += ipanetm.ko
PRODUCT_PACKAGES += rndisipam.ko
PRODUCT_PACKAGES += ipa_clientsm.ko
+ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
+PRODUCT_PACKAGES += ipatestm.ko
+endif
diff --git a/drivers/platform/msm/Android.bp b/drivers/platform/msm/Android.bp
new file mode 100644
index 0000000..65a7d17
--- /dev/null
+++ b/drivers/platform/msm/Android.bp
@@ -0,0 +1,34 @@
+headers_src = [
+ "ipa/ipa_test_module/ipa_test_module.h",
+]
+
+ipa_test_headers_out = [
+ "ipa_test_module.h",
+]
+
+ipa_test_kernel_headers_verbose = "--verbose "
+genrule {
+ name: "qti_generate_ipa_test_kernel_headers",
+ tools: ["headers_install.sh",
+ "unifdef"
+ ],
+ tool_files: [
+ "ipa_test_kernel_headers.py",
+ ],
+ srcs: headers_src,
+ cmd: "python3 -u $(location ipa_test_kernel_headers.py) " +
+ ipa_test_kernel_headers_verbose +
+ "--gen_dir $(genDir) " +
+ "--ipa_test_include_uapi $(locations ipa/ipa_test_module/ipa_test_module.h) " +
+ "--unifdef $(location unifdef) " +
+ "--headers_install $(location headers_install.sh)",
+ out: ipa_test_headers_out,
+}
+
+cc_library_headers {
+ name: "qti_ipa_test_kernel_headers",
+ generated_headers: ["qti_generate_ipa_test_kernel_headers"],
+ export_generated_headers: ["qti_generate_ipa_test_kernel_headers"],
+ vendor: true,
+ recovery_available: true
+}
diff --git a/drivers/platform/msm/Android.mk b/drivers/platform/msm/Android.mk
index 5f64505..230ef2b 100644
--- a/drivers/platform/msm/Android.mk
+++ b/drivers/platform/msm/Android.mk
@@ -61,5 +61,16 @@
$(warning $(DLKM_DIR))
include $(DLKM_DIR)/Build_external_kernelmodule.mk
+include $(CLEAR_VARS)
+KBUILD_OPTIONS += MODNAME=ipatestm
+LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
+LOCAL_MODULE := ipatestm.ko
+LOCAL_MODULE_KBUILD_NAME := ipa/ipatestm.ko
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_HEADER_LIBRARIES := ipa_test_kernel_headers
+LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
+$(warning $(DLKM_DIR))
+include $(DLKM_DIR)/Build_external_kernelmodule.mk
+
endif #End of Check for target
endif #End of Check for qssi target
diff --git a/drivers/platform/msm/Kbuild b/drivers/platform/msm/Kbuild
index d2c3225..939ccea 100644
--- a/drivers/platform/msm/Kbuild
+++ b/drivers/platform/msm/Kbuild
@@ -21,7 +21,7 @@
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
-include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.conf
+include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI_consolidate.conf
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.h
endif
endif
@@ -31,7 +31,7 @@
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
-include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.conf
+include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI_consolidate.conf
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.h
endif
endif
diff --git a/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module.h b/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module.h
index a3ebaf7..f968e79 100644
--- a/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module.h
+++ b/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module.h
@@ -1,6 +1,7 @@
-// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
/*
* Copyright (c) 2017-2018,2020-2021, The Linux Foundation. All rights reserved.
+* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _IPA_TEST_MODULE_H_
diff --git a/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module_impl.c b/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module_impl.c
index 22da632..5f54bf3 100644
--- a/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module_impl.c
+++ b/drivers/platform/msm/ipa/ipa_test_module/ipa_test_module_impl.c
@@ -693,7 +693,9 @@
{
struct sk_buff *skb;
unsigned char *data;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
int err = 0;
+#endif
IPATEST_DBG("allocating SKB, len=%zu", size);
skb = alloc_skb(size, GFP_KERNEL);
@@ -706,10 +708,13 @@
return NULL;
}
IPATEST_DBG("skb put finish, skb->len=%d", skb->len);
- skb->csum = csum_and_copy_from_user(
- buf, data,
- size, 0, &err);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
+ skb->csum = csum_and_copy_from_user(buf, data, size);
+ if (!skb->csum) {
+#else
+ skb->csum = csum_and_copy_from_user(buf, data, size, 0, &err);
if (err) {
+#endif
kfree_skb(skb);
return NULL;
}
@@ -1212,7 +1217,7 @@
tx_ep->gsi_channel_props.low_weight = 1;
tx_ep->gsi_channel_props.chan_user_data = tx_ep;
if (ipa_get_hw_type() >= IPA_HW_v4_9)
- tx_ep->gsi_channel_props.db_in_bytes = 1;
+ tx_ep->gsi_channel_props.db_in_bytes = 1;
tx_ep->gsi_channel_props.err_cb = ipa_test_gsi_chan_err_cb;
tx_ep->gsi_channel_props.xfer_cb = ipa_test_gsi_irq_notify_cb;
diff --git a/drivers/platform/msm/ipa_test_kernel_headers.py b/drivers/platform/msm/ipa_test_kernel_headers.py
new file mode 100644
index 0000000..fcd4de0
--- /dev/null
+++ b/drivers/platform/msm/ipa_test_kernel_headers.py
@@ -0,0 +1,88 @@
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 and
+# only version 2 as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+import argparse
+import filecmp
+import os
+import re
+import subprocess
+import sys
+
+def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h):
+ if not h.startswith(prefix):
+ print('error: expected prefix [%s] on header [%s]' % (prefix, h))
+ return False
+
+ out_h = os.path.join(gen_dir, h[len(prefix):])
+ (out_h_dirname, out_h_basename) = os.path.split(out_h)
+ env = os.environ.copy()
+ env["LOC_UNIFDEF"] = unifdef
+ cmd = ["sh", headers_install, h, out_h]
+
+ if verbose:
+ print('run_headers_install: cmd is %s' % cmd)
+
+ result = subprocess.call(cmd, env=env)
+
+ if result != 0:
+ print('error: run_headers_install: cmd %s failed %d' % (cmd, result))
+ return False
+ return True
+
+def gen_ipa_test_headers(verbose, gen_dir, headers_install, unifdef, ipa_test_include_uapi):
+ error_count = 0
+ for h in ipa_test_include_uapi:
+ ipa_test_uapi_include_prefix = os.path.join(h.split('/ipa/ipa_test_module/')[0],
+ 'ipa',
+ 'ipa_test_module') + os.sep
+
+ if not run_headers_install(
+ verbose, gen_dir, headers_install, unifdef,
+ ipa_test_uapi_include_prefix, h): error_count += 1
+ return error_count
+
+def main():
+ """Parse command line arguments and perform top level control."""
+ parser = argparse.ArgumentParser(
+ description=__doc__,
+ formatter_class=argparse.RawDescriptionHelpFormatter)
+
+ # Arguments that apply to every invocation of this script.
+ parser.add_argument(
+ '--verbose', action='store_true',
+ help='Print output that describes the workings of this script.')
+ parser.add_argument(
+ '--gen_dir', required=True,
+ help='Where to place the generated files.')
+ parser.add_argument(
+ '--ipa_test_include_uapi', required=True, nargs='*',
+ help='The list of header files.')
+ parser.add_argument(
+ '--headers_install', required=True,
+ help='The headers_install tool to process input headers.')
+ parser.add_argument(
+ '--unifdef',
+ required=True,
+ help='The unifdef tool used by headers_install.')
+
+ args = parser.parse_args()
+
+ if args.verbose:
+ print('gen_dir [%s]' % args.gen_dir)
+ print('ipa_test_include_uapi [%s]' % args.ipa_test_include_uapi)
+ print('headers_install [%s]' % args.headers_install)
+ print('unifdef [%s]' % args.unifdef)
+
+ return gen_ipa_test_headers(args.verbose, args.gen_dir,
+ args.headers_install, args.unifdef, args.ipa_test_include_uapi)
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/ipanat/Android.bp b/ipanat/Android.bp
new file mode 100644
index 0000000..aecb5b2
--- /dev/null
+++ b/ipanat/Android.bp
@@ -0,0 +1,33 @@
+cc_library_shared {
+ name: "libipanat",
+
+ header_libs: ["device_kernel_headers"]+["qti_kernel_headers"],
+
+ srcs: [
+ "src/ipa_nat_map.cpp",
+ "src/ipa_table.c",
+ "src/ipa_nat_statemach.c",
+ "src/ipa_nat_drvi.c",
+ "src/ipa_nat_drv.c",
+ "src/ipa_mem_descriptor.c",
+ "src/ipa_nat_utils.c",
+ "src/ipa_ipv6ct.c",
+ ],
+
+ shared_libs:
+ ["libcutils",
+ "libdl",
+ "libbase",
+ "libutils",
+ ],
+ export_include_dirs: ["inc"],
+ vendor: true,
+ clang: true,
+
+ clang_cflags: [
+ "-DDEBUG",
+ "-DFEATURE_IPA_ANDROID",
+ "-Wno-int-conversion",
+ ],
+
+}
diff --git a/ipanat/inc/ipa_nat_utils.h b/ipanat/inc/ipa_nat_utils.h
index b1506e3..22b99c4 100644
--- a/ipanat/inc/ipa_nat_utils.h
+++ b/ipanat/inc/ipa_nat_utils.h
@@ -25,10 +25,45 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#ifndef IPA_NAT_UTILS_H
#define IPA_NAT_UTILS_H
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
diff --git a/ipanat/src/ipa_ipv6ct.c b/ipanat/src/ipa_ipv6ct.c
index cb7a6b0..45e454c 100644
--- a/ipanat/src/ipa_ipv6ct.c
+++ b/ipanat/src/ipa_ipv6ct.c
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include "ipa_ipv6ct.h"
#include "ipa_ipv6cti.h"
@@ -34,6 +68,7 @@
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
+#include <linux/msm_ipa.h>
#define IPA_IPV6CT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/ipv6ct"
#define IPA_UC_ACT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/uc_act_table"
diff --git a/ipanat/src/ipa_nat_statemach.c b/ipanat/src/ipa_nat_statemach.c
index 57dc8af..2e77082 100644
--- a/ipanat/src/ipa_nat_statemach.c
+++ b/ipanat/src/ipa_nat_statemach.c
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include <errno.h>
#include <pthread.h>
@@ -249,8 +283,8 @@
uint32_t* tbl_hdl)
{
arb_t* args[] = {
- (arb_t*) public_ip_addr,
- (arb_t*) number_of_entries,
+ (arb_t*)(arb_t)public_ip_addr,
+ (arb_t*)(arb_t)number_of_entries,
(arb_t*) tbl_hdl,
(arb_t*) mem_type_ptr,
};
@@ -275,7 +309,7 @@
uint32_t tbl_hdl)
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
};
int ret;
@@ -293,7 +327,7 @@
uint32_t tbl_hdl )
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
};
int ret;
@@ -314,8 +348,8 @@
void* arb_data_ptr )
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
- (arb_t*) which,
+ (arb_t*)(arb_t)tbl_hdl,
+ (arb_t*)(arb_t)which,
(arb_t*) walk_cb,
(arb_t*) arb_data_ptr,
};
@@ -337,7 +371,7 @@
ipa_nati_tbl_stats* idx_stats_ptr )
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
(arb_t*) nat_stats_ptr,
(arb_t*) idx_stats_ptr,
};
@@ -359,7 +393,7 @@
uint32_t* rule_hdl )
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
(arb_t*) clnt_rule,
(arb_t*) rule_hdl,
};
@@ -385,8 +419,8 @@
uint32_t rule_hdl )
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
- (arb_t*) rule_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
+ (arb_t*)(arb_t)rule_hdl,
};
int ret;
@@ -406,8 +440,8 @@
uint32_t* time_stamp)
{
arb_t* args[] = {
- (arb_t*) tbl_hdl,
- (arb_t*) rule_hdl,
+ (arb_t*)(arb_t)tbl_hdl,
+ (arb_t*)(arb_t)rule_hdl,
(arb_t*) time_stamp,
};
@@ -1108,8 +1142,8 @@
* table...
*/
arb_t* new_args[] = {
- (arb_t*) public_ip_addr,
- (arb_t*) number_of_entries,
+ (arb_t*)(arb_t)public_ip_addr,
+ (arb_t*)(arb_t)number_of_entries,
(arb_t*) &tbl_hdl, /* to protect app's table handle above */
};
@@ -1187,7 +1221,7 @@
if ( ret == 0 )
{
arb_t* new_args[] = {
- (arb_t*) nati_obj_ptr->ddr_tbl_hdl,
+ (arb_t*)(arb_t)nati_obj_ptr->ddr_tbl_hdl,
};
ret = _smDelTbl(nati_obj_ptr, trigger, new_args);
@@ -1299,7 +1333,7 @@
uint32_t tbl_hdl = (uint32_t) args[0];
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
};
@@ -1394,7 +1428,7 @@
arb_t* wadp = (arb_t*) args[3];
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
(arb_t*) which,
@@ -1490,7 +1524,7 @@
ipa_nati_tbl_stats* idx_stats_ptr = (ipa_nati_tbl_stats*) args[2];
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
(arb_t*) nat_stats_ptr,
@@ -1659,7 +1693,7 @@
uint32_t* rule_hdl = (uint32_t*) args[2];
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
(arb_t*) clnt_rule,
@@ -1814,10 +1848,10 @@
if ( ret == 0 )
{
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
- (arb_t*) new_rule_hdl,
+ (arb_t*)(arb_t)new_rule_hdl,
};
IPADBG("orig_rule_hdl(0x%08X) -> new_rule_hdl(0x%08X)\n",
@@ -2398,10 +2432,10 @@
if ( ret == 0 )
{
arb_t* new_args[] = {
- (arb_t*) (nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
+ (arb_t*)(arb_t)(nati_obj_ptr->curr_state == NATI_STATE_HYBRID) ?
tbl_hdl :
nati_obj_ptr->ddr_tbl_hdl,
- (arb_t*) new_rule_hdl,
+ (arb_t*)(arb_t)new_rule_hdl,
(arb_t*) time_stamp,
};
diff --git a/kernel-tests/Android.bp b/kernel-tests/Android.bp
new file mode 100644
index 0000000..773802e
--- /dev/null
+++ b/kernel-tests/Android.bp
@@ -0,0 +1,71 @@
+cc_binary {
+ name: "ipa-kernel-tests",
+
+ clang_cflags: [
+ "-Wno-missing-field-initializers",
+ "-Wno-int-to-pointer-cast",
+ "-Wno-int-conversion",
+ ],
+
+ header_libs: ["device_kernel_headers"]+["qti_kernel_headers"]+["qti_ipa_test_kernel_headers"],
+
+ srcs: [
+ "DataPathTestFixture.cpp",
+ "DataPathTests.cpp",
+ "ExceptionsTestFixture.cpp",
+ "ExceptionsTests.cpp",
+ "ExceptionTests.cpp",
+ "Feature.cpp",
+ "Filtering.cpp",
+ "FilteringEthernetBridgingTestFixture.cpp",
+ "FilteringEthernetBridgingTests.cpp",
+ "FilteringTest.cpp",
+ "HeaderInsertion.cpp",
+ "HeaderInsertionTests.cpp",
+ "HeaderProcessingContextTestFixture.cpp",
+ "HeaderProcessingContextTests.cpp",
+ "HeaderRemovalTestFixture.cpp",
+ "HeaderRemovalTests.cpp",
+ "InterfaceAbstraction.cpp",
+ "IPAFilteringTable.cpp",
+ "IPAInterruptsTestFixture.cpp",
+ "IPAInterruptsTests.cpp",
+ "IPv4Packet.cpp",
+ "IPv6CTTest.cpp",
+ "Logger.cpp",
+ "main.cpp",
+ "MBIMAggregationTestFixtureConf11.cpp",
+ "MBIMAggregationTests.cpp",
+ "NatTest.cpp",
+ "Pipe.cpp",
+ "PipeTestFixture.cpp",
+ "PipeTests.cpp",
+ "RNDISAggregationTestFixture.cpp",
+ "RNDISAggregationTests.cpp",
+ "RoutingDriverWrapper.cpp",
+ "RoutingTests.cpp",
+ "TestBase.cpp",
+ "TestManager.cpp",
+ "TestsUtils.cpp",
+ "TLPAggregationTestFixture.cpp",
+ "TLPAggregationTests.cpp",
+ ],
+
+ clang: true,
+ vendor: true,
+ rtti: true,
+
+ shared_libs:
+ ["libc++",
+ "libipanat"],
+
+ relative_install_path: "ipa-kernel-tests",
+
+
+}
+
+IPA_KERNEL_TESTS_FILE_LIST = [
+ "README.txt",
+ "run.sh",
+]
+
diff --git a/kernel-tests/ExceptionTests.cpp b/kernel-tests/ExceptionTests.cpp
index 1c5847f..5ae9290 100644
--- a/kernel-tests/ExceptionTests.cpp
+++ b/kernel-tests/ExceptionTests.cpp
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include "TestsUtils.h"
@@ -32,6 +66,7 @@
#include "HeaderInsertion.h"
#include "Filtering.h"
#include "IPAFilteringTable.h"
+#include "IPv4Packet.h"
#include <string.h>
using namespace IPA;
@@ -371,7 +406,7 @@
class IPAExceptionPacketTest006: public IPAExceptionTestFixture {
public:
IPAExceptionPacketTest006() {
- m_name = "IPAExceptionPacketTest006"
+ m_name = "IPAExceptionPacketTest006";
m_description = "\
IPA Exception Test 006 - Test that when a packet with Internet Header Length < 5 Arrives, an exception packet is created and received & exception_pipe \
Test Generates a Packet with Internet Header Length (IHL == 4). \
@@ -466,7 +501,6 @@
};
static IPAExceptionPacketTest001 ipaExceptionPacketTest001;
-static IPAExceptionPacketTest002 ipaExceptionPacketTest002;
static IPAExceptionPacketTest003 ipaExceptionPacketTest003;
static IPAExceptionPacketTest006 ipaExceptionPacketTest006;
diff --git a/kernel-tests/ExceptionsTestFixture.h b/kernel-tests/ExceptionsTestFixture.h
index 958f35e..4cb5161 100644
--- a/kernel-tests/ExceptionsTestFixture.h
+++ b/kernel-tests/ExceptionsTestFixture.h
@@ -25,9 +25,43 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
-#include "Routing.h"
+#include "RoutingDriverWrapper.h"
#include "HeaderInsertion.h"
#include "Filtering.h"
#include "IPAFilteringTable.h"
diff --git a/kernel-tests/ExceptionsTests.cpp b/kernel-tests/ExceptionsTests.cpp
index 6144130..8e370ec 100644
--- a/kernel-tests/ExceptionsTests.cpp
+++ b/kernel-tests/ExceptionsTests.cpp
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include "RoutingDriverWrapper.h"
diff --git a/kernel-tests/FilteringTest.cpp b/kernel-tests/FilteringTest.cpp
index 3d5f563..3e79468 100644
--- a/kernel-tests/FilteringTest.cpp
+++ b/kernel-tests/FilteringTest.cpp
@@ -7938,14 +7938,6 @@
virtual bool ModifyPackets()
{
uint32_t vlan_802_1Q_tag;
- if (
- (NULL == m_sendBuffer) ||
- (NULL == m_sendBuffer2) ||
- (NULL == m_sendBuffer3)
- ) {
- printf("Error : %s was called with NULL Buffers\n", __FUNCTION__);
- return false;
- }
vlan_802_1Q_tag = ntohl(0x81002005); //VLAN ID == 5
memcpy(&m_sendBuffer[TAG_802_1Q_OFFSET], &vlan_802_1Q_tag, sizeof(vlan_802_1Q_tag));
@@ -8232,11 +8224,6 @@
bool __ModifyPackets(int i)
{
int address;
- if (NULL == m_sendBuffer)
- {
- printf ("Error : %s was called with NULL Buffer\n", __FUNCTION__);
- return false;
- }
address = ntohl(0xC0A80101 + i); // 192.168.1.(1+i)
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
@@ -8365,14 +8352,6 @@
virtual bool ModifyPackets()
{
int address;
- if (
- (NULL == m_sendBuffer) ||
- (NULL == m_sendBuffer2) ||
- (NULL == m_sendBuffer3)
- ) {
- printf("Error : %s was called with NULL Buffers\n", __FUNCTION__);
- return false;
- }
address = ntohl(0x7F000001);//127.0.0.1
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
@@ -8777,14 +8756,6 @@
virtual bool ModifyPackets()
{
- if (
- (NULL == m_sendBuffer) ||
- (NULL == m_sendBuffer2) ||
- (NULL == m_sendBuffer3)
- ) {
- printf("Error : %s was called with NULL Buffers\n", __FUNCTION__);
- return false;
- }
m_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
m_sendBuffer3[DST_ADDR_LSB_OFFSET_IPV6] = 0xCC;
diff --git a/kernel-tests/HeaderInsertionTests.cpp b/kernel-tests/HeaderInsertionTests.cpp
index f126210..238fc6c 100644
--- a/kernel-tests/HeaderInsertionTests.cpp
+++ b/kernel-tests/HeaderInsertionTests.cpp
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include "RoutingDriverWrapper.h"
@@ -38,6 +72,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <typeinfo>
#define IPV4_DST_ADDR_OFFSET (16)
diff --git a/kernel-tests/IPv4Packet.h b/kernel-tests/IPv4Packet.h
index d0a3451..07ae954 100644
--- a/kernel-tests/IPv4Packet.h
+++ b/kernel-tests/IPv4Packet.h
@@ -25,6 +25,40 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#ifndef __IPA_TESTS_IPV4_PACKET__H__
@@ -48,7 +82,9 @@
IPv4Packet(unsigned int size);
- virtual ~IPv4Packet(void) = 0;
+ virtual ~IPv4Packet(void);
+
+ void FromByteStream(unsigned char *buffer, unsigned int length);
void ToNetworkByteStream(unsigned char *addr);
@@ -109,7 +145,7 @@
TCPPacket(void);
- ~TCPPacket(void) {}
+ virtual ~TCPPacket(void) {}
protected:
@@ -128,7 +164,7 @@
public:
UDPPacket(void);
- ~UDPPacket(void) {}
+ virtual ~UDPPacket(void) {}
protected:
@@ -147,7 +183,7 @@
public:
ICMPPacket(void);
- ~ICMPPacket(void) {}
+ virtual ~ICMPPacket(void) {}
virtual unsigned short GetSrcPort(void);
diff --git a/kernel-tests/RoutingTests.cpp b/kernel-tests/RoutingTests.cpp
index 28c62ca..2ca36c1 100644
--- a/kernel-tests/RoutingTests.cpp
+++ b/kernel-tests/RoutingTests.cpp
@@ -5170,7 +5170,73 @@
Register(*this);
}
- bool Run()
+ bool Setup()
+ {
+ return IpaRoutingBlockTestFixture:: Setup(true);
+ }
+
+ bool AddRules()
+ {
+ struct ipa_ioc_add_rt_rule_v2 *rt_rule;
+ struct ipa_rt_rule_add_v2 *rt_rule_entry;
+ const int NUM_RULES = 3;
+
+ rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
+ calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
+
+ if(!rt_rule) {
+ printf("fail\n");
+ return false;
+ }
+
+ rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
+ if(!rt_rule->rules) {
+ printf("fail\n");
+ return false;
+ }
+
+ rt_rule->commit = 1;
+ rt_rule->num_rules = NUM_RULES;
+ rt_rule->ip = IPA_IP_v4;
+ strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
+
+ rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
+ rt_rule_entry->at_rear = 0;
+ rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
+ rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
+ rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802FF;
+ rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
+ rt_rule_entry->rule.ttl_update = 1;
+
+ rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
+ rt_rule_entry->at_rear = 0;
+ rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
+ rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
+ rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA;
+ rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
+ rt_rule_entry->rule.ttl_update = 1;
+
+ rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
+ rt_rule_entry->at_rear = 1;
+ rt_rule_entry->rule.ttl_update = 0;
+ rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
+
+ if (false == m_routing.AddRoutingRule(rt_rule))
+ {
+ printf("Routing rule addition failed!\n");
+ return false;
+ }
+
+ printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
+
+ free(rt_rule);
+
+ InitFilteringBlock();
+
+ return true;
+ }
+
+ virtual bool Run()
{
bool res = false;
bool isSuccess = false;
@@ -5326,70 +5392,6 @@
return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
}
-
-
- bool AddRules()
- {
- struct ipa_ioc_add_rt_rule_v2 *rt_rule;
- struct ipa_rt_rule_add_v2 *rt_rule_entry;
- const int NUM_RULES = 3;
-
- rt_rule = (struct ipa_ioc_add_rt_rule_v2 *)
- calloc(1, sizeof(struct ipa_ioc_add_rt_rule_v2));
-
- if(!rt_rule) {
- printf("fail\n");
- return false;
- }
-
- rt_rule->rules = (uint64_t)calloc(3, sizeof(struct ipa_rt_rule_add_v2));
- if(!rt_rule->rules) {
- printf("fail\n");
- return false;
- }
-
- rt_rule->commit = 1;
- rt_rule->num_rules = NUM_RULES;
- rt_rule->ip = IPA_IP_v4;
- strlcpy(rt_rule->rt_tbl_name, "LAN", sizeof(rt_rule->rt_tbl_name));
-
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[0]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST2_CONS;
-// rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802FF;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1;
-
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[1]);
- rt_rule_entry->at_rear = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST3_CONS;
-// rt_rule_entry->rule.hdr_hdl = hdr_entry->hdr_hdl; // gidons, there is no support for header insertion / removal yet.
- rt_rule_entry->rule.attrib.attrib_mask = IPA_FLT_DST_ADDR;
- rt_rule_entry->rule.attrib.u.v4.dst_addr = 0xC0A802AA;
- rt_rule_entry->rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
- rt_rule_entry->rule.ttl_update = 1;
-
- rt_rule_entry = &(((struct ipa_rt_rule_add_v2 *)rt_rule->rules)[2]);
- rt_rule_entry->at_rear = 1;
- rt_rule_entry->rule.ttl_update = 0;
- rt_rule_entry->rule.dst = IPA_CLIENT_TEST4_CONS;
-
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- printf("Routing rule addition failed!\n");
- return false;
- }
-
- printf("rt rule hdl1=%x\n", rt_rule_entry->rt_rule_hdl);
-
- free(rt_rule);
-
- InitFilteringBlock();
-
- return true;
- }
};
/*--------------------------------------------------------------------------*/
@@ -6176,4 +6178,4 @@
static class IpaRoutingBlockTest050 ipaRoutingBlockTest050;
static class IpaRoutingBlockTest051 ipaRoutingBlockTest051;
static class IpaRoutingBlockTest052 ipaRoutingBlockTest052;
-static class IpaRoutingBlockTest053 ipaRoutingBlockTest053;
\ No newline at end of file
+static class IpaRoutingBlockTest053 ipaRoutingBlockTest053;