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 9b11ee2dd6..8475e37bf5 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 @@ -45,7 +45,7 @@ Renew: ZiMing Mo } {% endif %} -@@ -246,20 +251,24 @@ table inet fw4 { +@@ -246,7 +251,7 @@ table inet fw4 { {% for (let redirect in fw4.redirects(`srcnat_${zone.name}`)): %} {%+ include("redirect.uc", { fw4, redirect }) %} {% endfor %} @@ -54,14 +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 }) %} - {% endfor %} - {% endfor %} - {% endif %} --{% if (zone.masq6): %} -+{% if (zone.masq6 && !fw4.default_option("fullcone")): %} - {% for (let saddrs in zone.masq6_src_subnets): %} - {% for (let daddrs in zone.masq6_dest_subnets): %} - {%+ include("zone-masq.uc", { fw4, zone, family: 6, saddrs, daddrs }) %} +@@ -260,6 +265,10 @@ table inet fw4 { {% endfor %} {% endfor %} {% endif %} @@ -76,9 +69,9 @@ Renew: ZiMing Mo +++ b/root/usr/share/firewall4/templates/zone-fullcone.uc @@ -0,0 +1,4 @@ +{# /usr/share/firewall4/templates/zone-fullcone.uc #} -+ fullcone comment "!fw4: Handle {{ ++ meta nfproto ipv4 fullcone comment "!fw4: Handle {{ + zone.name -+}} IPv4/IPv6 fullcone NAT traffic" ++}} IPv4 fullcone NAT traffic" --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -1,3 +1,5 @@ @@ -113,7 +106,7 @@ Renew: ZiMing Mo return { read_kernel_version: function() { -@@ -1383,6 +1404,7 @@ return { +@@ -1377,6 +1398,7 @@ return { "dnat", "snat", "masquerade", @@ -121,7 +114,7 @@ Renew: ZiMing Mo "accept", "reject", "drop" -@@ -1802,6 +1824,7 @@ return { +@@ -1800,6 +1822,7 @@ return { } let defs = this.parse_options(data, { @@ -129,7 +122,7 @@ Renew: ZiMing Mo input: [ "policy", "drop" ], output: [ "policy", "drop" ], forward: [ "policy", "drop" ], -@@ -1834,6 +1857,14 @@ return { +@@ -1832,6 +1855,14 @@ return { delete defs.syn_flood; @@ -144,7 +137,7 @@ Renew: ZiMing Mo this.state.defaults = defs; }, -@@ -2058,10 +2089,15 @@ return { +@@ -2056,10 +2087,15 @@ return { zone.related_subnets = related_subnets; zone.related_physdevs = related_physdevs;