]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/hostapd
11 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/wlanap
/settings
)
15 mkdir
-p /var
/run
/hostapd
17 boot_mesg
"Starting hostapd... "
19 # Check Interface configuration
20 if ! ip link show
$INTERFACE > /dev
/null
2>&1; then
21 boot_mesg
"Interface $INTERFACE doesn't exist." ${FAILURE}
25 if [ "$(ip link show $INTERFACE | /bin/grep "ether
")" == "" ]; then
26 boot_mesg
"Interface $INTERFACE is assigned to wlan master device." ${FAILURE}
27 boot_mesg
"Please reboot to fix this." ${FAILURE}
31 if [ "$(iwconfig $INTERFACE | /bin/grep "IEEE
")" == "" ]; then
32 boot_mesg
"Interface $INTERFACE is no wireless device." ${FAILURE}
38 if [ -e "/sys/class/net/$INTERFACE/phy80211" ]; then
41 elif [ "$(/bin/grep hostap /sys/class/net/$INTERFACE/uevent)" != "" ]; then
45 boot_mesg
"Interface $INTERFACE is a not supported wireless device." ${FAILURE}
50 echo driver
=$driver > /etc
/hostapd.conf.tmp
51 grep -v "^driver=" /etc
/hostapd.conf
>> /etc
/hostapd.conf.tmp
52 mv /etc
/hostapd.conf.tmp
/etc
/hostapd.conf
54 echo DRIVER
=$DRIVER > /var
/ipfire
/wlanap
/settings.tmp
55 grep -v "^DRIVER=" /var
/ipfire
/wlanap
/settings
>> /var
/ipfire
/wlanap
/settings.tmp
56 chown nobody
:nobody
/var
/ipfire
/wlanap
/settings.tmp
57 chmod 644 /var
/ipfire
/wlanap
/settings.tmp
58 mv /var
/ipfire
/wlanap
/settings.tmp
/var
/ipfire
/wlanap
/settings
60 if [ "$DRIVER" == "HOSTAP" ]; then
61 if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode
:Master
")" == "" ]; then
62 boot_mesg
"Setting HOSTAP wlan $INTERFACE to Master mode... "
63 # Set Prism Cards to master mode
64 /usr
/bin
/iwconfig
$INTERFACE mode master
> /dev
/null
68 # First set to any country then reset to World (00)
69 # and then set new country because the card is only
70 # reprogrammed if the region was changed.
71 /usr
/sbin
/iw reg
set DE
72 /usr
/sbin
/iw reg
set 00
73 /usr
/sbin
/iw reg
set $COUNTRY
75 /usr
/sbin
/iwconfig
$INTERFACE channel
$CHANNEL 2>/dev
/null
76 /usr
/sbin
/iwconfig
$INTERFACE txpower
$TXPOWER
78 /usr
/bin
/hostapd
-P /var
/run
/hostapd
/etc
/hostapd.conf
>/dev
/null
2>&1 &
82 if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode
:Master
")" == "" ]; then
83 killproc
/usr
/bin
/hostapd
> /dev
/null
2>&1
84 boot_mesg
"Try to create additional AP device ..."
85 ip link
set ${INTERFACE} down
86 ip link
set ${INTERFACE} name
${INTERFACE}_man
87 iw dev
${INTERFACE}_man interface add
${INTERFACE} type __ap
89 if [ -d /sys
/class
/net
/${INTERFACE} ]; then
90 /usr
/bin
/hostapd
-P /var
/run
/hostapd
/etc
/hostapd.conf
>/dev
/null
2>&1 &
92 ip link
set ${INTERFACE}_man down
93 ip link
set ${INTERFACE}_man name
${INTERFACE}
102 boot_mesg
"Stopping hostapd..."
103 ip link
set ${INTERFACE} down
> /dev
/null
2>&1
104 ip link
set ${INTERFACE} down_man
> /dev
/null
2>&1
106 killproc
/usr
/bin
/hostapd
117 statusproc
/usr
/bin
/hostapd
121 echo "Usage: ${0} {start|stop|restart|status}"