[netifd | ubus] option to manipulate hardware interface settings removed?

  • Master
  • netifd 2019-11-20
  • ubus 2018-10-06

I am pretty sure that it is not a figment of mine that it used to be possible to set certain properties for hardware network devices (PHY) via /etc/config/network, e.g.

config device 'lan4'
  option mtu
  option name
  option macaddr
  option enable_eee

This however does not seem to work any more (since the integration with ubus?). Calling ubus list network.device.* produces:

Command failed: Not found

despite the source code [1] ?

static struct ubus_object dev_object = {
 .name = "network.device",

https://git.openwrt.org/?p=project/netifd.git;a=blob;f=ubus.c;hb=70b50118c7b063fab5c1383f12e6e92ca0fc82c3#l304

The ubus namespaces are unrelated to that since config device sections are parsed by the netifd executable directly.

There is a central network.device namespace offering status, set_alias and set_state procedures to query and set a few selected properties of netifd managed netdevs, but these are supplemental and not directly related to config device sections.

which somehow does not work however with

config device 'lan0'
	option mtu '1600'

since ip l s lan0 down && ip l s lan0 up does not parse config device sections it seems that /etc/init.d/network restart has to be invoked but even then the MTU remains unchanged

Because it is the wrong syntax. You need to use

config device
	option ifname 'lan0'
	option mtu '1600'

The identifier behind config device is not used anywhere but may be set for convenience when updating configs.

1 Like

I am afraid that did not work either, after a full network restart - even node reboot, uci show network printing:

network.@device[0]=device
network.@device[0].ifname='lan0'
network.@device[0].mtu='1600'

Yeah, was a typo. It needs to be option name, not option ifname. Confirmed working on my device:

root@jj:~# ip link show eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:0d:b9:35:88:48 brd ff:ff:ff:ff:ff:ff

-> note MTU 1500

root@jj:~# uci add network device
cfg0e0f15
root@jj:~# uci set network.@device[-1].name=eth0
root@jj:~# uci set network.@device[-1].mtu=1600
root@jj:~# ubus call network reload
root@jj:~# ip link show eth0
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1600 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:0d:b9:35:88:48 brd ff:ff:ff:ff:ff:ff
root@jj:~# 

-> note MTU 1600

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.