Modify

Opened 3 years ago

Last modified 3 years ago

#19345 new defect

netifd: radio0: sh: bad number

Reported by: braveheart_leo@… Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: packages Version: Trunk
Keywords: netifd radio0 sh bad number Cc:

Description

Running on CHAOS CALMER (Bleeding Edge, r45073), I started noticing

Sun Mar 29 15:19:30 2015 daemon.notice netifd: radio0 (1166): sh: bad number
Sun Mar 29 15:19:31 2015 daemon.notice netifd: radio0 (1166): sh: bad number

I'm sure it is related to r40469, when a new option in hostapd was introduced but no default set. Unfortunately, I haven't found out where in the code it might be.

Here is my wireless config for reference:

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '6'
	option hwmode '11g'
	option htmode 'HT40+'
	option path '10180000.wmac'
	option txpower '20'
	option distance '100'
	option country 'US'
	option country_ie '0'
	option noscan '1'
	option disabled '0'

config wifi-iface
	option device 'radio0'
	option mode 'ap'
	option network 'wifi0'
	option ssid 'x'
	option encryption 'psk2'
	option key 'x'
	option wpa_group_rekey '3600'
	option wmm '1'
	option isolate '0'
	option hidden '0'

config wifi-iface
	option device 'radio0'
	option mode 'ap'
	option network 'wifi1'
	option ssid 'x'
	option encryption 'psk2'
	option key 'x'
	option wpa_group_rekey '3600'
	option wmm '1'
	option isolate '1'
	option hidden '0'

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by hnyman

The first "bad number" surfaces if the "ieee80211r" option has no value in /etc/config/wireless.

r45051 introduced the config option, but apparently a missing value causes this error.

I added some debug statements to /lib/netifd/hostapd.sh ( = trunk/package/network/services/hostapd/files/netifd.sh ) and also configured my radio0 to have that option as 0. Now the error is produced only for radio1 that is missing the config option ieee80211r.

Sat Apr 11 10:55:50 2015 daemon.notice netifd: radio0 (9164): ieee80211r=0
Sat Apr 11 10:55:50 2015 daemon.notice netifd: radio0 (9164): sh: bad number
Sat Apr 11 10:55:50 2015 daemon.notice netifd: radio1 (9160): ieee80211r=
Sat Apr 11 10:55:50 2015 daemon.notice netifd: radio1 (9160): sh: bad number
Sat Apr 11 10:55:50 2015 daemon.notice netifd: radio1 (9160): sh: bad number

The second "bad number" is coming from elsewhere. Haven't yet found it.

I added a default value 0 for the option, and the error gets eliminated (but naturally the missing nasid causes other errors as I tested radio0 with ieee80211=1...):

root@OpenWrt2:/etc/config# diff /rom/lib/netifd/hostapd.sh /lib/netifd/hostapd.sh
--- /rom/lib/netifd/hostapd.sh
+++ /lib/netifd/hostapd.sh
@@ -350,8 +350,10 @@

        if [ "$wpa" -ge "1" ]; then
                json_get_vars nasid ieee80211r
+               set_default ieee80211r 0
                [ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"

+echo ieee80211r=$ieee80211r
                if [ "$ieee80211r" -gt "0" ]; then
                        json_get_vars mobility_domain r0_key_lifetime r1_key_holder \
                        reassociation_deadline pmk_r1_push

--------------------
LOGREAD:

Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): ieee80211r=1
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): sh: bad number
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): Configuration file: /var/run/hostapd-phy0.conf
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): FT (IEEE 802.11r) requires nas_identifier to be configured as a 1..48 octet string
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): 1 errors found in configuration file '/var/run/hostapd-phy0.conf'
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): Failed to set up interface with /var/run/hostapd-phy0.conf
Sat Apr 11 11:02:19 2015 daemon.notice netifd: radio0 (10853): Failed to initialize interface
Sat Apr 11 11:02:20 2015 daemon.notice netifd: radio0 (10853): Device setup failed: HOSTAPD_START_FAILED
Sat Apr 11 11:02:20 2015 daemon.notice netifd: radio1 (10896): ieee80211r=0
Sat Apr 11 11:02:20 2015 daemon.notice netifd: radio1 (10896): sh: bad number

comment:2 Changed 3 years ago by hnyman

