diff mbox

[OpenWrt-Devel] fix typo in netifd.sh

Message ID 20150120184414.711139fe@samsung
State Changes Requested
Headers show

Commit Message

Cezary Jackiewicz Jan. 20, 2015, 5:44 p.m. UTC
$ht variable is not passed. $htmode is.

With this, wpa_supplicant-phy0.conf contains htmode line if htmode is set in config.

Signed-off-by: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
---

Comments

John Crispin Jan. 22, 2015, 1:41 p.m. UTC | #1
On 20/01/2015 18:44, Cezary Jackiewicz wrote:
> $ht variable is not passed. $htmode is.
> 
> With this, wpa_supplicant-phy0.conf contains htmode line if htmode is set in config.
> 
> Signed-off-by: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
> ---
> 
> diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
> index d625709..436eee3 100644
> --- a/package/network/services/hostapd/files/netifd.sh
> +++ b/package/network/services/hostapd/files/netifd.sh
> @@ -595,8 +595,7 @@ wpa_supplicant_add_network() {
>  		append network_data "mcast_rate=$mc_rate" "$N$T"
>  	}
>  
> -	local ht_str
> -	[ -n "$ht" ] && append network_data "htmode=$ht" "$N$T"
> +	[ -n "$htmode" ] && append network_data "htmode=$htmode" "$N$T"
>  

this patch is wrong for the following reasons

* the htmode values inside netifd-wireless.sh are not the same values
that wpa_supplicant expects
* wpa_supplicant should automagically detect the channel (and the HT40
ext chan)

this leads me to wonder why you need this and an option would be 2 adhoc
clients.

can you explain your wifi setup so that we can figure out how to
properly fix this ?


>  	cat >> "$_config" <<EOF
>  network={
> 
>
Cezary Jackiewicz Jan. 23, 2015, 5:27 p.m. UTC | #2
Dnia 2015-01-22, o godz. 14:41:33
John Crispin <blogic@openwrt.org> napisał(a):

> can you explain your wifi setup so that we can figure out how to
> properly fix this ?

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11a'
	option path 'pci0000:00/0000:00:00.0'
	option disabled '0'
	option htmode 'HT20'
	option channel '48'

config wifi-iface
	option device 'radio1'
	option encryption 'psk2'
	option key '1234567890'
	option network 'wlan'
	option mode 'adhoc'
	option ssid 'link-5g'

Without patch I've got

root@OpenWrt:~# cat /var/run/wpa_supplicant-wlan1.conf 
ap_scan=2
network={
	scan_ssid=0
	ssid="link-5g"
	key_mgmt=WPA-PSK
	mode=1
	fixed_freq=1
	frequency=5240
	mode=1
	psk="1234567890"
	proto=RSN
}

iw wlan1 info shows only 20 MHz (no HT) and iw wlan1 station dump - tx/rx 54MBit

With patch:

root@OpenWrt:~# cat /var/run/wpa_supplicant-wlan1.conf 
ap_scan=2
network={
	scan_ssid=0
	ssid="link-5g"
	key_mgmt=WPA-PSK
	mode=1
	fixed_freq=1
	frequency=5240
	mode=1
	psk="1234567890"
	proto=RSN
	htmode=HT20
}

iw wlan1 info shows channel 48 (5240 MHz), width: 20 MHz, center1: 5240 MHz 
(width: 40 MHz with channel 36 and HT40+); iw wlan1 station dump shows
bitrate

rx bitrate:	115.6 MBit/s MCS 13 short GI
tx bitrate:	57.8 MBit/s MCS 5 short GI
rx bitrate:	86.7 MBit/s MCS 12 short GI

etc.
John Crispin Jan. 23, 2015, 8:58 p.m. UTC | #3
On 23/01/2015 18:27, Cezary Jackiewicz wrote:
> Dnia 2015-01-22, o godz. 14:41:33
> John Crispin <blogic@openwrt.org> napisał(a):
> 
>> can you explain your wifi setup so that we can figure out how to
>> properly fix this ?
> 
> config wifi-device 'radio1'
> 	option type 'mac80211'
> 	option hwmode '11a'
> 	option path 'pci0000:00/0000:00:00.0'
> 	option disabled '0'
> 	option htmode 'HT20'
> 	option channel '48'
> 
> config wifi-iface
> 	option device 'radio1'
> 	option encryption 'psk2'
> 	option key '1234567890'
> 	option network 'wlan'
> 	option mode 'adhoc'
> 	option ssid 'link-5g'
> 
> Without patch I've got
> 
> root@OpenWrt:~# cat /var/run/wpa_supplicant-wlan1.conf 
> ap_scan=2
> network={
> 	scan_ssid=0
> 	ssid="link-5g"
> 	key_mgmt=WPA-PSK
> 	mode=1
> 	fixed_freq=1
> 	frequency=5240
> 	mode=1
> 	psk="1234567890"
> 	proto=RSN
> }
> 
> iw wlan1 info shows only 20 MHz (no HT) and iw wlan1 station dump - tx/rx 54MBit
> 
> With patch:
> 
> root@OpenWrt:~# cat /var/run/wpa_supplicant-wlan1.conf 
> ap_scan=2
> network={
> 	scan_ssid=0
> 	ssid="link-5g"
> 	key_mgmt=WPA-PSK
> 	mode=1
> 	fixed_freq=1
> 	frequency=5240
> 	mode=1
> 	psk="1234567890"
> 	proto=RSN
> 	htmode=HT20
> }
> 
> iw wlan1 info shows channel 48 (5240 MHz), width: 20 MHz, center1: 5240 MHz 
> (width: 40 MHz with channel 36 and HT40+); iw wlan1 station dump shows
> bitrate
> 
> rx bitrate:	115.6 MBit/s MCS 13 short GI
> tx bitrate:	57.8 MBit/s MCS 5 short GI
> rx bitrate:	86.7 MBit/s MCS 12 short GI
> 
> etc.
> 

ok, so it is adhoc mode. in this case the feature does make sense. the
problem is that the values provided by netifd-wireless.sh cannot
directly be translated to wpa_supplicant values. additionally yor patch
should ensure that values are only applied for adhoc networks. i will
put this on my list and investigate a bit further.
Felix Fietkau Jan. 24, 2015, 7:30 p.m. UTC | #4
On 2015-01-20 18:44, Cezary Jackiewicz wrote:
> $ht variable is not passed. $htmode is.
> 
> With this, wpa_supplicant-phy0.conf contains htmode line if htmode is set in config.
> 
> Signed-off-by: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
I have added a proper fix for this issue in r44100

- Felix
diff mbox

Patch

diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
index d625709..436eee3 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -595,8 +595,7 @@  wpa_supplicant_add_network() {
 		append network_data "mcast_rate=$mc_rate" "$N$T"
 	}
 
-	local ht_str
-	[ -n "$ht" ] && append network_data "htmode=$ht" "$N$T"
+	[ -n "$htmode" ] && append network_data "htmode=$htmode" "$N$T"
 
 	cat >> "$_config" <<EOF
 network={