Skip to content

i1905_interface_del() - fix iface validation for teardown

Marina Maslova requested to merge marsik-del-teardown into devel

With enabled dynbhd logging I've observed a lot of errors on ubus call:

Command failed: ubus call ieee1905 add_interface {"ifname":"eth0.2"} (Invalid argument)

Errors happen because i1905 thinks that interface is already in the list while adding in this bad case:

i1905_interface_add: eth0.2 is already a 1905 interface

But there is no published object and num_interfaces in ubus list mismatch to valid object count:

root@arcee-002194716160:~# ubus call ieee1905 info
{
...
	"num_interfaces": 2,
	"interface": [
		{
			"ifname": "eth0.1",
			"parent_ifname": "",
			"macaddress": "00:21:94:71:61:60",
			"status": "up",
			"media": "IEEE 802_3AB_GIGABIT_ETHERNET",
...
		}
	],

I've added some printouts and in bad case teardown is not called:

i1905_alloc_interface passed for eth0.2, new num is 5
Added object 'ieee1905.al.eth0.2'
i1905_remove_interface_object: Removed ieee1905.al.eth0.2
i1905_teardown_interface eth0.2
i1905_alloc_interface passed for eth0.2, new num is 3
Added object 'ieee1905.al.eth0.2'
i1905_remove_interface_object: Removed ieee1905.al.eth0.2
i1905_interface_del: eth0.2 is already a 1905 interface
i1905_interface_add: eth0.2 is already a 1905 interface
i1905_interface_add: eth0.2 is already a 1905 interface
i1905_interface_add: eth0.2 is already a 1905 interface

It seems that teardown should be called in i1905_interface_del(), but it checks that interface exists and returns. Patch fixes that condition - in del error should be thrown if interface doesn't exist in the list (opposite to add case).

Merge request reports