diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-05-01 16:18:26 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-05-01 16:32:40 +0200 |
commit | fa2aeb7d2ff84c0dc022c7432b6123cb950dbd61 (patch) | |
tree | 712088c6be094cfc9ff407573dc586832858ec2a | |
parent | e5f6b64813b712defe77f01c9274d02085bb47a7 (diff) |
luci-app-firewall: SNAT display fixes
The implied logic in the functions to build display text is a bit of
a minefield.
Now, if family=4+6 is selected, display 4+6.
This part is a follow-up to: 4ca87f6576272d4a4659e995bef00cf34d5746e9
Previously it would display only IPv6.
Now, if family=auto i.e. '' is selected then display 4 only.
fw4 internally treats no family as IPv4 only, meaning that IPv6 was not
SNATed. (This treatment is 'incorrect' but because it has always been
this way, this behaviour is retained for backwards compatibility, and
user expectations.)
Previous logic was incorrect (bug) and would display:
Forwarded IPv4 and IPv6
misleading the user.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
-rw-r--r-- | applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js index 015b8b7681..8c05e1f2de 100644 --- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js +++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js @@ -32,8 +32,8 @@ function rule_proto_txt(s) { } : null; return fwtool.fmt(_('Forwarded %{ipv6?%{ipv4?<var>IPv4</var> and <var>IPv6</var>:<var>IPv6</var>}:<var>IPv4</var>}%{proto?, protocol %{proto#%{next?, }<var>%{item.name}</var>}}%{mark?, mark <var%{mark.inv? data-tooltip="Match fwmarks except %{mark.num}%{mark.mask? with mask %{mark.mask}}.":%{mark.mask? data-tooltip="Mask fwmark value with %{mark.mask} before compare."}}>%{mark.val}</var>}'), { - ipv4: (family == 'ipv4' || (!family && sip.indexOf(':') == -1 && dip.indexOf(':') == -1 && rwip.indexOf(':') == -1)), - ipv6: (family == 'ipv6' || (!family && (!sip || !dip || !rwip)) || (!family && (sip.indexOf(':') != -1 || dip.indexOf(':') != -1 || rwip.indexOf(':') != -1))), + ipv4: (family == 'ipv4' || family == 'any' || (!family && sip.indexOf(':') == -1 && dip.indexOf(':') == -1 && rwip.indexOf(':') == -1)), + ipv6: (family == 'ipv6' || family == 'any' || (!family && (sip.indexOf(':') != -1 || dip.indexOf(':') != -1 || rwip.indexOf(':') != -1))), proto: proto, mark: f }); |