The other error is similar: "start_disabled" is used in a condition check, while it may have no value. The file in a live router is /lib/netifd/wireless/mac80211.sh ( = https://dev.openwrt.org/browser/trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh#L308 )

root@OpenWrt2:/lib/netifd# diff /rom/lib/netifd/wireless/mac80211.sh /lib/netifd/wireless/mac80211.sh
--- /rom/lib/netifd/wireless/mac80211.sh
+++ /lib/netifd/wireless/mac80211.sh
@@ -318,10 +318,12 @@
        json_get_vars wds dtim_period max_listen_int start_disabled

        set_default wds 0
+#      set_default start_disabled 0

        [ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N"
+echo staidx=$staidx start_disabled=$start_disabled
        [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
-
+echo after
        cat >> /var/run/hostapd-$phy.conf <<EOF
 $hostapd_cfg
 bssid=$macaddr
root@OpenWrt2:/lib/netifd# wifi up
root@OpenWrt2:/lib/netifd# logread | tail -n 40
Sat Apr 11 11:47:48 2015 daemon.notice netifd: Network device 'wlan1' link is down
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio0 (13540): staidx=0 start_disabled=
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio0 (13540): sh: bad number
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio0 (13540): after
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio0 (13540): Configuration file: /var/run/hostapd-phy0.conf
Sat Apr 11 11:47:49 2015 kern.info kernel: [61019.680000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Sat Apr 11 11:47:49 2015 kern.info kernel: [61019.740000] device wlan0 entered promiscuous mode
Sat Apr 11 11:47:49 2015 kern.info kernel: [61019.740000] br-lan: port 2(wlan0) entered forwarding state
Sat Apr 11 11:47:49 2015 kern.info kernel: [61019.750000] br-lan: port 2(wlan0) entered forwarding state
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio1 (13553): staidx=0 start_disabled=
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio1 (13553): sh: bad number
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio1 (13553): after
Sat Apr 11 11:47:49 2015 daemon.notice netifd: radio1 (13553): Configuration file: /var/run/hostapd-phy1.conf

If default value is added, the "bad number" error disappears:

root@OpenWrt2:/lib/netifd# diff /rom/lib/netifd/wireless/mac80211.sh /lib/netifd/wireless/mac80211.sh
--- /rom/lib/netifd/wireless/mac80211.sh
+++ /lib/netifd/wireless/mac80211.sh
@@ -318,10 +318,12 @@
        json_get_vars wds dtim_period max_listen_int start_disabled

        set_default wds 0
+       set_default start_disabled 0

        [ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N"
+echo staidx=$staidx start_disabled=$start_disabled
        [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
-
+echo after
        cat >> /var/run/hostapd-$phy.conf <<EOF
 $hostapd_cfg
 bssid=$macaddr


Sat Apr 11 11:50:08 2015 daemon.notice netifd: Network device 'wlan1' link is down
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio0 (13852): staidx=0 start_disabled=0
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio0 (13852): after
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio0 (13852): Configuration file: /var/run/hostapd-phy0.conf
Sat Apr 11 11:50:09 2015 kern.info kernel: [61159.390000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Sat Apr 11 11:50:09 2015 kern.info kernel: [61159.440000] device wlan0 entered promiscuous mode
Sat Apr 11 11:50:09 2015 kern.info kernel: [61159.440000] br-lan: port 2(wlan0) entered forwarding state
Sat Apr 11 11:50:09 2015 kern.info kernel: [61159.450000] br-lan: port 2(wlan0) entered forwarding state
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio1 (13867): staidx=0 start_disabled=0
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio1 (13867): after
Sat Apr 11 11:50:09 2015 daemon.notice netifd: radio1 (13867): Configuration file: /var/run/hostapd-phy1.conf

Ps. I tried adding that start_disabled option to my /etc/config/wireless, but did not succeed passing the value upto the the function. There may be some option declaration missing.

comment:3 Changed 3 years ago by hnyman

My fix proposals are:

--- trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -318,6 +318,7 @@
 	json_get_vars wds dtim_period max_listen_int start_disabled
 
 	set_default wds 0
+	set_default start_disabled 0
 
 	[ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N"
 	[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
--- trunk/package/network/services/hostapd/files/netifd.sh
+++ trunk/package/network/services/hostapd/files/netifd.sh
@@ -346,6 +350,7 @@
 
 	if [ "$wpa" -ge "1" ]; then
 		json_get_vars nasid ieee80211r
+		set_default ieee80211r 0
 		[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"
 
 		if [ "$ieee80211r" -gt "0" ]; then

comment:4 Changed 3 years ago by hnyman

I submitted patches to the mailing list, and the two instances found by me should be fixed by r45379 and r45380.

However, it is possible that there is at least one more similar error, as the original bug report above pre-dates r45326 (start_disabled in mac80211) and there were already two error messages for one radio. That might be related to some parameter that my config already includes, e.g. wps_pushbutton. Haven't yet tried to test that.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.