[package] hostapd: sync 8.09 script with trunk
authorNicolas Thill <nico@openwrt.org>
Wed, 29 Apr 2009 14:26:56 +0000 (14:26 +0000)
committerNicolas Thill <nico@openwrt.org>
Wed, 29 Apr 2009 14:26:56 +0000 (14:26 +0000)
SVN-Revision: 15488

package/hostapd/Makefile
package/hostapd/files/hostapd.sh

index 9b4f605..0d17a2f 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2009 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
 PKG_VERSION:=0.6.6
-PKG_RELEASE:=1
+PKG_RELEASE:=1.1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/
index 1ce62fd..56fecde 100644 (file)
@@ -22,7 +22,7 @@ hostapd_setup_vif() {
                        wpa=3
                        crypto="CCMP TKIP"
                ;;
-               *) 
+               *)
                        wpa=1
                        crypto="TKIP"
                ;;
@@ -67,6 +67,7 @@ hostapd_setup_vif() {
                ;;
                *)
                        wpa=0
+                       crypto=
                ;;
        esac
        config_get ifname "$vif" ifname
@@ -76,25 +77,30 @@ hostapd_setup_vif() {
        config_get channel "$device" channel
        config_get hwmode "$device" hwmode
        case "$hwmode" in
-               11a) hwmode=a;;
-               11b) hwmode=b;;
-               11g) hwmode=g;;
+               *a) hwmode=a;;
+               *b) hwmode=b;;
+               *g) hwmode=g;;
                *)
                        hwmode=
-                       [ "$channel" -gt 14 ] && hwmode=a
+                       [ -n "$channel" ] && {
+                               test $channel -gt 14 2>/dev/null && hwmode=a
+                       }
                ;;
        esac
+       config_get country "$device" country
+       [ "$channel" = auto ] && channel=
        cat > /var/run/hostapd-$ifname.conf <<EOF
 ctrl_interface=/var/run/hostapd-$ifname
 driver=$driver
 interface=$ifname
-hw_mode=${hwmode:-g}
-channel=$channel
+${hwmode:+hw_mode=$hwmode}
+${channel:+channel=$channel}
 ${bridge:+bridge=$bridge}
 ssid=$ssid
 debug=0
 wpa=$wpa
-wpa_pairwise=$crypto
+${crypto:+wpa_pairwise=$crypto}
+${country:+country_code=$country}
 $hostapd_cfg
 EOF
        hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf