ipa: Support ipanat and kernel-tests compilation in LA
Change-Id: I36ec8c36f88dbe4cd67bb3c340fa5187c22f7d13 Signed-off-by: Ilia Lin <quic_ilial@quicinc.com>
This commit is contained in:

committed by
Ilia Lin

parent
441253fedb
commit
11eaa09da2
3
config/dataipa_GKI_consolidate.conf
Normal file
3
config/dataipa_GKI_consolidate.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export CONFIG_IPA_DEBUG=y
|
||||||
|
export CONFIG_IPA_UT=y
|
||||||
|
export CONFIG_IPA_KERNEL_TESTS_MODULE=m
|
4
dataipa_binary_vendor_product.mk
Normal file
4
dataipa_binary_vendor_product.mk
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
|
||||||
|
PRODUCT_PACKAGES += ipa-kernel-tests
|
||||||
|
$(warning "added ipa-kernel-tests")
|
||||||
|
endif
|
@@ -7,5 +7,8 @@ BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipam.ko
|
|||||||
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipanetm.ko
|
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)/rndisipam.ko
|
||||||
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/ipa_clientsm.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
|
||||||
endif
|
endif
|
||||||
|
@@ -3,3 +3,6 @@ PRODUCT_PACKAGES += ipam.ko
|
|||||||
PRODUCT_PACKAGES += ipanetm.ko
|
PRODUCT_PACKAGES += ipanetm.ko
|
||||||
PRODUCT_PACKAGES += rndisipam.ko
|
PRODUCT_PACKAGES += rndisipam.ko
|
||||||
PRODUCT_PACKAGES += ipa_clientsm.ko
|
PRODUCT_PACKAGES += ipa_clientsm.ko
|
||||||
|
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
|
||||||
|
PRODUCT_PACKAGES += ipatestm.ko
|
||||||
|
endif
|
||||||
|
34
drivers/platform/msm/Android.bp
Normal file
34
drivers/platform/msm/Android.bp
Normal file
@@ -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
|
||||||
|
}
|
@@ -61,5 +61,16 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
|||||||
$(warning $(DLKM_DIR))
|
$(warning $(DLKM_DIR))
|
||||||
include $(DLKM_DIR)/Build_external_kernelmodule.mk
|
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 target
|
||||||
endif #End of Check for qssi target
|
endif #End of Check for qssi target
|
||||||
|
@@ -21,7 +21,7 @@ DATAIPADRVTOP = $(srctree)/../../vendor/qcom/opensource/dataipa/drivers/platform
|
|||||||
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
|
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
|
||||||
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
|
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
|
||||||
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
|
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
|
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.h
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -31,7 +31,7 @@ DATAIPADRVTOP = $(srctree)/../../vendor/qcom/opensource/dataipa/drivers/platform
|
|||||||
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
|
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
|
||||||
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
|
include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
|
||||||
ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
|
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
|
LINUXINCLUDE += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.h
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@@ -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) 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_
|
#ifndef _IPA_TEST_MODULE_H_
|
||||||
|
@@ -693,7 +693,9 @@ static struct sk_buff *datapath_create_skb(const char *buf, size_t size)
|
|||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
IPATEST_DBG("allocating SKB, len=%zu", size);
|
IPATEST_DBG("allocating SKB, len=%zu", size);
|
||||||
skb = alloc_skb(size, GFP_KERNEL);
|
skb = alloc_skb(size, GFP_KERNEL);
|
||||||
@@ -706,10 +708,13 @@ static struct sk_buff *datapath_create_skb(const char *buf, size_t size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
IPATEST_DBG("skb put finish, skb->len=%d", skb->len);
|
IPATEST_DBG("skb put finish, skb->len=%d", skb->len);
|
||||||
skb->csum = csum_and_copy_from_user(
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
|
||||||
buf, data,
|
skb->csum = csum_and_copy_from_user(buf, data, size);
|
||||||
size, 0, &err);
|
if (!skb->csum) {
|
||||||
|
#else
|
||||||
|
skb->csum = csum_and_copy_from_user(buf, data, size, 0, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
#endif
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1212,7 +1217,7 @@ int connect_apps_to_ipa(struct test_endpoint_sys *tx_ep,
|
|||||||
tx_ep->gsi_channel_props.low_weight = 1;
|
tx_ep->gsi_channel_props.low_weight = 1;
|
||||||
tx_ep->gsi_channel_props.chan_user_data = tx_ep;
|
tx_ep->gsi_channel_props.chan_user_data = tx_ep;
|
||||||
if (ipa_get_hw_type() >= IPA_HW_v4_9)
|
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.err_cb = ipa_test_gsi_chan_err_cb;
|
||||||
tx_ep->gsi_channel_props.xfer_cb = ipa_test_gsi_irq_notify_cb;
|
tx_ep->gsi_channel_props.xfer_cb = ipa_test_gsi_irq_notify_cb;
|
||||||
|
88
drivers/platform/msm/ipa_test_kernel_headers.py
Normal file
88
drivers/platform/msm/ipa_test_kernel_headers.py
Normal file
@@ -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())
|
33
ipanat/Android.bp
Normal file
33
ipanat/Android.bp
Normal file
@@ -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",
|
||||||
|
],
|
||||||
|
|
||||||
|
}
|
@@ -25,10 +25,45 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
#ifndef IPA_NAT_UTILS_H
|
||||||
#define IPA_NAT_UTILS_H
|
#define IPA_NAT_UTILS_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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_ipv6ct.h"
|
||||||
#include "ipa_ipv6cti.h"
|
#include "ipa_ipv6cti.h"
|
||||||
@@ -34,6 +68,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <linux/msm_ipa.h>
|
||||||
|
|
||||||
#define IPA_IPV6CT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/ipv6ct"
|
#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"
|
#define IPA_UC_ACT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/uc_act_table"
|
||||||
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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 <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -249,8 +283,8 @@ int ipa_nati_add_ipv4_tbl(
|
|||||||
uint32_t* tbl_hdl)
|
uint32_t* tbl_hdl)
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) public_ip_addr,
|
(arb_t*)(arb_t)public_ip_addr,
|
||||||
(arb_t*) number_of_entries,
|
(arb_t*)(arb_t)number_of_entries,
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*) tbl_hdl,
|
||||||
(arb_t*) mem_type_ptr,
|
(arb_t*) mem_type_ptr,
|
||||||
};
|
};
|
||||||
@@ -275,7 +309,7 @@ int ipa_nati_del_ipv4_table(
|
|||||||
uint32_t tbl_hdl)
|
uint32_t tbl_hdl)
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
@@ -293,7 +327,7 @@ int ipa_nati_clear_ipv4_tbl(
|
|||||||
uint32_t tbl_hdl )
|
uint32_t tbl_hdl )
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
@@ -314,8 +348,8 @@ int ipa_nati_walk_ipv4_tbl(
|
|||||||
void* arb_data_ptr )
|
void* arb_data_ptr )
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
(arb_t*) which,
|
(arb_t*)(arb_t)which,
|
||||||
(arb_t*) walk_cb,
|
(arb_t*) walk_cb,
|
||||||
(arb_t*) arb_data_ptr,
|
(arb_t*) arb_data_ptr,
|
||||||
};
|
};
|
||||||
@@ -337,7 +371,7 @@ int ipa_nati_ipv4_tbl_stats(
|
|||||||
ipa_nati_tbl_stats* idx_stats_ptr )
|
ipa_nati_tbl_stats* idx_stats_ptr )
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
(arb_t*) nat_stats_ptr,
|
(arb_t*) nat_stats_ptr,
|
||||||
(arb_t*) idx_stats_ptr,
|
(arb_t*) idx_stats_ptr,
|
||||||
};
|
};
|
||||||
@@ -359,7 +393,7 @@ int ipa_nati_add_ipv4_rule(
|
|||||||
uint32_t* rule_hdl )
|
uint32_t* rule_hdl )
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
(arb_t*) clnt_rule,
|
(arb_t*) clnt_rule,
|
||||||
(arb_t*) rule_hdl,
|
(arb_t*) rule_hdl,
|
||||||
};
|
};
|
||||||
@@ -385,8 +419,8 @@ int ipa_nati_del_ipv4_rule(
|
|||||||
uint32_t rule_hdl )
|
uint32_t rule_hdl )
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
(arb_t*) rule_hdl,
|
(arb_t*)(arb_t)rule_hdl,
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
@@ -406,8 +440,8 @@ int ipa_nati_query_timestamp(
|
|||||||
uint32_t* time_stamp)
|
uint32_t* time_stamp)
|
||||||
{
|
{
|
||||||
arb_t* args[] = {
|
arb_t* args[] = {
|
||||||
(arb_t*) tbl_hdl,
|
(arb_t*)(arb_t)tbl_hdl,
|
||||||
(arb_t*) rule_hdl,
|
(arb_t*)(arb_t)rule_hdl,
|
||||||
(arb_t*) time_stamp,
|
(arb_t*) time_stamp,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1108,8 +1142,8 @@ static int _smAddSramAndDdrTbl(
|
|||||||
* table...
|
* table...
|
||||||
*/
|
*/
|
||||||
arb_t* new_args[] = {
|
arb_t* new_args[] = {
|
||||||
(arb_t*) public_ip_addr,
|
(arb_t*)(arb_t)public_ip_addr,
|
||||||
(arb_t*) number_of_entries,
|
(arb_t*)(arb_t)number_of_entries,
|
||||||
(arb_t*) &tbl_hdl, /* to protect app's table handle above */
|
(arb_t*) &tbl_hdl, /* to protect app's table handle above */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1187,7 +1221,7 @@ static int _smDelSramAndDdrTbl(
|
|||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
{
|
{
|
||||||
arb_t* new_args[] = {
|
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);
|
ret = _smDelTbl(nati_obj_ptr, trigger, new_args);
|
||||||
@@ -1299,7 +1333,7 @@ static int _smClrTblHybrid(
|
|||||||
uint32_t tbl_hdl = (uint32_t) args[0];
|
uint32_t tbl_hdl = (uint32_t) args[0];
|
||||||
|
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_tbl_hdl,
|
nati_obj_ptr->ddr_tbl_hdl,
|
||||||
};
|
};
|
||||||
@@ -1394,7 +1428,7 @@ static int _smWalkTblHybrid(
|
|||||||
arb_t* wadp = (arb_t*) args[3];
|
arb_t* wadp = (arb_t*) args[3];
|
||||||
|
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_tbl_hdl,
|
nati_obj_ptr->ddr_tbl_hdl,
|
||||||
(arb_t*) which,
|
(arb_t*) which,
|
||||||
@@ -1490,7 +1524,7 @@ static int _smStatTblHybrid(
|
|||||||
ipa_nati_tbl_stats* idx_stats_ptr = (ipa_nati_tbl_stats*) args[2];
|
ipa_nati_tbl_stats* idx_stats_ptr = (ipa_nati_tbl_stats*) args[2];
|
||||||
|
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_tbl_hdl,
|
nati_obj_ptr->ddr_tbl_hdl,
|
||||||
(arb_t*) nat_stats_ptr,
|
(arb_t*) nat_stats_ptr,
|
||||||
@@ -1659,7 +1693,7 @@ static int _smAddRuleHybrid(
|
|||||||
uint32_t* rule_hdl = (uint32_t*) args[2];
|
uint32_t* rule_hdl = (uint32_t*) args[2];
|
||||||
|
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_tbl_hdl,
|
nati_obj_ptr->ddr_tbl_hdl,
|
||||||
(arb_t*) clnt_rule,
|
(arb_t*) clnt_rule,
|
||||||
@@ -1814,10 +1848,10 @@ static int _smDelRuleHybrid(
|
|||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
{
|
{
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_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",
|
IPADBG("orig_rule_hdl(0x%08X) -> new_rule_hdl(0x%08X)\n",
|
||||||
@@ -2398,10 +2432,10 @@ static int _smGetTmStmpHybrid(
|
|||||||
if ( ret == 0 )
|
if ( ret == 0 )
|
||||||
{
|
{
|
||||||
arb_t* new_args[] = {
|
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 :
|
tbl_hdl :
|
||||||
nati_obj_ptr->ddr_tbl_hdl,
|
nati_obj_ptr->ddr_tbl_hdl,
|
||||||
(arb_t*) new_rule_hdl,
|
(arb_t*)(arb_t)new_rule_hdl,
|
||||||
(arb_t*) time_stamp,
|
(arb_t*) time_stamp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
71
kernel-tests/Android.bp
Normal file
71
kernel-tests/Android.bp
Normal file
@@ -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",
|
||||||
|
]
|
||||||
|
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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"
|
#include "TestsUtils.h"
|
||||||
@@ -32,6 +66,7 @@
|
|||||||
#include "HeaderInsertion.h"
|
#include "HeaderInsertion.h"
|
||||||
#include "Filtering.h"
|
#include "Filtering.h"
|
||||||
#include "IPAFilteringTable.h"
|
#include "IPAFilteringTable.h"
|
||||||
|
#include "IPv4Packet.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
using namespace IPA;
|
using namespace IPA;
|
||||||
@@ -371,7 +406,7 @@ private:
|
|||||||
class IPAExceptionPacketTest006: public IPAExceptionTestFixture {
|
class IPAExceptionPacketTest006: public IPAExceptionTestFixture {
|
||||||
public:
|
public:
|
||||||
IPAExceptionPacketTest006() {
|
IPAExceptionPacketTest006() {
|
||||||
m_name = "IPAExceptionPacketTest006"
|
m_name = "IPAExceptionPacketTest006";
|
||||||
m_description = "\
|
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 \
|
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). \
|
Test Generates a Packet with Internet Header Length (IHL == 4). \
|
||||||
@@ -466,7 +501,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static IPAExceptionPacketTest001 ipaExceptionPacketTest001;
|
static IPAExceptionPacketTest001 ipaExceptionPacketTest001;
|
||||||
static IPAExceptionPacketTest002 ipaExceptionPacketTest002;
|
|
||||||
static IPAExceptionPacketTest003 ipaExceptionPacketTest003;
|
static IPAExceptionPacketTest003 ipaExceptionPacketTest003;
|
||||||
static IPAExceptionPacketTest006 ipaExceptionPacketTest006;
|
static IPAExceptionPacketTest006 ipaExceptionPacketTest006;
|
||||||
|
|
||||||
|
@@ -25,9 +25,43 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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 "HeaderInsertion.h"
|
||||||
#include "Filtering.h"
|
#include "Filtering.h"
|
||||||
#include "IPAFilteringTable.h"
|
#include "IPAFilteringTable.h"
|
||||||
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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"
|
#include "RoutingDriverWrapper.h"
|
||||||
|
@@ -7938,14 +7938,6 @@ public:
|
|||||||
virtual bool ModifyPackets()
|
virtual bool ModifyPackets()
|
||||||
{
|
{
|
||||||
uint32_t vlan_802_1Q_tag;
|
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
|
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));
|
memcpy(&m_sendBuffer[TAG_802_1Q_OFFSET], &vlan_802_1Q_tag, sizeof(vlan_802_1Q_tag));
|
||||||
@@ -8232,11 +8224,6 @@ private:
|
|||||||
bool __ModifyPackets(int i)
|
bool __ModifyPackets(int i)
|
||||||
{
|
{
|
||||||
int address;
|
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)
|
address = ntohl(0xC0A80101 + i); // 192.168.1.(1+i)
|
||||||
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
|
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
|
||||||
@@ -8365,14 +8352,6 @@ public:
|
|||||||
virtual bool ModifyPackets()
|
virtual bool ModifyPackets()
|
||||||
{
|
{
|
||||||
int address;
|
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
|
address = ntohl(0x7F000001);//127.0.0.1
|
||||||
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
|
memcpy(&m_sendBuffer[IPV4_DST_ADDR_OFFSET], &address, sizeof(address));
|
||||||
@@ -8777,14 +8756,6 @@ public:
|
|||||||
|
|
||||||
virtual bool ModifyPackets()
|
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_sendBuffer[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
|
||||||
m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
|
m_sendBuffer2[DST_ADDR_LSB_OFFSET_IPV6] = 0xAA;
|
||||||
m_sendBuffer3[DST_ADDR_LSB_OFFSET_IPV6] = 0xCC;
|
m_sendBuffer3[DST_ADDR_LSB_OFFSET_IPV6] = 0xCC;
|
||||||
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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"
|
#include "RoutingDriverWrapper.h"
|
||||||
@@ -38,6 +72,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
#define IPV4_DST_ADDR_OFFSET (16)
|
#define IPV4_DST_ADDR_OFFSET (16)
|
||||||
|
|
||||||
|
@@ -25,6 +25,40 @@
|
|||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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__
|
#ifndef __IPA_TESTS_IPV4_PACKET__H__
|
||||||
@@ -48,7 +82,9 @@ public:
|
|||||||
|
|
||||||
IPv4Packet(unsigned int size);
|
IPv4Packet(unsigned int size);
|
||||||
|
|
||||||
virtual ~IPv4Packet(void) = 0;
|
virtual ~IPv4Packet(void);
|
||||||
|
|
||||||
|
void FromByteStream(unsigned char *buffer, unsigned int length);
|
||||||
|
|
||||||
void ToNetworkByteStream(unsigned char *addr);
|
void ToNetworkByteStream(unsigned char *addr);
|
||||||
|
|
||||||
@@ -109,7 +145,7 @@ public:
|
|||||||
|
|
||||||
TCPPacket(void);
|
TCPPacket(void);
|
||||||
|
|
||||||
~TCPPacket(void) {}
|
virtual ~TCPPacket(void) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -128,7 +164,7 @@ class UDPPacket:public IPv4Packet
|
|||||||
public:
|
public:
|
||||||
UDPPacket(void);
|
UDPPacket(void);
|
||||||
|
|
||||||
~UDPPacket(void) {}
|
virtual ~UDPPacket(void) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -147,7 +183,7 @@ class ICMPPacket:public IPv4Packet
|
|||||||
public:
|
public:
|
||||||
ICMPPacket(void);
|
ICMPPacket(void);
|
||||||
|
|
||||||
~ICMPPacket(void) {}
|
virtual ~ICMPPacket(void) {}
|
||||||
|
|
||||||
virtual unsigned short GetSrcPort(void);
|
virtual unsigned short GetSrcPort(void);
|
||||||
|
|
||||||
|
@@ -5170,7 +5170,73 @@ public:
|
|||||||
Register(*this);
|
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 res = false;
|
||||||
bool isSuccess = false;
|
bool isSuccess = false;
|
||||||
@@ -5326,70 +5392,6 @@ public:
|
|||||||
|
|
||||||
return pkt1_cmp_succ && pkt2_cmp_succ && pkt3_cmp_succ;
|
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 IpaRoutingBlockTest040 ipaRoutingBlockTest040;
|
|||||||
static class IpaRoutingBlockTest050 ipaRoutingBlockTest050;
|
static class IpaRoutingBlockTest050 ipaRoutingBlockTest050;
|
||||||
static class IpaRoutingBlockTest051 ipaRoutingBlockTest051;
|
static class IpaRoutingBlockTest051 ipaRoutingBlockTest051;
|
||||||
static class IpaRoutingBlockTest052 ipaRoutingBlockTest052;
|
static class IpaRoutingBlockTest052 ipaRoutingBlockTest052;
|
||||||
static class IpaRoutingBlockTest053 ipaRoutingBlockTest053;
|
static class IpaRoutingBlockTest053 ipaRoutingBlockTest053;
|
||||||
|
Reference in New Issue
Block a user