diff options
Diffstat (limited to 'data-ipa-cfg-mgr/ipanat/test')
28 files changed, 0 insertions, 2998 deletions
diff --git a/data-ipa-cfg-mgr/ipanat/test/Android.mk b/data-ipa-cfg-mgr/ipanat/test/Android.mk deleted file mode 100644 index a6bb4b0..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/Android.mk +++ /dev/null @@ -1,51 +0,0 @@ -BOARD_PLATFORM_LIST := test -ifeq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true) -ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM))) -ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH))) - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/ -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../ipanat/inc - -LOCAL_HEADER_LIBRARIES := generated_kernel_headers - -LOCAL_MODULE := ipa_nat_test -LOCAL_SRC_FILES := ipa_nat_test000.c \ - ipa_nat_test001.c \ - ipa_nat_test002.c \ - ipa_nat_test003.c \ - ipa_nat_test004.c \ - ipa_nat_test005.c \ - ipa_nat_test006.c \ - ipa_nat_test007.c \ - ipa_nat_test008.c \ - ipa_nat_test009.c \ - ipa_nat_test010.c \ - ipa_nat_test011.c \ - ipa_nat_test012.c \ - ipa_nat_test013.c \ - ipa_nat_test014.c \ - ipa_nat_test015.c \ - ipa_nat_test016.c \ - ipa_nat_test017.c \ - ipa_nat_test018.c \ - ipa_nat_test019.c \ - ipa_nat_test020.c \ - ipa_nat_test021.c \ - ipa_nat_test022.c \ - main.c - - -LOCAL_SHARED_LIBRARIES := libipanat - -LOCAL_MODULE_TAGS := tests -LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/kernel-tests/ip_accelerator - -include $(BUILD_EXECUTABLE) - -endif # $(TARGET_ARCH) -endif -endif diff --git a/data-ipa-cfg-mgr/ipanat/test/Makefile.am b/data-ipa-cfg-mgr/ipanat/test/Makefile.am deleted file mode 100644 index 3aec070..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -AM_CPPFLAGS = -I./../inc \ - -I$(top_srcdir)/ipanat/inc - -AM_CPPFLAGS += -Wall -Wundef -Wno-trigraphs -AM_CPPFLAGS += -g - -ipanattest_SOURCES = ipa_nat_test000.c \ - ipa_nat_test001.c \ - ipa_nat_test002.c \ - ipa_nat_test003.c \ - ipa_nat_test004.c \ - ipa_nat_test005.c \ - ipa_nat_test006.c \ - ipa_nat_test007.c \ - ipa_nat_test008.c \ - ipa_nat_test009.c \ - ipa_nat_test010.c \ - ipa_nat_test011.c \ - ipa_nat_test012.c \ - ipa_nat_test013.c \ - ipa_nat_test014.c \ - ipa_nat_test015.c \ - ipa_nat_test016.c \ - ipa_nat_test017.c \ - ipa_nat_test018.c \ - ipa_nat_test019.c \ - ipa_nat_test020.c \ - ipa_nat_test021.c \ - ipa_nat_test022.c \ - main.c - - -bin_PROGRAMS = ipanattest - -requiredlibs = ../src/libipanat.la - -ipanattest_LDADD = $(requiredlibs) - -LOCAL_MODULE := libipanat -LOCAL_PRELINK_MODULE := false -include $(BUILD_SHARED_LIBRARY) - diff --git a/data-ipa-cfg-mgr/ipanat/test/README.txt b/data-ipa-cfg-mgr/ipanat/test/README.txt deleted file mode 100644 index 4e87121..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -1 To run this suite separately(each test case creates table and delete table) use below command - - To execute test suite nt times with n entries, command "ipanatest sep nt n" - - Example: To execute test suite 1 time with 100 entries, command "ipanattest sep 100" - - -2. To run test suite not separately(creates table and delete table only once) use below command - - To execute test suite nt times with n entries, command "ipanatest reg nt n" - - Example: To execute test suite 5 times with 32 entries, command "ipanattest reg 5 32" - - -3. To run inotify regression test use command, "ipanattest inotify nt" - - Example: To execute inotify 5 times, command "ipanattest inotify 5" - - -4. if we just give command "ipanattest", runs test suite 1 time with 100 entries (non separate) diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test.h b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test.h deleted file mode 100644 index d5ac0d5..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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 FILES FOR MODULE - -===========================================================================*/ -#include "stdint.h" /* uint32_t */ -#include "stdio.h" -#include <netinet/in.h> /* for proto definitions */ - -#define u32 uint32_t -#define u16 uint16_t -#define u8 uint8_t - -/*============ Preconditions to run NAT Test cases =========*/ -#define IPA_NAT_TEST_PRE_COND_TE 20 - -#define CHECK_ERR1(x, tbl_hdl) \ - if(ipa_nat_validate_ipv4_table(tbl_hdl)) { \ - if(sep) {\ - ipa_nat_del_ipv4_tbl(tbl_hdl); \ - }\ - return -1;\ - }\ - if(x) { \ - IPAERR("%d\n", ret); \ - if(sep) {\ - ipa_nat_del_ipv4_tbl(tbl_hdl); \ - }\ - return -1; \ - } - -#define CHECK_ERR(x) if(x) { \ - IPAERR("%d\n", ret); \ - return -1;\ - } - -#if 0 -#define CHECK_ERR(x) if(x) { \ - IPAERR("%d\n", ret); \ - if(sep) {\ - ipa_nat_del_ipv4_tbl(tbl_hdl); \ - }\ - return -1;\ - } -#endif - -#define IPADBG(fmt, args...) printf(" %s:%d " fmt, __FUNCTION__, __LINE__, ## args) -#define IPAERR(fmt, args...) printf(" %s:%d " fmt, __FUNCTION__, __LINE__, ## args) - -#define NAT_DUMP -int ipa_nat_validate_ipv4_table(u32); - -int ipa_nat_test000(int, u32, u8); -int ipa_nat_test001(int, u32, u8); -int ipa_nat_test002(int, u32, u8); -int ipa_nat_test003(int, u32, u8); -int ipa_nat_test004(int, u32, u8); -int ipa_nat_test005(int, u32, u8); -int ipa_nat_test006(int, u32, u8); -int ipa_nat_test007(int, u32, u8); -int ipa_nat_test008(int, u32, u8); -int ipa_nat_test009(int, u32, u8); -int ipa_nat_test010(int, u32, u8); -int ipa_nat_test011(int, u32, u8); -int ipa_nat_test012(int, u32, u8); -int ipa_nat_test013(int, u32, u8); -int ipa_nat_test014(int, u32, u8); -int ipa_nat_test015(int, u32, u8); -int ipa_nat_test016(int, u32, u8); -int ipa_nat_test017(int, u32, u8); -int ipa_nat_test018(int, u32, u8); -int ipa_nat_test019(int, u32, u8); -int ipa_nat_test020(int, u32, u8); -int ipa_nat_test021(int, int); -int ipa_nat_test022(int, u32, u8); diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test000.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test000.c deleted file mode 100644 index 09914ea..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test000.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test000.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Delete ipv4 table -*/ -/*===========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test000(int total_entries, u32 tbl_hdl, u8 sep) -{ - - int ret; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - if (0 != ret) - { - IPAERR("unable to create ipv4 nat table and returning Error:%d\n", ret); - return -1; - } - IPADBG("create nat ipv4 table successfully() \n"); - - IPADBG("calling ipa_nat_del_ipv4_tbl() \n"); - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - if (0 != ret) - { - IPAERR("Unable to delete ipv4 nat table %d\n", ret); - return -1; - } - IPADBG("deleted ipv4 nat table successfully. Test passed \n"); - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test001.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test001.c deleted file mode 100644 index 8daef33..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test001.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test001.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Add ipv4 rule - 3. Delete ipv4 table -*/ -/*===========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test001(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s()\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test002.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test002.c deleted file mode 100644 index e6f5ae3..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test002.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test002.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Add ipv4 rule - 3. delete ipv4 rule - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test002(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s()\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test003.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test003.c deleted file mode 100644 index 0634265..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test003.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - IPA_NAT_ipa_nat_test003.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Add ipv4 rule - 3. Add ipv4 rule - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test003(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test004.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test004.c deleted file mode 100644 index 02378ff..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test004.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test004.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Query nat table handle - 3. Delete ipv4 table -*/ -/*===========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test004(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret = 0; - u32 tbl_hdl1 = 0; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_tbl(tbl_hdl1); - if(ret == 0) - { - IPAERR("able to delete table using invalid table handle\n"); - return -1; - } - } - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test005.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test005.c deleted file mode 100644 index 12228d1..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test005.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test005.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Add ipv4 rule - 3. Delete ipv4 rule - 4. Add ipv4 rule - 5. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test005(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret = 0; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - if (sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test006.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test006.c deleted file mode 100644 index 36f0171..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test006.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test006.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same ipv rules - 3. delete first followed by second - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test006(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret=0; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test007.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test007.c deleted file mode 100644 index 4160c02..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test007.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test007.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same ipv rules - 3. delete second followed by first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test007(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test008.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test008.c deleted file mode 100644 index d016055..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test008.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test008.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 2 distinct rules - 3. delete first followed by second - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test008(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - ipv4_rule1.target_ip = 0xC1171602; /* 193.23.22.2 */ - ipv4_rule1.target_port = 1234; - ipv4_rule1.private_ip = 0xC2171602; /* 194.23.22.2 */ - ipv4_rule1.private_port = 5678; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test009.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test009.c deleted file mode 100644 index cf3c40f..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test009.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test009.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 2 distinct rules - 3. delete second followed by first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test009(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - ipv4_rule1.target_ip = 0xC1171602; /* 193.23.22.2 */ - ipv4_rule1.target_port = 1234; - ipv4_rule1.private_ip = 0xC2171602; /* 194.23.22.2 */ - ipv4_rule1.private_port = 5678; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test010.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test010.c deleted file mode 100644 index 42d7fee..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test010.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test010.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 3 distinct ipv4 rules - 3. delete first, second followed by last - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test010(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1, rule_hdl2; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1, ipv4_rule2; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - ipv4_rule1.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule1.target_port = 1235; - ipv4_rule1.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule1.private_port = 5679; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 9051; - - ipv4_rule2.target_ip = 0xC1171602; /* 193.23.22.2 */ - ipv4_rule2.target_port = 1235; - ipv4_rule2.private_ip = 0xC2171602; /* 194.23.22.2 */ - ipv4_rule2.private_port = 5679; - ipv4_rule2.protocol = IPPROTO_TCP; - ipv4_rule2.public_port = 9051; - - IPADBG("%s():\n",__FUNCTION__); - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test011.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test011.c deleted file mode 100644 index bcce76c..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test011.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test011.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 3 distinct ipv4 rules - 3. delete second, first followed by last - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test011(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1, rule_hdl2; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1, ipv4_rule2; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - ipv4_rule1.target_ip = 0xF1181601; - ipv4_rule1.target_port = 1555; - ipv4_rule1.private_ip = 0xF2151601; - ipv4_rule1.private_port = 5999; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 9111; - - ipv4_rule2.target_ip = 0xC1166602; - ipv4_rule2.target_port = 1555; - ipv4_rule2.private_ip = 0xC2155602; - ipv4_rule2.private_port = 5777; - ipv4_rule2.protocol = IPPROTO_TCP; - ipv4_rule2.public_port = 9000; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test012.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test012.c deleted file mode 100644 index 9d3c835..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test012.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test012.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 3 distinct ipv4 rules - 3. Delete third, second, first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - - -int ipa_nat_test012(int totoal_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1, rule_hdl2; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1, ipv4_rule2; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - ipv4_rule1.target_ip = 0xD1171601; - ipv4_rule1.target_port = 3512; - ipv4_rule1.private_ip = 0xD2471601; - ipv4_rule1.private_port = 9997; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 8881; - - ipv4_rule2.target_ip = 0xC1172452; - ipv4_rule2.target_port = 1895; - ipv4_rule2.private_ip = 0xC2172452; - ipv4_rule2.private_port = 6668; - ipv4_rule2.protocol = IPPROTO_TCP; - ipv4_rule2.public_port = 5551; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, totoal_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test013.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test013.c deleted file mode 100644 index 2b9b005..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test013.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test013.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add 3 distinct ipv4 rules - 3. Delete third, first and second - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test013(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl, rule_hdl1, rule_hdl2; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule1, ipv4_rule2; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - ipv4_rule1.target_ip = 0xC1171609; /* 193.23.22.9 */ - ipv4_rule1.target_port = 1235; - ipv4_rule1.private_ip = 0xC2171609; /* 194.23.22.9 */ - ipv4_rule1.private_port = 6579; - ipv4_rule1.protocol = IPPROTO_TCP; - ipv4_rule1.public_port = 8951; - - ipv4_rule2.target_ip = 0xC1171606; /* 193.23.22.6 */ - ipv4_rule2.target_port = 1235; - ipv4_rule2.private_ip = 0xC2171606; /* 194.23.22.6 */ - ipv4_rule2.private_port = 7956; - ipv4_rule2.protocol = IPPROTO_TCP; - ipv4_rule2.public_port = 5109; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule1, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test014.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test014.c deleted file mode 100644 index fd30317..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test014.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test014.cpp - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete first, second and third - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test014(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s()\n", __FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test015.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test015.c deleted file mode 100644 index eaef923..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test015.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test015.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete first, third and second - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - - -int ipa_nat_test015(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test016.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test016.c deleted file mode 100644 index 23157e2..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test016.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test016.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete second, first and third - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test016(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test017.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test017.c deleted file mode 100644 index d88e611..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test017.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test017.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete second, third and first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test017(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test018.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test018.c deleted file mode 100644 index c885d4d..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test018.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test018.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete third, second and first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test018(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test019.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test019.c deleted file mode 100644 index 3ba3119..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test019.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test019.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete third, first and second - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test019(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test020.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test020.c deleted file mode 100644 index e6871b5..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test020.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test020.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 4 ipv rules - 3. delete third, second, fourth and first - 4. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test020(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3, rule_hdl4; - ipa_nat_ipv4_rule ipv4_rule; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl4); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl2); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl4); - CHECK_ERR(ret); - - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR(ret); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test021.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test021.c deleted file mode 100644 index 48c4321..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test021.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - -/*=========================================================================*/ -/*! - @file - ipa_nat_test021.c - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test021(int total_entries, int reg) -{ - - int ret, i; - u32 tbl_hdl; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - IPADBG("%s():\n",__FUNCTION__); - - for(i=0; i<reg; i++) - { - IPADBG("executing %d th time:\n",i); - - IPADBG("calling ipa_nat_add_ipv4_tbl() \n"); - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - if (0 != ret) - { - IPAERR("unable to create ipv4 nat table and returning Error:%d\n", ret); - IPADBG("executed %d times:\n",i); - return -1; - } - IPADBG("create nat ipv4 table successfully() \n"); - - IPADBG("calling ipa_nat_del_ipv4_tbl() \n"); - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - if (0 != ret) - { - IPAERR("Unable to delete ipv4 nat table %d\n", ret); - IPADBG("executed %d times:\n",i); - return -1; - } - IPADBG("deleted ipv4 nat table successfully. Test passed \n"); - } - - IPADBG("executed %d times:\n",(i+1)); - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test022.c b/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test022.c deleted file mode 100644 index ebdd291..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/ipa_nat_test022.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. - */ - - -/*=========================================================================*/ -/*! - @file - ipa_nat_test022.cpp - - @brief - Verify the following scenario: - 1. Add ipv4 table - 2. add same 3 ipv rules - 3. delete Head and last entry - 4. add 2 new same ip4 entries - 5. Add head entry again - 6. Delete ipv4 table -*/ -/*=========================================================================*/ - -#include "ipa_nat_test.h" -#include "ipa_nat_drv.h" - -int ipa_nat_test022(int total_entries, u32 tbl_hdl, u8 sep) -{ - int ret; - u32 rule_hdl1, rule_hdl2, rule_hdl3; - ipa_nat_ipv4_rule ipv4_rule, ipv4_rule2; - u32 rule_hdl21, rule_hdl22; - - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - /* Rule 1 */ - ipv4_rule.target_ip = 0xC1171601; /* 193.23.22.1 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171601; /* 194.23.22.1 */ - ipv4_rule.private_port = 5678; - ipv4_rule.protocol = IPPROTO_TCP; - ipv4_rule.public_port = 9050; - - /* Rule 2*/ - ipv4_rule.target_ip = 0xC1171604; /* 193.23.22.4 */ - ipv4_rule.target_port = 1234; - ipv4_rule.private_ip = 0xC2171603; /* 194.23.22.3 */ - ipv4_rule.private_port = 5680; - ipv4_rule.protocol = IPPROTO_UDP; - ipv4_rule.public_port = 9066; - - IPADBG("%s():\n",__FUNCTION__); - - if(sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR1(ret, tbl_hdl); - } - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl1); - CHECK_ERR1(ret, tbl_hdl); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl2); - CHECK_ERR1(ret, tbl_hdl); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR1(ret, tbl_hdl); - - /* Delete head entry */ - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl1); - CHECK_ERR1(ret, tbl_hdl); - - /* Delete Last Entry */ - ret = ipa_nat_del_ipv4_rule(tbl_hdl, rule_hdl3); - CHECK_ERR1(ret, tbl_hdl); - - /* Add 2 different Entries */ - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl21); - CHECK_ERR1(ret, tbl_hdl); - - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule2, &rule_hdl22); - CHECK_ERR1(ret, tbl_hdl); - - /* Add first entry again */ - ret = ipa_nat_add_ipv4_rule(tbl_hdl, &ipv4_rule, &rule_hdl3); - CHECK_ERR1(ret, tbl_hdl); - - if(sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR1(ret, tbl_hdl); - } - - return 0; -} diff --git a/data-ipa-cfg-mgr/ipanat/test/main.c b/data-ipa-cfg-mgr/ipanat/test/main.c deleted file mode 100644 index c49ce3b..0000000 --- a/data-ipa-cfg-mgr/ipanat/test/main.c +++ /dev/null @@ -1,640 +0,0 @@ -/* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * 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 The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "ipa_nat_drv.h" -#include "ipa_nat_drvi.h" -#include "ipa_nat_test.h" - -extern struct ipa_nat_cache ipv4_nat_cache; - -int chk_for_loop(u32 tbl_hdl) -{ - struct ipa_nat_rule *tbl_ptr; - struct ipa_nat_indx_tbl_rule *indx_tbl_ptr; - int cnt; - uint16_t cur_entry; - - if (IPA_NAT_INVALID_NAT_ENTRY == tbl_hdl || - tbl_hdl > IPA_NAT_MAX_IP4_TBLS) { - IPAERR("invalid table handle passed \n"); - return -EINVAL; - } - - IPADBG("checking ipv4 rules:\n"); - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_rules_addr; - for (cnt = 0; - cnt < ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - cnt++) { - if (Read16BitFieldValue(tbl_ptr[cnt].ip_cksm_enbl,ENABLE_FIELD)) { - if(Read16BitFieldValue(tbl_ptr[cnt].nxt_indx_pub_port, - NEXT_INDEX_FIELD) == cnt) - { - IPAERR("Infinite loop detected, entry\n"); - ipa_nati_print_rule(&tbl_ptr[cnt], cnt); - return -EINVAL; - } - } - } - - /* Print ipv4 expansion rules */ - IPADBG("checking ipv4 active expansion rules:\n"); - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_expn_rules_addr; - for (cnt = 0; - cnt <= ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].expn_table_entries; - cnt++) { - if (Read16BitFieldValue(tbl_ptr[cnt].ip_cksm_enbl, - ENABLE_FIELD)) { - cur_entry = - cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - if (Read16BitFieldValue(tbl_ptr[cnt].nxt_indx_pub_port, - NEXT_INDEX_FIELD) == cur_entry) - { - IPAERR("Infinite loop detected\n"); - ipa_nati_print_rule(&tbl_ptr[cnt], - (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries)); - return -EINVAL; - } - } - } - - /* Print ipv4 index rules */ - IPADBG("checking ipv4 index active rules: \n"); - indx_tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_addr; - for (cnt = 0; - cnt < ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - cnt++) { - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_TBL_ENTRY_FIELD)) { - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_NEXT_INDEX_FILED) == cnt) - { - IPAERR("Infinite loop detected\n"); - ipa_nati_print_index_rule(&indx_tbl_ptr[cnt], cnt, 0); - return -EINVAL; - } - } - } - - /* Print ipv4 index expansion rules */ - IPADBG("Checking ipv4 index expansion active rules: \n"); - indx_tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_expn_addr; - for (cnt = 0; - cnt <= ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].expn_table_entries; - cnt++) { - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_TBL_ENTRY_FIELD)) { - cur_entry = - cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_NEXT_INDEX_FILED) == cur_entry) - { - IPAERR("Infinite loop detected\n"); - ipa_nati_print_index_rule(&indx_tbl_ptr[cnt], - (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries), - ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].index_expn_table_meta[cnt].prev_index); - return -EINVAL; - } - } - } - return 0; -} - -uint8_t is_base_entry_valid(u32 tbl_hdl, u16 entry) -{ - struct ipa_nat_rule *tbl_ptr; - - if (entry > - ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries) - { - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_expn_rules_addr; - entry -= - ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - } - else - { - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_rules_addr; - } - return (Read16BitFieldValue(tbl_ptr[entry].ip_cksm_enbl, - ENABLE_FIELD)); -} - -uint8_t is_index_entry_valid(u32 tbl_hdl, u16 entry) -{ - struct ipa_nat_indx_tbl_rule *tbl_ptr; - - if (entry > - ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries) - { - tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_expn_addr; - entry -= - ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - } - else - { - tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_addr; - } - if (Read16BitFieldValue(tbl_ptr[entry].tbl_entry_nxt_indx, - INDX_TBL_TBL_ENTRY_FIELD)) { - return 1; - } - else - { - return 0; - } -} - -int chk_for_validity(u32 tbl_hdl) -{ - struct ipa_nat_rule *tbl_ptr; - struct ipa_nat_indx_tbl_rule *indx_tbl_ptr; - uint16_t nxt_index, prv_index; - int cnt; - - if (IPA_NAT_INVALID_NAT_ENTRY == tbl_hdl || - tbl_hdl > IPA_NAT_MAX_IP4_TBLS) { - IPAERR("invalid table handle passed \n"); - return -EINVAL; - } - - /* Validate base table next_indx and prev_indx values */ - IPADBG("Validating ipv4 active rules: \n"); - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_rules_addr; - for (cnt = 0; - cnt < ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - cnt++) { - if (Read16BitFieldValue(tbl_ptr[cnt].ip_cksm_enbl, - ENABLE_FIELD)) { - nxt_index = - Read16BitFieldValue(tbl_ptr[cnt].nxt_indx_pub_port, - NEXT_INDEX_FIELD); - if (!is_base_entry_valid(tbl_hdl, nxt_index)) { - IPAERR("Invalid next index found, entry:%d\n", cnt); - } - } - } - - IPADBG("Validating ipv4 expansion active rules: \n"); - tbl_ptr = (struct ipa_nat_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].ipv4_expn_rules_addr; - for (cnt = 0; - cnt <= ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].expn_table_entries; - cnt++) { - if (Read16BitFieldValue(tbl_ptr[cnt].ip_cksm_enbl, - ENABLE_FIELD)) { - /* Validate next index */ - nxt_index = - Read16BitFieldValue(tbl_ptr[cnt].nxt_indx_pub_port, - NEXT_INDEX_FIELD); - if (!is_base_entry_valid(tbl_hdl, nxt_index)) { - IPAERR("Invalid next index found, entry:%d\n", cnt); - } - /* Validate previous index */ - prv_index = - Read16BitFieldValue(tbl_ptr[cnt].sw_spec_params, - SW_SPEC_PARAM_PREV_INDEX_FIELD); - if (!is_base_entry_valid(tbl_hdl, prv_index)) { - IPAERR("Invalid Previous index found, entry:%d\n", cnt); - } - } - } - - IPADBG("Validating ipv4 index active rules: \n"); - indx_tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_addr; - for (cnt = 0; - cnt < ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].table_entries; - cnt++) { - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_TBL_ENTRY_FIELD)) { - nxt_index = - Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_NEXT_INDEX_FILED); - if (!is_index_entry_valid(tbl_hdl, nxt_index)) { - IPAERR("Invalid next index found, entry:%d\n", cnt); - } - } - } - - IPADBG("Validating ipv4 index expansion active rules: \n"); - indx_tbl_ptr = (struct ipa_nat_indx_tbl_rule *) - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_table_expn_addr; - for (cnt = 0; - cnt <= ipv4_nat_cache.ip4_tbl[tbl_hdl - 1].expn_table_entries; - cnt++) { - if (Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_TBL_ENTRY_FIELD)) { - /* Validate next index*/ - nxt_index = - Read16BitFieldValue(indx_tbl_ptr[cnt].tbl_entry_nxt_indx, - INDX_TBL_NEXT_INDEX_FILED); - if (!is_index_entry_valid(tbl_hdl, nxt_index)) { - IPAERR("Invalid next index found, entry:%d\n", cnt); - } - - /* Validate previous index*/ - prv_index = - ipv4_nat_cache.ip4_tbl[tbl_hdl-1].index_expn_table_meta[cnt].prev_index; - - if (!is_index_entry_valid(tbl_hdl, prv_index)) { - IPAERR("Invalid Previous index found, entry:%d\n", cnt); - } - } - } - - return 0; -} - -int ipa_nat_validate_ipv4_table(u32 tbl_hdl) -{ - int ret = 0; - - ret = chk_for_loop(tbl_hdl); - if (ret) - return ret; - ret = chk_for_validity(tbl_hdl); - - return ret; -} - -int main(int argc, char* argv[]) -{ - int exec = 0, pass = 0, ret; - int cnt, nt=1; - int total_entries = 100; - u8 sep = 0; - u32 tbl_hdl = 0; - u32 pub_ip_add = 0x011617c0; /* "192.23.22.1" */ - - IPADBG("ipa_nat_testing user space nat driver\n"); - - if (argc == 4) - { - if (!strncmp(argv[1], "reg", 3)) - { - nt = atoi(argv[2]); - total_entries = atoi(argv[3]); - IPADBG("Reg: %d, Nat Entries: %d\n", nt, total_entries); - } - else if (!strncmp(argv[1], "sep", 3)) - { - sep = 1; - nt = atoi(argv[2]); - total_entries = atoi(argv[3]); - } - } - else if (argc == 3) - { - if (!strncmp(argv[1], "inotify", 7)) - { - ipa_nat_test021(total_entries, atoi(argv[2])); - return 0; - } - else if (!strncmp(argv[1], "sep", 3)) - { - sep = 1; - total_entries = atoi(argv[2]); - } - } - else if (argc == 2) - { - total_entries = atoi(argv[1]); - IPADBG("Nat Entries: %d\n", total_entries); - } - - - for (cnt=0; cnt<nt; cnt++) - { - IPADBG("%s():Executing %d time \n",__FUNCTION__, cnt); - - if (!sep) - { - ret = ipa_nat_add_ipv4_tbl(pub_ip_add, total_entries, &tbl_hdl); - CHECK_ERR(ret); - } - - if (sep) - { - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test000(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test001(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - } - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test002(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - if (sep) - { - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test003(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test004(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test005(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - } - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test006(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test007(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test008(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test00%d\n", exec); - ret = ipa_nat_test009(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test00%d Fail\n", exec); - } - exec++; - - if (total_entries >= IPA_NAT_TEST_PRE_COND_TE) - { - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test010(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test011(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test012(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test013(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test014(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test015(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test016(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test017(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test018(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test019(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test020(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - - IPADBG("\n\nExecuting ipa_nat_test0%d\n", exec); - ret = ipa_nat_test022(total_entries, tbl_hdl, sep); - if (!ret) - { - pass++; - } - else - { - IPAERR("ipa_nat_test0%d Fail\n", exec); - } - exec++; - } - - if (!sep) - { - ret = ipa_nat_del_ipv4_tbl(tbl_hdl); - CHECK_ERR(ret); - } - } - /*======= Printing Results ==========*/ - IPADBG("Total ipa_nat Tests Run:%d, Pass:%d, Fail:%d\n",exec, pass, exec-pass); - return 0; -} |