luci-mod-network: let sourcefilter option available for most proto
authorChen Minqiang <ptpt52@gmail.com>
Mon, 22 Jan 2024 14:46:51 +0000 (22:46 +0800)
committerPaul Donald <newtwen@gmail.com>
Thu, 25 Jan 2024 23:44:20 +0000 (00:44 +0100)
sourcefilter option should be available for proto like:
'dhcpv6'
'directip'
'ppp'
'pppoe'
'pppoa'
'pptp'
'qmi'
'mbim'
'ncm'
'3g'

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
(cherry picked from commit 999f26e951e516ddb394ecf7b6b305e4a34810fa)

modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index ad2f21789e777f676ee48d9d0f019cbb884f3700..5bd8f302238ed302b163f7b902a881b0d9c9b0e6 100644 (file)
@@ -245,6 +245,24 @@ function has_peerdns(proto) {
        return false;
 }
 
+function has_sourcefilter(proto) {
+       switch (proto) {
+       case '3g':
+       case 'dhcpv6':
+       case 'directip':
+       case 'mbim':
+       case 'ncm':
+       case 'ppp':
+       case 'pppoa':
+       case 'pppoe':
+       case 'pptp':
+       case 'qmi':
+               return true;
+       }
+
+       return false;
+}
+
 var cbiRichListValue = form.ListValue.extend({
        renderWidget: function(section_id, option_index, cfgvalue) {
                var choices = this.transformChoices();
@@ -987,7 +1005,7 @@ return view.extend({
                                for (var i = 0; i < rtTables.length; i++)
                                        o.value(rtTables[i][1], '%s (%d)'.format(rtTables[i][1], rtTables[i][0]));
 
-                               if (protoval == 'dhcpv6') {
+                               if (has_sourcefilter(protoval)) {
                                        o = nettools.replaceOption(s, 'advanced', form.Flag, 'sourcefilter', _('IPv6 source routing'), _('Automatically handle multiple uplink interfaces using source-based policy routing.'));
                                        o.default = o.enabled;
                                }