diff --git a/.github/workflows/dai-testing.yml b/.github/workflows/dai-testing.yml index f7c1467..0c365f6 100644 --- a/.github/workflows/dai-testing.yml +++ b/.github/workflows/dai-testing.yml @@ -19,111 +19,109 @@ jobs: - name: Make test script executable run: | chmod +x ./tests/testenv/*.sh - chmod +x ./tests/InitializationOfTheModule/*.sh - chmod +x ./tests/SettingDynamicParameters/*.sh - chmod +x ./tests/UsingDynamicParameters/*.sh - chmod +x ./tests/CoreDAIFeatures/*.sh - chmod +x ./tests/EdgeCases/*.sh - - # Run Initialization_Of_The_Module Tests - - name: Run Test_Build_Kernel_Module - working-directory: ./tests/InitializationOfTheModule/ - run: ./Test_Build_Kernel_Module.sh - - - name: Run Test_Insert_Kernel_Module - working-directory: ./tests/InitializationOfTheModule/ - run: ./Test_Insert_Kernel_Module.sh - - # Run Setting_Dynamic_Parameters Tests - - name: Run Test_add_Trusted_Interface - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_Trusted_Interface.sh - - - name: Run Test_add_Trusted_Interfaces_Malformed - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_Trusted_Interfaces_Malformed.sh - - - name: Run Test_add_Trusted_Interfaces - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_Trusted_Interfaces.sh - - - name: Run Test_add_VLAN - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_VLAN.sh - - - name: Run Test_add_VLANs_Malformed - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_VLANs_Malformed.sh - - - name: Run Test_add_VLANs - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_add_VLANs.sh - - - name: Run Test_set_globally_enabled_DAI - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_set_globally_enabled_DAI.sh - - - name: Run Test_set_globally_enabled_DAI_Malformed - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_set_globally_enabled_DAI_Malformed.sh - - - name: Run Test_set_static_ACL_Enabled - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_set_static_ACL_Enabled.sh - - - name: Run Test_set_static_ACL_Enabled_Malformed - working-directory: ./tests/SettingDynamicParameters/ - run: ./Test_set_static_ACL_Enabled_Malformed.sh - - # Run Using_Dynamic_Parameters Tests - - name: Run Test_DAI_VLAN_Filtering - working-directory: ./tests/UsingDynamicParameters/ - run: ./Test_DAI_VLAN_Filtering.sh - - - name: Run Test_globally_enabled_DAI - working-directory: ./tests/UsingDynamicParameters/ - run: ./Test_globally_enabled_DAI.sh - - - name: Run Test_static_ACL_Enabled - working-directory: ./tests/UsingDynamicParameters/ - run: ./Test_static_ACL_Enabled.sh + chmod +x ./tests/module_init/*.sh + chmod +x ./tests/set_params/*.sh + chmod +x ./tests/param_behavior/*.sh + chmod +x ./tests/core_dai_features/*.sh + chmod +x ./tests/edge_cases/*.sh + + # Run module_init Tests + - name: Run test_build_kernel_module + working-directory: ./tests/module_init/ + run: ./test_build_kernel_module.sh + + - name: Run test_insert_kernel_module + working-directory: ./tests/module_init/ + run: ./test_insert_kernel_module.sh + + # Run set_params Tests + - name: Run test_add_trusted_interface + working-directory: ./tests/set_params/ + run: ./test_add_trusted_interface.sh + + - name: Run test_add_trusted_interfaces_malformed + working-directory: ./tests/set_params/ + run: ./test_add_trusted_interfaces_malformed.sh + + - name: Run test_add_trusted_interfaces + working-directory: ./tests/set_params/ + run: ./test_add_trusted_interfaces.sh + + - name: Run test_add_vlan + working-directory: ./tests/set_params/ + run: ./test_add_vlan.sh + + - name: Run test_add_vlans_malformed + working-directory: ./tests/set_params/ + run: ./test_add_vlans_malformed.sh + + - name: Run test_add_vlans + working-directory: ./tests/set_params/ + run: ./test_add_vlans.sh + + - name: Run test_set_globally_enabled_dai_malformed + working-directory: ./tests/set_params/ + run: ./test_set_globally_enabled_dai_malformed.sh + + - name: Run test_set_globally_enabled_dai + working-directory: ./tests/set_params/ + run: ./test_set_globally_enabled_dai.sh + + - name: Run test_set_static_acl_enabled_malformed + working-directory: ./tests/set_params/ + run: ./test_set_static_acl_enabled_malformed.sh + + - name: Run test_set_static_acl_enabled + working-directory: ./tests/set_params/ + run: ./test_set_static_acl_enabled.sh + + # Run param_behavior Tests + - name: Run test_dai_vlan_filtering + working-directory: ./tests/param_behavior/ + run: ./test_dai_vlan_filtering.sh + + - name: Run test_globally_enabled_dai + working-directory: ./tests/param_behavior/ + run: ./test_globally_enabled_dai.sh + + - name: Run test_static_acl_enabled + working-directory: ./tests/param_behavior/ + run: ./test_static_acl_enabled.sh - # Run Core_DAI_Features Tests - - - name: Run Test_ARP_Poisoning - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_ARP_Poisoning.sh - - - name: Run Test_Communication_after_DHCP_Snooping - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Communication_after_DHCP_Snooping.sh - - - name: Run Test_Communication_from_Unacknowledged_Sources - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Communication_from_Unacknowledged_Sources.sh - - - name: Run Test_Static_Entry_In_The_ARP_Table - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Static_Entry_In_The_ARP_Table.sh - - - name: Run Test_Trusted_Interfaces - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Trusted_Interfaces.sh - - - name: Run Test_Untrusted_Interfaces - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Untrusted_Interfaces.sh - - - name: Run Test_Above_Rate_Limit - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Above_Rate_Limit.sh - - - name: Run Test_Below_Rate_Limit - working-directory: ./tests/CoreDAIFeatures/ - run: ./Test_Below_Rate_Limit.sh - - # Run Edge_Cases Tests - - - name: Run Test_Malformed_ARP_Request - working-directory: ./tests/EdgeCases/ - run: ./Test_Malformed_ARP_Request.sh \ No newline at end of file + # Run core_dai_features Tests + - name: Run test_above_rate_limit + working-directory: ./tests/core_dai_features/ + run: ./test_above_rate_limit.sh + + - name: Run test_arp_poisoning + working-directory: ./tests/core_dai_features/ + run: ./test_arp_poisoning.sh + + - name: Run test_below_rate_limit + working-directory: ./tests/core_dai_features/ + run: ./test_below_rate_limit.sh + + - name: Run test_communication_after_dhcp_snooping + working-directory: ./tests/core_dai_features/ + run: ./test_communication_after_dhcp_snooping.sh + + - name: Run test_communication_from_unacknowledged_sources + working-directory: ./tests/core_dai_features/ + run: ./test_communication_from_unacknowledged_sources.sh + + - name: Run test_static_entry_in_the_arp_table + working-directory: ./tests/core_dai_features/ + run: ./test_static_entry_in_the_arp_table.sh + + - name: Run test_trusted_interfaces + working-directory: ./tests/core_dai_features/ + run: ./test_trusted_interfaces.sh + + - name: Run test_untrusted_interfaces + working-directory: ./tests/core_dai_features/ + run: ./test_untrusted_interfaces.sh + + # Run edge_cases Tests + - name: Run test_malformed_arp_request + working-directory: ./tests/edge_cases/ + run: ./test_malformed_arp_request.sh \ No newline at end of file diff --git a/Makefile b/Makefile index 5e27ea1..9990630 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ KERNELRELEASE := $(shell uname -r) KDIR := /lib/modules/${KERNELRELEASE}/build MDIR := /lib/modules/${KERNELRELEASE} obj-m := ${MODULE}.o -${MODULE}-objs := main.o dhcp.o trustedInterfaces.o rate_limit.o vlan.o +${MODULE}-objs := main.o dhcp.o trusted_interfaces.o rate_limit.o vlan.o all: @echo "Building the module..." diff --git a/main.c b/main.c index ab9aa2e..ab0ff54 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ #include "dhcp.h" -#include "trustedInterfaces.h" +#include "trusted_interfaces.h" #include "rate_limit.h" #include "vlan.h" #include "errno.h" diff --git a/tests/CoreDAIFeatures/Test_Above_Rate_Limit.sh b/tests/core_dai_features/test_above_rate_limit.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Above_Rate_Limit.sh rename to tests/core_dai_features/test_above_rate_limit.sh diff --git a/tests/CoreDAIFeatures/Test_ARP_Poisoning.sh b/tests/core_dai_features/test_arp_poisoning.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_ARP_Poisoning.sh rename to tests/core_dai_features/test_arp_poisoning.sh diff --git a/tests/CoreDAIFeatures/Test_Below_Rate_Limit.sh b/tests/core_dai_features/test_below_rate_limit.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Below_Rate_Limit.sh rename to tests/core_dai_features/test_below_rate_limit.sh diff --git a/tests/CoreDAIFeatures/Test_Communication_after_DHCP_Snooping.sh b/tests/core_dai_features/test_communication_after_dhcp_snooping.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Communication_after_DHCP_Snooping.sh rename to tests/core_dai_features/test_communication_after_dhcp_snooping.sh diff --git a/tests/CoreDAIFeatures/Test_Communication_from_Unacknowledged_Sources.sh b/tests/core_dai_features/test_communication_from_unacknowledged_sources.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Communication_from_Unacknowledged_Sources.sh rename to tests/core_dai_features/test_communication_from_unacknowledged_sources.sh diff --git a/tests/CoreDAIFeatures/Test_Static_Entry_In_The_ARP_Table.sh b/tests/core_dai_features/test_static_entry_in_the_arp_table.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Static_Entry_In_The_ARP_Table.sh rename to tests/core_dai_features/test_static_entry_in_the_arp_table.sh diff --git a/tests/CoreDAIFeatures/Test_Trusted_Interfaces.sh b/tests/core_dai_features/test_trusted_interfaces.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Trusted_Interfaces.sh rename to tests/core_dai_features/test_trusted_interfaces.sh diff --git a/tests/CoreDAIFeatures/Test_Untrusted_Interfaces.sh b/tests/core_dai_features/test_untrusted_interfaces.sh similarity index 100% rename from tests/CoreDAIFeatures/Test_Untrusted_Interfaces.sh rename to tests/core_dai_features/test_untrusted_interfaces.sh diff --git a/tests/EdgeCases/Test_Malformed_ARP_Request.sh b/tests/edge_cases/test_malformed_arp_request.sh similarity index 97% rename from tests/EdgeCases/Test_Malformed_ARP_Request.sh rename to tests/edge_cases/test_malformed_arp_request.sh index 37f06ee..e989358 100644 --- a/tests/EdgeCases/Test_Malformed_ARP_Request.sh +++ b/tests/edge_cases/test_malformed_arp_request.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Test_Malformed_ARP_Request_and_Response.sh # This script checks if the kernel module drops malformed arp requests set -euo pipefail #treat unset vars as errors diff --git a/tests/InitializationOfTheModule/Test_Build_Kernel_Module.sh b/tests/module_init/test_build_kernel_module.sh similarity index 100% rename from tests/InitializationOfTheModule/Test_Build_Kernel_Module.sh rename to tests/module_init/test_build_kernel_module.sh diff --git a/tests/InitializationOfTheModule/Test_Insert_Kernel_Module.sh b/tests/module_init/test_insert_kernel_module.sh similarity index 100% rename from tests/InitializationOfTheModule/Test_Insert_Kernel_Module.sh rename to tests/module_init/test_insert_kernel_module.sh diff --git a/tests/UsingDynamicParameters/Test_DAI_VLAN_Filtering.sh b/tests/param_behavior/test_dai_vlan_filtering.sh similarity index 100% rename from tests/UsingDynamicParameters/Test_DAI_VLAN_Filtering.sh rename to tests/param_behavior/test_dai_vlan_filtering.sh diff --git a/tests/UsingDynamicParameters/Test_globally_enabled_DAI.sh b/tests/param_behavior/test_globally_enabled_dai.sh similarity index 98% rename from tests/UsingDynamicParameters/Test_globally_enabled_DAI.sh rename to tests/param_behavior/test_globally_enabled_dai.sh index df11d0d..62d188f 100644 --- a/tests/UsingDynamicParameters/Test_globally_enabled_DAI.sh +++ b/tests/param_behavior/test_globally_enabled_dai.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Test_globally_enabled_DAI.sh # This script checks if the kernel module inspects all packets when globally_enabled_DAI is true set -euo pipefail #treat unset vars as errors diff --git a/tests/UsingDynamicParameters/Test_static_ACL_Enabled.sh b/tests/param_behavior/test_static_acl_enabled.sh similarity index 94% rename from tests/UsingDynamicParameters/Test_static_ACL_Enabled.sh rename to tests/param_behavior/test_static_acl_enabled.sh index 3f1a16c..1b51e91 100644 --- a/tests/UsingDynamicParameters/Test_static_ACL_Enabled.sh +++ b/tests/param_behavior/test_static_acl_enabled.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Test_static_ACL_Enabled.sh -# This script checks if the kernel module Accepts packets that were added statically and rejects them if they were not. It does not check the DHCP snooping table +# This script checks if the kernel module Accepts packets that were added statically and rejects them if they were not. +# It does not check the DHCP snooping table set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_add_Trusted_Interface.sh b/tests/set_params/test_add_trusted_interface.sh similarity index 100% rename from tests/SettingDynamicParameters/Test_add_Trusted_Interface.sh rename to tests/set_params/test_add_trusted_interface.sh diff --git a/tests/SettingDynamicParameters/Test_add_Trusted_Interfaces.sh b/tests/set_params/test_add_trusted_interfaces.sh similarity index 98% rename from tests/SettingDynamicParameters/Test_add_Trusted_Interfaces.sh rename to tests/set_params/test_add_trusted_interfaces.sh index 1226a5e..8e31297 100644 --- a/tests/SettingDynamicParameters/Test_add_Trusted_Interfaces.sh +++ b/tests/set_params/test_add_trusted_interfaces.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if the kernel module can add more than one Interfaces to the Trusted List +# This script checks if the kernel module can add more than one Interface to the Trusted List set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_add_Trusted_Interfaces_Malformed.sh b/tests/set_params/test_add_trusted_interfaces_malformed.sh similarity index 99% rename from tests/SettingDynamicParameters/Test_add_Trusted_Interfaces_Malformed.sh rename to tests/set_params/test_add_trusted_interfaces_malformed.sh index 0412de5..9787a68 100644 --- a/tests/SettingDynamicParameters/Test_add_Trusted_Interfaces_Malformed.sh +++ b/tests/set_params/test_add_trusted_interfaces_malformed.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if the kernel module can handle malformed Trusted Interface Input +# This script checks if the kernel module can handle malformed Trusted Interface Inputs set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_add_VLAN.sh b/tests/set_params/test_add_vlan.sh similarity index 95% rename from tests/SettingDynamicParameters/Test_add_VLAN.sh rename to tests/set_params/test_add_vlan.sh index 9014f08..f6697a3 100644 --- a/tests/SettingDynamicParameters/Test_add_VLAN.sh +++ b/tests/set_params/test_add_vlan.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if DAI can add one VLAN to the inspection list +# This script checks if the module can add one VLAN to the inspection list set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_add_VLANs.sh b/tests/set_params/test_add_vlans.sh similarity index 95% rename from tests/SettingDynamicParameters/Test_add_VLANs.sh rename to tests/set_params/test_add_vlans.sh index b0d0f50..88423a4 100644 --- a/tests/SettingDynamicParameters/Test_add_VLANs.sh +++ b/tests/set_params/test_add_vlans.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if DAI can add more than one VLANs to the inspection list +# This script checks if DAI can add more than one vlan to the inspection list set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_add_VLANs_Malformed.sh b/tests/set_params/test_add_vlans_malformed.sh similarity index 96% rename from tests/SettingDynamicParameters/Test_add_VLANs_Malformed.sh rename to tests/set_params/test_add_vlans_malformed.sh index 3d66522..4773f87 100644 --- a/tests/SettingDynamicParameters/Test_add_VLANs_Malformed.sh +++ b/tests/set_params/test_add_vlans_malformed.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if the kernel module can handle malformed Trusted Interface Input +# This script checks if the kernel module can handle malformed vlan to the inspection list. set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_set_globally_enabled_DAI.sh b/tests/set_params/test_set_globally_enabled_dai.sh similarity index 94% rename from tests/SettingDynamicParameters/Test_set_globally_enabled_DAI.sh rename to tests/set_params/test_set_globally_enabled_dai.sh index 09ac6bd..24256b3 100644 --- a/tests/SettingDynamicParameters/Test_set_globally_enabled_DAI.sh +++ b/tests/set_params/test_set_globally_enabled_dai.sh @@ -1,7 +1,7 @@ #!/bin/bash -# This script checks if DAI can set the globally_enabled_DAI boolean. -# When enabled the kernel module inspects all packets as if they are part of the same VLAN +# This script checks if the module can set the globally_enabled_dai boolean. +# When enabled the kernel module inspects all packets as if they are part of the same vlan. set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_set_static_ACL_Enabled_Malformed.sh b/tests/set_params/test_set_globally_enabled_dai_malformed.sh similarity index 96% rename from tests/SettingDynamicParameters/Test_set_static_ACL_Enabled_Malformed.sh rename to tests/set_params/test_set_globally_enabled_dai_malformed.sh index 47026fb..f923e97 100644 --- a/tests/SettingDynamicParameters/Test_set_static_ACL_Enabled_Malformed.sh +++ b/tests/set_params/test_set_globally_enabled_dai_malformed.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if the kernel module can handle malformed Trusted Interface Input +# This script checks if the kernel module can handle malformed globally_enabled_dai inputs set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_set_static_ACL_Enabled.sh b/tests/set_params/test_set_static_acl_enabled.sh similarity index 92% rename from tests/SettingDynamicParameters/Test_set_static_ACL_Enabled.sh rename to tests/set_params/test_set_static_acl_enabled.sh index 6327624..405896e 100644 --- a/tests/SettingDynamicParameters/Test_set_static_ACL_Enabled.sh +++ b/tests/set_params/test_set_static_acl_enabled.sh @@ -1,8 +1,8 @@ #!/bin/bash -# This script checks if DAI can set the static_ACL_Enabled boolean. -# When enabled the DHCP Snooping table is no longer considered and Packets are accepted or dropped based -# on the static arp table +# This script checks if the module can set the static_acl_enabled input parameter. +# When enabled the DHCP Snooping table is no longer considered and packets are accepted or dropped based +# on the static arp table. set -euo pipefail #treat unset vars as errors diff --git a/tests/SettingDynamicParameters/Test_set_globally_enabled_DAI_Malformed.sh b/tests/set_params/test_set_static_acl_enabled_malformed.sh similarity index 96% rename from tests/SettingDynamicParameters/Test_set_globally_enabled_DAI_Malformed.sh rename to tests/set_params/test_set_static_acl_enabled_malformed.sh index 47026fb..e6fc578 100644 --- a/tests/SettingDynamicParameters/Test_set_globally_enabled_DAI_Malformed.sh +++ b/tests/set_params/test_set_static_acl_enabled_malformed.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script checks if the kernel module can handle malformed Trusted Interface Input +# This script checks if the kernel module can handle malformed static_acl_enabled inputs. set -euo pipefail #treat unset vars as errors diff --git a/trustedInterfaces.c b/trusted_interfaces.c similarity index 99% rename from trustedInterfaces.c rename to trusted_interfaces.c index e3410c0..190e221 100644 --- a/trustedInterfaces.c +++ b/trusted_interfaces.c @@ -1,4 +1,4 @@ -#include "trustedInterfaces.h" +#include "trusted_interfaces.h" #include "errno.h" LIST_HEAD(trusted_interface_list); // Global list head for interfaces diff --git a/trustedInterfaces.h b/trusted_interfaces.h similarity index 100% rename from trustedInterfaces.h rename to trusted_interfaces.h