[OpenWrt-Devel] netifd loosing control over monitor interface?

Bruno Randolf br1 at einfach.org
Wed Apr 1 08:51:17 EDT 2015


Hello All,

As I roughly outlined before in another thread ("synchronous network
reload/restart"), I am trying to re-configure several dependent network
interfaces thru ubus/netifd on BB.

I have one physical wireless device and 3 virtual interfaces:
 - moni (moni0)
 - mesh (mesh0)
 - ap (ap0)

On top of mesh0 there is batman-adv with its bat0 interface and
depending on wether a internet connection is available or not (I use
"watchping") it is either configured as bat_cl (GW client, DHCP) or
bat_gw (GW, static IP).

Now, when I want to change the channel of the radio, all these
interfaces need to be re-configured.

Since I started to use the ubus C API I am able to control the "async"
network reload most of the time - I listen to ubus network "ifup" events
and issue a "ubus call network reload" both thru the C API. When my
monitor interface is up again I can continue, and the next step in the
program is to get it's HW address thru ioctl SIOCGIFHWADDR.

Now, after a lot of fine-tuning (add force_link to moni and assign it a
static IP 0.0.0.0 - yes, it makes a difference), that works most of the
time, say 98%, but sometimes it happens that the monitor interface is
"lost", and no ifup event for it ever comes... I believe the problem
actually happens at "ifdown":

Here is the output of the ubus events in this case:

Reloading network and waiting for moni...
{ "network.interface": {"action":"ifdown","interface":"mesh"} }
{ "network.interface": {"action":"ifdown","interface":"bat_gw"} }
{ "network.interface": {"action":"ifdown","interface":"moni"} }
{ "network.interface": {"action":"ifup","interface":"bat_gw"} }
{ "network.interface": {"action":"ifup","interface":"mesh"} }

Normally "moni" comes up before "mesh" and "bat_gw".

ifconfig still shows the moni0 interface, which is why I believe the
ifdown did not succeed:

moni0     Link encap:UNSPEC  HWaddr
AC-86-74-07-71-62-00-44-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2925 (2.8 KiB)  TX bytes:0 (0.0 B)

But it's not know ("available": false) to netifd any more:

root at OpenWrt:~# ubus call network.interface.moni status
{
        "up": false,
        "pending": false,
        "available": false,
        "autostart": true,
        "proto": "static",
        "device": "moni0",
        "data": {

        }
}

It also does not show up in "ubus call network.device status" and any
attempt to re-configure it fails, e.g.:

root at OpenWrt:~# ubus call network.interface.moni up
root at OpenWrt:~# ubus call network.interface.moni status
{
        "up": false,
        "pending": false,
        "available": false,
        "autostart": true,
        "proto": "static",
        "device": "moni0",
        "data": {

        },
        "errors": [
                {
                        "subsystem": "interface",
                        "code": "NO_DEVICE"
                }
        ]
}

And even a "ubus call network restart" does not fix the problem. I have
to resort to reboot the system :(

Attached you there is more syslog (with comments) of this case, and my
network and wireless config files.

Thanks for any comments or ideas. Is there anything I could do to get
more debugging output of netifd?

bruno

-------------- next part --------------

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11g'
	option path 'platform/ar933x_wmac'
	option htmode 'HT20'
	option disabled '0'
	option channel '9'

config wifi-iface 'mesh'
	option device 'radio0'
	option ifname 'mesh0'
	option network 'mesh'
	option mode 'adhoc'
	option ssid 'mesh'
	option bssid '02:CA:FE:CA:CA:40'
	option mcast_rate '18000'
	option encryption 'none'
	option disabled '0'

config wifi-iface 'monitor'
	option device 'radio0'
	option ifname 'moni0'
	option mode 'monitor'

config wifi-iface 'ap'
	option device 'radio0'
	option ifname 'ap0'
	option mode 'ap'
	option ssid 'XXX'
	option encryption 'psk2'
	option key 'XXX'
	option macfilter 'allow'

-------------- next part --------------

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'lan'
	option ifname 'eth0'
	option force_link '1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'
	option metric '2'

config interface 'mesh'
	option mtu '1532'
	option proto 'batadv'
	option mesh 'bat0'

config interface 'bat_cl'
	option ifname 'bat0'
	option proto 'dhcp'
	option metric '1'
	option auto '0'

config interface 'bat_gw'
	option ifname 'bat0'
	option proto 'static'
	option mtu '1500'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'
	option auto '0'

config interface 'moni'
	option ifname 'moni0'
	option ipaddr '0.0.0.0'
	option netmask '0.0.0.0'
	option proto 'static'
	option force_link '1'

-------------- next part --------------
Tue Mar 31 17:00:48 2015 daemon.notice confsync[15248]: Setting channel 4
Tue Mar 31 17:00:48 2015 daemon.notice confsync[15248]: Reloading network and waiting for moni...
[ 2013.350000] batman_adv: bat0: Interface deactivated: mesh0
Tue Mar 31 17:00:48 2015 kern.info kernel: [ 2013.350000] batman_adv: bat0: Interface deactivated: mesh0
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Network device 'mesh0' link is down
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'mesh' has [ 2013.380000] batman_adv: bat0: Remov0
link connectivity loss
Tue Mar 31 17:00:48 2015 kern.info kernel: [ 2013.380000] batman_adv: bat0: Removing interface: mesh0
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'mesh' is disabled
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Network device 'bat0' link is down
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'bat_cl' has link connectivity loss
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'bat_gw' has link connectivity loss
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'bat_gw' is now down
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'bat_cl' is disabled
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'bat_gw' is disabled
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Network device 'moni0' link is down
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'moni' has link connectivity loss
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'moni' is now down
Tue Mar 31 17:00:48 2015 daemon.notice netifd: Interface 'moni' is disabled
Tue Mar 31 17:00:48 2015 daemon.notice netifd: mesh (15276): ./batadv.sh: eval: line 1: can't create /sys/y

---> Problem in batadv.sh

Tue Mar 31 17:00:49 2015 daemon.notice netifd: radio0 (15322): command failed: Device or resource busy (-1)
Tue Mar 31 17:00:49 2015 daemon.notice netifd: radio0 (15322): ifconfig: SIOCSIFHWADDR: Invalid argument

---> netifd also has some problem here

[ 2015.000000] IPv6: ADDRCONF(NETDEV_UP): ap0: link is not ready
Tue Mar 31 17:00:50 2015 kern.info kernel: [ 2015.000000] IPv6: ADDRCONF(NETDEV_UP): ap0: link is not ready
[ 2015.710000] IPv6: ADDRCONF(NETDEV_CHANGE): ap0: link becomes ready
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2015.710000] IPv6: ADDRCONF(NETDEV_CHANGE): ap0: link becomesy
[ 2015.810000] IPv6: ADDRCONF(NETDEV_UP): mesh0: link is not ready
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2015.810000] IPv6: ADDRCONF(NETDEV_UP): mesh0: link is not rey
[ 2015.830000] mesh0: Created IBSS using preconfigured BSSID 02:ca:fe:ca:ca:40
[ 2015.840000] mesh0: Creating new IBSS network, BSSID 02:ca:fe:ca:ca:40
[ 2015.850000] IPv6: ADDRCONF(NETDEV_CHANGE): mesh0: link becomes ready
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2015.830000] mesh0: Created IBSS using preconfigured BSSID 020
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2015.840000] mesh0: Creating new IBSS network, BSSID 02:ca:fe0
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2015.850000] IPv6: ADDRCONF(NETDEV_CHANGE): mesh0: link becomy
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Network device 'mesh0' link is up
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Network device 'moni0' link is up
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'moni' has link connectivity 

