-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11991 from marcusburghardt/set_nftables_table
Better description and test scenarios for set_nftables_table
- Loading branch information
Showing
6 changed files
with
69 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
linux_os/guide/system/network/network-nftables/set_nftables_table/bash/shared.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# platform = multi_platform_all | ||
# reboot = false | ||
# strategy = restrict | ||
# complexity = low | ||
# disruption = low | ||
|
||
#Set nftables family name | ||
{{{ bash_instantiate_variables("var_nftables_family") }}} | ||
|
||
#Set nftables table name | ||
{{{ bash_instantiate_variables("var_nftables_table") }}} | ||
|
||
IS_TABLE=$(nft list tables) | ||
if [ -z "$IS_TABLE" ] | ||
then | ||
if ! nft list table $var_nftables_family $var_nftables_table; then | ||
nft create table "$var_nftables_family" "$var_nftables_table" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ystem/network/network-nftables/set_nftables_table/tests/nftables_incorrect_family.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# variables = var_nftables_family=inet,var_nftables_table=filter | ||
|
||
var_nftables_family="ip" | ||
var_nftables_table="filter" | ||
|
||
nft list tables | | ||
while read table; do | ||
nft delete $table | ||
done | ||
|
||
nft create table "$var_nftables_family" "$var_nftables_table" |
7 changes: 7 additions & 0 deletions
7
...guide/system/network/network-nftables/set_nftables_table/tests/nftables_no_tables.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# variables = var_nftables_family=inet,var_nftables_table=filter | ||
|
||
nft list tables | | ||
while read table; do | ||
nft delete $table | ||
done |
12 changes: 12 additions & 0 deletions
12
...e/system/network/network-nftables/set_nftables_table/tests/nftables_table_present.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# variables = var_nftables_family=inet,var_nftables_table=filter | ||
|
||
var_nftables_family="inet" | ||
var_nftables_table="filter" | ||
|
||
nft list tables | | ||
while read table; do | ||
nft delete $table | ||
done | ||
|
||
nft create table "$var_nftables_family" "$var_nftables_table" |