Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
a3b2ba2e
Commit
a3b2ba2e
authored
Sep 05, 2017
by
Igor Pecovnik
Browse files
Various bugfixes, mostly in hostapd area
parent
964d7db1
Changes
2
Hide whitespace changes
Inline
Side-by-side
debian-config-jobs
View file @
a3b2ba2e
...
...
@@ -186,6 +186,7 @@ function jobs ()
rm
-f
/etc/network/interfaces.d/armbian.ap.nat
rm
-f
/etc/network/interfaces.d/armbian.ap.bridge
sed
-i
'/^iptables/ d'
/etc/rc.local
sed
'/keyfile\|unmanaged-devices/ d'
-i
/etc/NetworkManager/NetworkManager.conf
iptables
-F
# reload services
reload-nety
...
...
@@ -197,7 +198,14 @@ function jobs ()
else
# remove interfaces from managed list
sed
'/keyfile\|unmanaged-devices/ d'
-i
/etc/NetworkManager/NetworkManager.conf
service network-manager restart
;
sleep
2
# start with basic config
if
grep
-q
"^## IEEE 802.11ac"
/etc/hostapd.conf
;
then
sed
'/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/'
-i
/etc/hostapd.conf
;
fi
if
grep
-q
"^## IEEE 802.11a"
/etc/hostapd.conf
;
then
sed
'/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/'
-i
/etc/hostapd.conf
;
fi
if
grep
-q
"^## IEEE 802.11n"
/etc/hostapd.conf
;
then
sed
'/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/'
-i
/etc/hostapd.conf
;
fi
sed
-i
"s/^channel=.*/channel=5/"
/etc/hostapd.conf
service network-manager restart
;
sleep
3
# change special adapters to AP mode
wlan_exceptions
"on"
# check for WLAN interfaces
...
...
@@ -205,7 +213,7 @@ function jobs ()
# add interface to unmanaged list
echo
"[keyfile]"
>>
/etc/NetworkManager/NetworkManager.conf
echo
"unmanaged-devices=interface-name:
$WIRELESS_ADAPTER
"
>>
/etc/NetworkManager/NetworkManager.conf
service network-manager restart
;
sleep
2
service network-manager restart
;
sleep
3
# display dialog
dialog
--colors
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Wireless adapter:
\Z
1
${
WIRELESS_ADAPTER
}
\Z
0
\n\n
Probing nl80211 hostapd driver compatibility."
7 50
apt-get
-o
Dpkg::Options::
=
"--force-confnew"
-y
-qq
--no-install-recommends
install
hostapd
>
/dev/null
...
...
@@ -229,15 +237,16 @@ function jobs ()
apt-get
-o
Dpkg::Options::
=
"--force-confnew"
-y
-qq
--no-install-recommends
install
hostapd-realtek
>
/dev/null
# change to selected interface
sed
-i
"s/^interface=.*/interface=
$WIRELESS_ADAPTER
/"
/etc/hostapd.conf
# add allow cli access if not exists. temporally
if
!
grep
-q
"ctrl_interface"
/etc/hostapd.conf
;
then
echo
"ctrl_interface=/var/run/hostapd"
>>
/etc/hostapd.conf
echo
"ctrl_interface_group=0"
>>
/etc/hostapd.conf
fi
#
check_advanced_modes
#
fi
# add allow cli access if not exists. temporally
if
!
grep
-q
"ctrl_interface"
/etc/hostapd.conf
;
then
echo
"ctrl_interface=/var/run/hostapd"
>>
/etc/hostapd.conf
echo
"ctrl_interface_group=0"
>>
/etc/hostapd.conf
fi
#
check_advanced_modes
#
CHECK
=
$(
systemctl daemon-reload
;
service hostapd stop
;
sleep
2
;
service hostapd start
;
service hostapd status|grep fail
)
# if both fails there is other problem
if
[[
-n
"
$CHECK
"
]]
;
then
...
...
debian-config-submenu
View file @
a3b2ba2e
...
...
@@ -57,6 +57,10 @@ CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd st
sleep
2
sed
'/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//'
-i
/etc/hostapd.conf
CHECK
=
$(
systemctl daemon-reload
;
service hostapd stop
;
sleep
2
;
service hostapd start
;
sleep
2
;
service hostapd status|grep fail
)
if
[[
-n
"
$CHECK
"
]]
;
then
check_channels
fi
CHECK
=
$(
systemctl daemon-reload
;
service hostapd stop
;
sleep
2
;
service hostapd start
;
service hostapd status|grep fail
)
if
[[
-z
"
$CHECK
"
]]
;
then
dialog
--title
" Info "
--backtitle
"
$BACKTITLE
"
--no-collapse
--colors
--infobox
"
\n
Probing wireless 802.11ac
\Z
1(433Mbps x n @ 5Ghz)
\Z
0"
5 51
sleep
2
...
...
@@ -68,6 +72,7 @@ CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd st
fi
else
dialog
--title
" Reverting configuration "
--backtitle
"
$BACKTITLE
"
--no-collapse
--colors
--infobox
"
\n
Wireless 802.11a
\Z
1(5Ghz)
\Z
0 is not supported!"
5 45
sed
-i
"s/^channel=.*/channel=5/"
/etc/hostapd.conf
sed
'/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/'
-i
/etc/hostapd.conf
fi
else
...
...
@@ -104,6 +109,7 @@ service hostapd stop; echo 20; sleep 1;\
service dnsmasq stop
;
echo
30
;
sleep
1
;
\
[[
"
$1
"
==
"reload"
]]
&&
service dnsmasq start
&&
echo
60
&&
sleep
1
&&
service hostapd start
&&
echo
80
&&
sleep
1
;
\
service network-manager start
;
echo
90
;
sleep
5
;
)
| dialog
--backtitle
"
$BACKTITLE
"
--title
"
$WHATODO
"
--gauge
""
6 70 0
systemctl restart systemd-resolved.service
}
...
...
@@ -156,15 +162,29 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --
function
check_ht_capab
()
{
declare
-a
arr
=(
"[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]"
"[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]"
"[SHORT-GI-20][SHORT-GI-40][HT40+]"
)
local
j
=
0
for
i
in
"
${
arr
[@]
}
"
do
echo
"
$i
"
j
=
$((
j+1
))
dialog
--title
" Info "
--backtitle
"
$BACKTITLE
"
--no-collapse
--colors
--infobox
"
\n
Probing high throughput capabilities
\Z
1(
${
j
}
)
\Z
0"
5 46
sed
-i
"s/^ht_capab=.*/ht_capab=
$i
/"
/etc/hostapd.conf
CHECK
=
$(
systemctl daemon-reload
;
service hostapd stop
;
sleep
2
;
service hostapd start
;
sleep
2
;
service hostapd status|grep fail
)
if
[[
-z
"
$CHECK
"
]]
;
then
break
;
fi
done
}
function
check_channels
()
{
declare
-a
arr
=(
"36"
"40"
)
for
i
in
"
${
arr
[@]
}
"
do
dialog
--title
" Info "
--backtitle
"
$BACKTITLE
"
--no-collapse
--colors
--infobox
"
\n
Probing channels
\Z
1(
${
i
}
)
\Z
0"
5 26
sed
-i
"s/^channel=.*/channel=
$i
/"
/etc/hostapd.conf
CHECK
=
$(
systemctl daemon-reload
;
service hostapd stop
;
sleep
2
;
service hostapd start
;
sleep
2
;
service hostapd status|grep fail
)
if
[[
-z
"
$CHECK
"
]]
;
then
break
;
fi
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
...
...
@@ -355,12 +375,14 @@ function get_wlan_interface ()
IFS
=
$'
\r\n
'
GLOBIGNORE
=
'*'
WLAN_INTERFACES
=(
$(
nmcli dev status |
grep
wifi |
grep
disconnected |awk
'{print $1}'
)
)
local
LIST
=()
for
i
in
"
${
WLAN_INTERFACES
[@]
}
"
do
LIST+
=(
"
${
i
[0]//[[
:blank:]]/
}
"
""
)
done
LIST_LENGHT
=
$((${#
LIST
[@]
}
/
2
))
;
if
[
"
$LIST_LENGHT
"
-eq
1
]
;
then
WIRELESS_ADAPTER
=
${
WLAN_INTERFACES
[0]
}
else
...
...
@@ -545,12 +567,15 @@ while true; do
if
[[
-n
$HOSTAPDINFO
&&
-n
$HOSTAPDSTATUS
]]
;
then
LISTLENGHT
=
$((
LISTLENGHT+2
))
chipid
=
$(
dmesg |
grep
$(
grep
^interface /etc/hostapd.conf |
sed
's/interface=//g'
)
|
head
-1
|
sed
's/\[.*\]//g'
|
awk
'{print $1}'
)
disclaimer
=
$disclaimer
$"
\n\Z
0Hotspot SSID:
\Z
1
$HOSTAPDINFO
\Z
n Band:"
;
if
[[
`
grep
^hw_mode
=
a /etc/hostapd.conf
`
]]
;
then
local
band
=
"5Ghz"
;
else
band
=
"2.4Ghz"
;
fi
if
[[
`
grep
^ieee80211n /etc/hostapd.conf
`
]]
;
then
local type
=
"N"
;
fi
if
[[
`
grep
^ieee80211ac /etc/hostapd.conf
`
]]
;
then
local type
=
"AC"
;
fi
disclaimer
=
$disclaimer
$"
\Z
1
${
band
}
${
type
}
\Z
0 "
disclaimer
=
$disclaimer
$"
\Z
1
${
band
}
${
type
}
\Z
0"
if
[
-n
$chipid
]
;
then
disclaimer
=
$disclaimer
$"
\n\n
Chip:
\Z
1
${
chipid
}
\Z
0"
;
fi
if
[
"
$HOSTAPDCLIENTS
"
-gt
"0"
]
;
then
disclaimer
=
$disclaimer
$" Connected clients:
\Z
1
$HOSTAPDCLIENTS
\Z
n"
;
fi
if
[
-n
$chip
]
||
[
"
$HOSTAPDCLIENTS
"
-gt
"0"
]
;
then
LISTLENGHT
=
$((
LISTLENGHT+2
))
;
fi
disclaimer
=
$disclaimer
$"
\n
"
;
fi
#disclaimer=$disclaimer"\n"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment