[PATCH luci] treewide: drop MAC and MTU from interfaces (protocols)

Philip Prindeville philipp_subx at redfish-solutions.com
Wed Jun 2 11:21:14 PDT 2021


Not sure I agree.

For IPsec, GRE, IP-in-IP, etc. MTU is very much an L3 attribute.



> On May 28, 2021, at 1:58 AM, Rafał Miłecki <zajec5 at gmail.com> wrote:
> 
> From: Rafał Miłecki <rafal at milecki.pl>
> 
> Those are L2 options that are not part of interfaces (L3), should not be
> set there and don't work. Setting MAC and MTU should be done at device
> layer (config device) and is supported for basic types already.
> 
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> ---
> .../htdocs/luci-static/resources/protocol/dhcp.js      | 10 +---------
> .../htdocs/luci-static/resources/protocol/static.js    | 10 +---------
> .../htdocs/luci-static/resources/protocol/hnet.js      | 10 +---------
> .../htdocs/luci-static/resources/protocol/dhcpv6.js    | 10 +---------
> .../htdocs/luci-static/resources/protocol/vxlan.js     |  9 ---------
> .../htdocs/luci-static/resources/protocol/vxlan6.js    |  9 ---------
> 6 files changed, 4 insertions(+), 54 deletions(-)
> 
> diff --git a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
> index 9a63a107cf..71adc235ca 100644
> --- a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
> +++ b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
> @@ -17,7 +17,7 @@ return network.registerProtocol('dhcp', {
> 	},
> 
> 	renderFormOptions: function(s) {
> -		var dev = this.getL2Device() || this.getDevice(), o;
> +		var o;
> 
> 		o = s.taboption('general', form.Value, 'hostname', _('Hostname to send when requesting DHCP'));
> 		o.default = '';
> @@ -38,13 +38,5 @@ return network.registerProtocol('dhcp', {
> 		o.datatype  = 'hexstring';
> 
> 		s.taboption('advanced', form.Value, 'vendorid', _('Vendor Class to send when requesting DHCP'));
> -
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.datatype = 'macaddr';
> -		o.placeholder = dev ? (dev.getMAC() || '') : '';
> -
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
> -		o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
> -		o.datatype    = 'max(9200)';
> 	}
> });
> diff --git a/modules/luci-base/htdocs/luci-static/resources/protocol/static.js b/modules/luci-base/htdocs/luci-static/resources/protocol/static.js
> index 82f499d6b9..42ebcefba4 100644
> --- a/modules/luci-base/htdocs/luci-static/resources/protocol/static.js
> +++ b/modules/luci-base/htdocs/luci-static/resources/protocol/static.js
> @@ -173,7 +173,7 @@ return network.registerProtocol('static', {
> 	},
> 
> 	renderFormOptions: function(s) {
> -		var dev = this.getL2Device() || this.getDevice(), o;
> +		var o;
> 
> 		s.taboption('general', this.CBIIPValue, 'ipaddr', _('IPv4 address'));
> 		s.taboption('general', this.CBINetmaskValue, 'netmask', _('IPv4 netmask'));
> @@ -192,13 +192,5 @@ return network.registerProtocol('static', {
> 		o = s.taboption('general', form.Value, 'ip6prefix', _('IPv6 routed prefix'), _('Public prefix routed to this device for distribution to clients.'));
> 		o.datatype = 'ip6addr';
> 		o.depends('ip6assign', '');
> -
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.datatype = 'macaddr';
> -		o.placeholder = dev ? (dev.getMAC() || '') : '';
> -
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
> -		o.datatype = 'max(9200)';
> -		o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
> 	}
> });
> diff --git a/protocols/luci-proto-hnet/htdocs/luci-static/resources/protocol/hnet.js b/protocols/luci-proto-hnet/htdocs/luci-static/resources/protocol/hnet.js
> index b8776e873f..5762ab7bf2 100644
> --- a/protocols/luci-proto-hnet/htdocs/luci-static/resources/protocol/hnet.js
> +++ b/protocols/luci-proto-hnet/htdocs/luci-static/resources/protocol/hnet.js
> @@ -12,7 +12,7 @@ return network.registerProtocol('hnet', {
> 	},
> 
> 	renderFormOptions: function(s) {
> -		var dev = this.getL2Device() || this.getDevice(), o;
> +		var o;
> 
> 		o = s.taboption('general', form.ListValue, 'mode', _('Category'));
> 		o.value('auto', _('Automatic'));
> @@ -32,13 +32,5 @@ return network.registerProtocol('hnet', {
> 
> 		o = s.taboption('advanced', form.Value, 'dnsname', _('DNS-Label / FQDN'));
> 		o.default = s.section;
> -
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.datatype = 'macaddr';
> -		o.placeholder = dev ? (dev.getMAC() || '') : '';
> -
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
> -		o.datatype = 'max(9200)';
> -		o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
> 	}
> });
> diff --git a/protocols/luci-proto-ipv6/htdocs/luci-static/resources/protocol/dhcpv6.js b/protocols/luci-proto-ipv6/htdocs/luci-static/resources/protocol/dhcpv6.js
> index 41fdc6d9d5..2e75cb8632 100644
> --- a/protocols/luci-proto-ipv6/htdocs/luci-static/resources/protocol/dhcpv6.js
> +++ b/protocols/luci-proto-ipv6/htdocs/luci-static/resources/protocol/dhcpv6.js
> @@ -12,7 +12,7 @@ return network.registerProtocol('dhcpv6', {
> 	},
> 
> 	renderFormOptions: function(s) {
> -		var dev = this.getL2Device() || this.getDevice(), o;
> +		var o;
> 
> 		o = s.taboption('general', form.ListValue, 'reqaddress', _('Request IPv6-address'));
> 		o.value('try');
> @@ -32,13 +32,5 @@ return network.registerProtocol('dhcpv6', {
> 
> 		o = s.taboption('advanced', form.Value, 'clientid', _('Client ID to send when requesting DHCP'));
> 		o.datatype  = 'hexstring';
> -
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.datatype = 'macaddr';
> -		o.placeholder = dev ? (dev.getMAC() || '') : '';
> -
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
> -		o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
> -		o.datatype    = 'max(9200)';
> 	}
> });
> diff --git a/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan.js b/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan.js
> index 9927f0bc65..1d5052fdfc 100644
> --- a/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan.js
> +++ b/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan.js
> @@ -59,11 +59,6 @@ return network.registerProtocol('vxlan', {
> 		o.nocreate = true;
> 		o.optional = true;
> 
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'), _('Specify an MTU (Maximum Transmission Unit) other than the default (1280 bytes).'));
> -		o.optional = true;
> -		o.placeholder = 1280;
> -		o.datatype = 'range(68, 9200)';
> -
> 		o = s.taboption('advanced', form.Value, 'ttl', _('Override TTL'), _('Specify a TTL (Time to Live) for the encapsulating packet other than the default (64).'));
> 		o.optional = true;
> 		o.placeholder = 64;
> @@ -73,10 +68,6 @@ return network.registerProtocol('vxlan', {
> 		o.optional = true;
> 		o.datatype = 'range(0, 255)';
> 
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.optional = true;
> -		o.datatype = 'macaddr';
> -
> 		o = s.taboption('advanced', form.Flag, 'rxcsum', _('Enable rx checksum'));
> 		o.optional = true;
> 		o.default = o.enabled;
> diff --git a/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan6.js b/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan6.js
> index f568e7e244..30250cdcfa 100644
> --- a/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan6.js
> +++ b/protocols/luci-proto-vxlan/htdocs/luci-static/resources/protocol/vxlan6.js
> @@ -54,11 +54,6 @@ return network.registerProtocol('vxlan6', {
> 		o.nocreate = true;
> 		o.optional = true;
> 
> -		o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'), _('Specify an MTU (Maximum Transmission Unit) other than the default (1280 bytes).'));
> -		o.optional = true;
> -		o.placeholder = 1280;
> -		o.datatype = 'range(68, 9200)';
> -
> 		o = s.taboption('advanced', form.Value, 'ttl', _('Override TTL'), _('Specify a TTL (Time to Live) for the encapsulating packet other than the default (64).'));
> 		o.optional = true;
> 		o.placeholder = 64;
> @@ -68,10 +63,6 @@ return network.registerProtocol('vxlan6', {
> 		o.optional = true;
> 		o.datatype = 'range(0, 255)';
> 
> -		o = s.taboption('advanced', form.Value, 'macaddr', _('Override MAC address'));
> -		o.optional = true;
> -		o.datatype = 'macaddr';
> -
> 		o = s.taboption('advanced', form.Flag, 'rxcsum', _('Enable rx checksum'));
> 		o.optional = true;
> 		o.default = o.enabled;
> -- 
> 2.26.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel




More information about the openwrt-devel mailing list