forked from firewalld/firewalld
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(direct): verify rule order with multiple address with -s/-d
Coverage: rhbz 1940928 Coverage: rhbz 1949552
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 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
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,52 @@ | ||
FWD_START_TEST([direct -s/-d multiple addresses]) | ||
AT_KEYWORDS(direct rhbz1940928 rhbz1949552) | ||
CHECK_IPTABLES | ||
|
||
dnl test triggers a limitation in iptables-restore | ||
dnl | ||
AT_CHECK([sed -i 's/^IndividualCalls.*/IndividualCalls=no/' ./firewalld.conf]) | ||
FWD_RELOAD | ||
|
||
FWD_CHECK([--direct --add-rule ipv4 filter OUTPUT 0 -m state --state ESTABLISHED,RELATED -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --add-rule ipv4 filter OUTPUT 2 -p tcp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --add-rule ipv4 filter OUTPUT 2 -p udp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --add-rule ipv4 filter OUTPUT 9 -j DROP], 0, [ignore], [ignore]) | ||
|
||
IPTABLES_LIST_RULES_ALWAYS([filter], [m4_if(iptables, FIREWALL_BACKEND, [OUTPUT_direct], [OUTPUT])], 0, [dnl | ||
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED | ||
ACCEPT tcp -- 0.0.0.0/0 10.0.0.0/8 | ||
ACCEPT tcp -- 0.0.0.0/0 172.16.0.0/16 | ||
ACCEPT tcp -- 0.0.0.0/0 192.168.0.0/24 | ||
ACCEPT udp -- 0.0.0.0/0 10.0.0.0/8 | ||
ACCEPT udp -- 0.0.0.0/0 172.16.0.0/16 | ||
ACCEPT udp -- 0.0.0.0/0 192.168.0.0/24 | ||
DROP all -- 0.0.0.0/0 0.0.0.0/0 | ||
]) | ||
|
||
FWD_CHECK([--direct --add-rule ipv4 filter OUTPUT 1 -p sctp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
|
||
IPTABLES_LIST_RULES_ALWAYS([filter], [m4_if(iptables, FIREWALL_BACKEND, [OUTPUT_direct], [OUTPUT])], 0, [dnl | ||
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED | ||
ACCEPT sctp -- 0.0.0.0/0 10.0.0.0/8 | ||
ACCEPT sctp -- 0.0.0.0/0 172.16.0.0/16 | ||
ACCEPT sctp -- 0.0.0.0/0 192.168.0.0/24 | ||
ACCEPT tcp -- 0.0.0.0/0 10.0.0.0/8 | ||
ACCEPT tcp -- 0.0.0.0/0 172.16.0.0/16 | ||
ACCEPT tcp -- 0.0.0.0/0 192.168.0.0/24 | ||
ACCEPT udp -- 0.0.0.0/0 10.0.0.0/8 | ||
ACCEPT udp -- 0.0.0.0/0 172.16.0.0/16 | ||
ACCEPT udp -- 0.0.0.0/0 192.168.0.0/24 | ||
DROP all -- 0.0.0.0/0 0.0.0.0/0 | ||
]) | ||
|
||
FWD_CHECK([--direct --remove-rule ipv4 filter OUTPUT 0 -m state --state ESTABLISHED,RELATED -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --remove-rule ipv4 filter OUTPUT 1 -p sctp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --remove-rule ipv4 filter OUTPUT 2 -p tcp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --remove-rule ipv4 filter OUTPUT 2 -p udp -d 10.0.0.0/8,172.16.0.0/16,192.168.0.0/24 -j ACCEPT], 0, [ignore], [ignore]) | ||
FWD_CHECK([--direct --remove-rule ipv4 filter OUTPUT 9 -j DROP], 0, [ignore], [ignore]) | ||
|
||
|
||
IPTABLES_LIST_RULES_ALWAYS([filter], [m4_if(iptables, FIREWALL_BACKEND, [OUTPUT_direct], [OUTPUT])], 0, [dnl | ||
]) | ||
|
||
FWD_END_TEST |