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>
} : 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
});