From a9c064d2de5b7635b32aff3c62803318e25ff1d0 Mon Sep 17 00:00:00 2001 From: ZiMing Mo Date: Mon, 20 Jun 2022 12:00:14 +0800 Subject: [PATCH] firewall4: refresh fullcone patch --- ...rewall4-add-support-for-fullcone-nat.patch | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package/network/config/firewall4/patches/001-firewall4-add-support-for-fullcone-nat.patch b/package/network/config/firewall4/patches/001-firewall4-add-support-for-fullcone-nat.patch index 8475e37bf5..e36e02c1c0 100644 --- a/package/network/config/firewall4/patches/001-firewall4-add-support-for-fullcone-nat.patch +++ b/package/network/config/firewall4/patches/001-firewall4-add-support-for-fullcone-nat.patch @@ -31,12 +31,12 @@ Renew: ZiMing Mo +++ b/root/usr/share/firewall4/templates/ruleset.uc @@ -1,3 +1,4 @@ +{# /usr/share/firewall4/templates/ruleset.uc #} - {% let flowtable_devices = fw4.resolve_offload_devices(); -%} - - table inet fw4 -@@ -238,6 +239,10 @@ table inet fw4 { - {% for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %} - {%+ include("redirect.uc", { fw4, redirect }) %} + {% + let flowtable_devices = fw4.resolve_offload_devices(); + let available_helpers = filter(fw4.helpers(), h => h.available); +@@ -247,6 +248,10 @@ table inet fw4 { + {% for (let rule in fw4.rules(`helper_${zone.name}`)): %} + {%+ include("rule.uc", { fw4, rule }) %} {% endfor %} +{% if (fw4.default_option("fullcone")): %} + {%+ include("zone-fullcone.uc", { fw4, zone, direction: "dstnat" }) %} @@ -45,7 +45,7 @@ Renew: ZiMing Mo } {% endif %} -@@ -246,7 +251,7 @@ table inet fw4 { +@@ -320,7 +325,7 @@ table inet fw4 { {% for (let redirect in fw4.redirects(`srcnat_${zone.name}`)): %} {%+ include("redirect.uc", { fw4, redirect }) %} {% endfor %} @@ -54,7 +54,7 @@ Renew: ZiMing Mo {% for (let saddrs in zone.masq4_src_subnets): %} {% for (let daddrs in zone.masq4_dest_subnets): %} {%+ include("zone-masq.uc", { fw4, zone, family: 4, saddrs, daddrs }) %} -@@ -260,6 +265,10 @@ table inet fw4 { +@@ -334,6 +339,10 @@ table inet fw4 { {% endfor %} {% endfor %} {% endif %} @@ -62,9 +62,9 @@ Renew: ZiMing Mo + {%+ include("zone-fullcone.uc", { fw4, zone, direction: "srcnat" }) %} +{% endif %} + + {% fw4.includes('chain-append', `srcnat_${zone.name}`) %} } - {% endif %} --- /dev/null +++ b/root/usr/share/firewall4/templates/zone-fullcone.uc @@ -0,0 +1,4 @@ @@ -106,7 +106,7 @@ Renew: ZiMing Mo return { read_kernel_version: function() { -@@ -1377,6 +1398,7 @@ return { +@@ -1385,6 +1406,7 @@ return { "dnat", "snat", "masquerade", @@ -114,7 +114,7 @@ Renew: ZiMing Mo "accept", "reject", "drop" -@@ -1800,6 +1822,7 @@ return { +@@ -1852,6 +1874,7 @@ return { } let defs = this.parse_options(data, { @@ -122,7 +122,7 @@ Renew: ZiMing Mo input: [ "policy", "drop" ], output: [ "policy", "drop" ], forward: [ "policy", "drop" ], -@@ -1832,6 +1855,14 @@ return { +@@ -1884,6 +1907,14 @@ return { delete defs.syn_flood; @@ -137,7 +137,7 @@ Renew: ZiMing Mo this.state.defaults = defs; }, -@@ -2056,10 +2087,15 @@ return { +@@ -2110,10 +2141,15 @@ return { zone.related_subnets = related_subnets; zone.related_physdevs = related_physdevs;