Merge pull request #2880 from tano-systems/pr/fix-for-2878

luci-app-firewall: format protocol family for forwards and rules
This commit is contained in:
Jo-Philipp Wich 2019-07-18 12:28:42 +02:00 committed by GitHub
commit 776e6d5409
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -211,6 +211,15 @@ return L.Class.extend({
return rv;
},
fmt_family: function(family) {
if (family == 'ipv4')
return _('IPv4');
else if (family == 'ipv6')
return _('IPv6');
else
return _('IPv4 and IPv6');
},
fmt_proto: function(x, icmp_types) {
var rv = E([]), l = L.toArray(x);

View file

@ -42,7 +42,8 @@ function fmt(fmt /*, ...*/) {
}
function forward_proto_txt(s) {
return fmt('%s-%s', _('IPv4'),
return fmt('%s-%s',
fwtool.fmt_family(uci.get('firewall', s, 'family')),
fwtool.fmt_proto(uci.get('firewall', s, 'proto'),
uci.get('firewall', s, 'icmp_type')) || 'TCP+UDP');
}

View file

@ -42,7 +42,8 @@ function fmt(fmt /*, ...*/) {
}
function forward_proto_txt(s) {
return fmt('%s-%s', _('IPv4'),
return fmt('%s-%s',
fwtool.fmt_family(uci.get('firewall', s, 'family')),
fwtool.fmt_proto(uci.get('firewall', s, 'proto'),
uci.get('firewall', s, 'icmp_type')) || 'TCP+UDP');
}