---> has link connectivity but "setting up now" never comes???

Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'mesh' is enabled
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'mesh' has link connectivity 
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'mesh' is setting up now
[ 2016.110000] batman_adv: bat0: Adding interface: mesh0
[ 2016.110000] batman_adv: bat0: Interface activated: mesh0
Tue Mar 31 17:00:51 2015 kern.[ 2016.120000] 8021q: adding VLAN 0 to HW filter on device bat0
info kernel: [ 2016.110000] batman_adv: bat0: Adding interface: mesh0
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2016.110000] batman_adv: bat0: Interface activated: mesh0
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2016.120000] 8021q: adding VLAN 0 to HW filter on device bat0
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_cl' is enabled
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_gw' is enabled
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_gw' is setting up now
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_gw' is now up
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Network device 'bat0' link is up
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_cl' has link connectivity 
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'bat_gw' has link connectivity 
Tue Mar 31 17:00:51 2015 daemon.notice netifd: Interface 'mesh' is now up
Tue Mar 31 17:00:51 2015 user.notice root: *** BATMAN config bat0
[ 2016.370000] batman_adv: bat0: hop_penalty: Changing from: 15 to: 25
Tue Mar 31 17:0[ 2016.380000] batman_adv: bat0: orig_interval: Changing from: 1000 to: 5000
0:51 2015 kern.info kernel: [ 2016.370000] batman_adv: bat0: hop_penalty: Changing from: 15 to: 25
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2016.380000] batman_adv: bat0: orig_interval: Changing from: 0
Tue Mar 31 17:00:51 2015 user.notice root: *** BATMAN GW mode
Tue Mar 31 17:00:51 2015 user.notice firewall: Reloading firewall due to ifup [ 2016.600000] batman_adv: br
of bat_gw (bat0)
Tue Mar 31 17:00:51 2015 kern.info kernel: [ 2016.600000] batman_adv: bat0: Changing gw mode from: off t
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list