1 Testing that /etc/firewall.user is treated specially and requires an extra
2 option to be marked compatible.
6 include("./root/usr/share/firewall4/main.uc", {
7 getenv: function(varname) {
17 -- File uci/helpers.json --
21 -- File fs/open~_sys_class_net_eth0_flags.txt --
25 -- File fs/open~_etc_firewall_user.txt --
29 -- File fs/open~_usr_share_miniupnpd_firewall_include.txt --
33 -- File uci/firewall.json --
44 ".description": "By default, this /etc/firewall.user include should be skipped with a warning",
45 "path": "/etc/firewall.user"
49 ".description": "This /etc/firewall.user include should be added due to the compatible flag",
50 "path": "/etc/firewall.user",
55 ".description": "An include of another path should not require a compatible flag",
56 "path": "/usr/share/miniupnpd/firewall.include"
63 [!] Section @include[0] is not marked as compatible with fw4, ignoring section
64 [!] Section @include[0] requires 'option fw4_compatible 1' to be considered compatible
76 define test_devices = { "eth0" }
77 define test_subnets = { }
84 include "/etc/nftables.d/*.nft"
92 type filter hook input priority filter; policy drop;
94 iifname "lo" accept comment "!fw4: Accept traffic from loopback"
96 ct state established,related accept comment "!fw4: Allow inbound established and related flows"
97 iifname "eth0" jump input_test comment "!fw4: Handle test IPv4/IPv6 input traffic"
101 type filter hook forward priority filter; policy drop;
103 ct state established,related accept comment "!fw4: Allow forwarded established and related flows"
104 iifname "eth0" jump forward_test comment "!fw4: Handle test IPv4/IPv6 forward traffic"
108 type filter hook output priority filter; policy drop;
110 oifname "lo" accept comment "!fw4: Accept traffic towards loopback"
112 ct state established,related accept comment "!fw4: Allow outbound established and related flows"
113 oifname "eth0" jump output_test comment "!fw4: Handle test IPv4/IPv6 output traffic"
117 type filter hook prerouting priority filter; policy accept;
120 chain handle_reject {
121 meta l4proto tcp reject with tcp reset comment "!fw4: Reject TCP traffic"
122 reject with icmpx type port-unreachable comment "!fw4: Reject any other traffic"
137 chain drop_from_test {
138 iifname "eth0" counter drop comment "!fw4: drop test IPv4/IPv6 traffic"
142 oifname "eth0" counter drop comment "!fw4: drop test IPv4/IPv6 traffic"
151 type nat hook prerouting priority dstnat; policy accept;
155 type nat hook postrouting priority srcnat; policy accept;
160 # Raw rules (notrack)
163 chain raw_prerouting {
164 type filter hook prerouting priority raw; policy accept;
168 type filter hook output priority raw; policy accept;
176 chain mangle_prerouting {
177 type filter hook prerouting priority mangle; policy accept;
180 chain mangle_postrouting {
181 type filter hook postrouting priority mangle; policy accept;
185 type filter hook input priority mangle; policy accept;
188 chain mangle_output {
189 type route hook output priority mangle; policy accept;
192 chain mangle_forward {
193 type filter hook forward priority mangle; policy accept;