]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/initscripts/init.d/hostapd
vpn-statistic: change title of ovpn RW statistic page
[ipfire-2.x.git] / src / initscripts / init.d / hostapd
index 31083399b18f83ce6191fbe597f3b9e45717dd1d..1e7cec48097ee35f4cd1408ad5bb728d09c20fc0 100644 (file)
@@ -3,6 +3,7 @@
 . ${rc_functions}
 
 CHANNEL="05"
+COUNTRY="00"
 TXPOWER="auto"
 INTERFACE="blue0"
 MACMODE="0"
@@ -74,6 +75,13 @@ case "${1}" in
                        fi
                fi
 
+               # First set to any country then reset to World (00)
+               # and then set new country because the card is only
+               # reprogrammed if the region was changed.
+               /usr/sbin/iw reg set DE
+               /usr/sbin/iw reg set 00
+               /usr/sbin/iw reg set $COUNTRY
+
                /usr/sbin/iwconfig $INTERFACE channel $CHANNEL 2>/dev/null
                /usr/sbin/iwconfig $INTERFACE txpower $TXPOWER
 
@@ -98,8 +106,18 @@ case "${1}" in
                sleep 2
 
                if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then
-                       boot_mesg "Error! Can't set wlan master mode"
-                       echo_failure;
+                       killproc /usr/bin/hostapd > /dev/null 2>&1
+                       boot_mesg "Try to create additional AP device ..." 
+                       ip link set ${INTERFACE} down
+                       ip link set ${INTERFACE} name ${INTERFACE}_man
+                       iw dev  ${INTERFACE}_man interface add ${INTERFACE} type __ap
+                       evaluate_retval;
+                       if [ -d /sys/class/net/${INTERFACE} ]; then
+                               /usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf >/dev/null 2>&1 &
+                       else
+                               ip link set ${INTERFACE}_man down
+                               ip link set ${INTERFACE}_man name ${INTERFACE}
+                       fi
                        exit 0;
                else
                        echo_ok
@@ -108,7 +126,9 @@ case "${1}" in
 
        stop)
                boot_mesg "Stopping hostapd..."
-
+               ip link set ${INTERFACE} down > /dev/null 2>&1
+               ip link set ${INTERFACE} down_man > /dev/null 2>&1
+               sleep 1
                killproc /usr/bin/hostapd
                evaluate_retval
                ;;