From d1b89a12f9d067c5983c410641b11fe7c195a4c9 Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Sun, 18 Jan 2015 21:29:53 +0100 Subject: [PATCH] hostapd: create additional AP device if switch has failed. --- src/initscripts/init.d/hostapd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/initscripts/init.d/hostapd b/src/initscripts/init.d/hostapd index 8f59a7f16f..357452cede 100644 --- a/src/initscripts/init.d/hostapd +++ b/src/initscripts/init.d/hostapd @@ -106,8 +106,13 @@ 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; + /usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf >/dev/null 2>&1 & exit 0; else echo_ok @@ -116,7 +121,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 ;; -- 2.39.5