luci icon indicating copy to clipboard operation
luci copied to clipboard

luci-mod-network: device page - bonding glitches

Open plappermaul opened this issue 3 years ago • 7 comments

The network device page has two glitches if we use bonding interfaces.

  1. A device bonding_masters is shown. Nevertheless the node /sys/class/net/bonding_masters is no device at all
  2. The bond devices are shown as normal interfaces. They should be given some meaningful type like VLAN interfaces

Steps to reproduce

  • Load Bonding driver: insmod bonding
  • Create new bonding interface: echo +bond16 > /sys/class/net/bonding_masters
  • Look into luci network device page

Environment

cat /etc/openwrt_release DISTRIB_ID='OpenWrt' DISTRIB_RELEASE='SNAPSHOT' DISTRIB_REVISION='r19862-1d42af720c' DISTRIB_TARGET='realtek/rtl838x' DISTRIB_ARCH='mips_4kec' DISTRIB_DESCRIPTION='OpenWrt SNAPSHOT r19862-1d42af720c' DISTRIB_TAINTS=''

plappermaul avatar Jun 23 '22 05:06 plappermaul

Looking around we might need this for bonding_masters in luci/libs/rpcd-mod-luci/src/luci.c

rpc_luci_get_network_devices()
{
  ...
  if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..") && strcmp(e->d_name, "bonding_masters"))
    rpc_luci_parse_network_device_sys(e->d_name, ifaddr);
  ...
}

plappermaul avatar Jun 23 '22 06:06 plappermaul

For showing up bonding devices the proper way fix could be in luci/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js:

function getDevTypeDesc(section_id)
{
  ...
  case 'bond':
    return _('LAG device');
  ...
}

plappermaul avatar Jun 23 '22 07:06 plappermaul

Please provide a diff with the suggested changes.

jow- avatar Jun 23 '22 07:06 jow-

I started taking care about the bonding_masters listing. Build environment is set up. Modification and compilation finished successfully. Afterwars replaced /usr/lib/rpcd/luci.so on the router and restarted rpcd and router. Nevertheless bonding_masters interface still shows up. Am I on the right track?

ubus -v call luci-rpc getNetworkDevices
...
	"bonding_masters": {
		"name": "bonding_masters",
...

plappermaul avatar Jun 24 '22 19:06 plappermaul

memo to myself: NEVER keep old library below /usr/lib/rpcd

plappermaul avatar Jun 26 '22 11:06 plappermaul

Fix 1:https://github.com/openwrt/luci/pull/5855

plappermaul avatar Jun 26 '22 13:06 plappermaul

Fix 2:https://github.com/openwrt/luci/pull/5858

plappermaul avatar Jun 28 '22 15:06 plappermaul