• R/O
  • HTTP
  • SSH
  • HTTPS

immortalwrt: Commit

Mirror only - Please move to https://github.com/immortalwrt/immortalwrt


Commit MetaInfo

Révision19bc0c3fc31380f015cdc3cfcc47ec1a66a4229c (tree)
l'heure2023-03-19 13:05:28
Auteurarimitx <zyc199847@gmai...>
CommiterZiMing Mo

Message de Log

firewall4: restrict fullcone nat with masquerade

Change Summary

Modification

--- 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
@@ -16,8 +16,8 @@ Renew: ZiMing Mo <msylgj@immortalwrt.org>
1616 root/etc/config/firewall | 2 ++
1717 root/usr/share/firewall4/templates/ruleset.uc | 16 ++++++++++++++--
1818 .../firewall4/templates/zone-fullcone.uc | 4 ++++
19- root/usr/share/ucode/fw4.uc | 70 ++++++++++++++++++-
20- 4 files changed, 89 insertions(+), 3 deletions(-)
19+ root/usr/share/ucode/fw4.uc | 69 ++++++++++++++++++-
20+ 4 files changed, 89 insertions(+), 4 deletions(-)
2121 create mode 100644 root/usr/share/firewall4/templates/zone-fullcone.uc
2222
2323 --- a/root/etc/config/firewall
@@ -38,10 +38,10 @@ Renew: ZiMing Mo <msylgj@immortalwrt.org>
3838 {% for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %}
3939 {%+ include("redirect.uc", { fw4, redirect }) %}
4040 {% endfor %}
41-+{% if (fw4.default_option("fullcone")): %}
41++{% if (zone.masq && fw4.default_option("fullcone")): %}
4242 + {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "dstnat" }) %}
4343 +{% endif %}
44-+{% if (fw4.default_option("fullcone6")): %}
44++{% if (zone.masq6 && fw4.default_option("fullcone6")): %}
4545 + {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "dstnat" }) %}
4646 +{% endif %}
4747 {% fw4.includes('chain-append', `dstnat_${zone.name}`) %}
@@ -67,10 +67,10 @@ Renew: ZiMing Mo <msylgj@immortalwrt.org>
6767 {% endfor %}
6868 {% endfor %}
6969 {% endif %}
70-+{% if (fw4.default_option("fullcone")): %}
70++{% if (zone.masq && fw4.default_option("fullcone")): %}
7171 + {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "srcnat" }) %}
7272 +{% endif %}
73-+{% if (fw4.default_option("fullcone6")): %}
73++{% if (zone.masq6 && fw4.default_option("fullcone6")): %}
7474 + {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "srcnat" }) %}
7575 +{% endif %}
7676 {% fw4.includes('chain-append', `srcnat_${zone.name}`) %}
@@ -201,17 +201,17 @@ Renew: ZiMing Mo <msylgj@immortalwrt.org>
201201 if (zone.mtu_fix && this.kernel < 0x040a0000) {
202202 this.warn_section(data, "option 'mtu_fix' requires kernel 4.10 or later");
203203 return;
204-@@ -2124,10 +2187,15 @@ return {
204+@@ -2124,10 +2187,14 @@ return {
205205 zone.related_subnets = related_subnets;
206206 zone.related_physdevs = related_physdevs;
207207
208-+ if (this.state.defaults.fullcone || this.state.defaults.fullcone6) {
209-+ zone.dflags.snat = true;
210-+ zone.dflags.dnat = true;
211-+ }
212-+
213208 if (zone.masq || zone.masq6)
214- zone.dflags.snat = true;
209+- zone.dflags.snat = true;
210++ if (this.state.defaults.fullcone || this.state.defaults.fullcone6) {
211++ zone.dflags.snat = true;
212++ zone.dflags.dnat = true;
213++ } else
214++ zone.dflags.snat = true;
215215
216216 - if ((zone.auto_helper && !(zone.masq || zone.masq6)) || length(zone.helper)) {
217217 + if ((zone.auto_helper && !(zone.masq || zone.masq6 || this.state.defaults.fullcone || this.state.defaults.fullcone6)) || length(zone.helper)) {
Afficher sur ancien navigateur de dépôt.