add IEEE 802.11n support

This commit is contained in:
Shaw 2014-04-03 20:57:26 +08:00
parent d556cd1fd2
commit 1cd94e81d0
2 changed files with 25 additions and 1 deletions

View File

@ -2,6 +2,7 @@
* Create an AP (Access Point) at any channel. * Create an AP (Access Point) at any channel.
* Choose one of the following encryptions: WPA, WPA2, WPA/WPA2, Open (no encryption). * Choose one of the following encryptions: WPA, WPA2, WPA/WPA2, Open (no encryption).
* Hide your SSID. * Hide your SSID.
* IEEE 802.11n support
* Internet sharing methods: NATed or Bridged or None (no Internet sharing). * Internet sharing methods: NATed or Bridged or None (no Internet sharing).
* Choose the AP Gateway IP (only for 'NATed' and 'None' Internet sharing methods). * Choose the AP Gateway IP (only for 'NATed' and 'None' Internet sharing methods).
* You can create an AP with the same interface you are getting your Internet connection. * You can create an AP with the same interface you are getting your Internet connection.
@ -58,6 +59,8 @@
### WPA + WPA2 passphrase using pipe: ### WPA + WPA2 passphrase using pipe:
echo -e "MyAccessPoint\nMyPassPhrase" | create_ap wlan0 eth0 echo -e "MyAccessPoint\nMyPassPhrase" | create_ap wlan0 eth0
### Enable IEEE 802.11n
create_ap --ieee80211n --ht_capab '[HT40+]' wlan0 eth0 MyAccessPoint MyPassPhrase
## Systemd service ## Systemd service
Using the persistent [systemd](https://wiki.archlinux.org/index.php/systemd#Basic_systemctl_usage) service Using the persistent [systemd](https://wiki.archlinux.org/index.php/systemd#Basic_systemctl_usage) service

View File

@ -30,6 +30,8 @@ usage() {
echo " 'bridge' for bridging" echo " 'bridge' for bridging"
echo " 'none' for no Internet sharing (equivalent to -n)" echo " 'none' for no Internet sharing (equivalent to -n)"
echo " --hidden Make the Access Point hidden (do not broadcast the SSID)" echo " --hidden Make the Access Point hidden (do not broadcast the SSID)"
echo " --ieee80211n Enable IEEE 802.11n (HT)"
echo " --ht_capab <HT> HT capabilities (default: [HT40+])"
echo " --driver Choose your WiFi adapter driver (default: nl80211)" echo " --driver Choose your WiFi adapter driver (default: nl80211)"
echo " --no-virt Do not create virtual interface" echo " --no-virt Do not create virtual interface"
echo echo
@ -126,6 +128,8 @@ WPA_VERSION=1+2
ETC_HOSTS=0 ETC_HOSTS=0
HIDDEN=0 HIDDEN=0
SHARE_METHOD=nat SHARE_METHOD=nat
IEEE80211N=0
HT_CAPAB='[HT40+]'
DRIVER=nl80211 DRIVER=nl80211
NO_VIRT=0 NO_VIRT=0
@ -192,7 +196,7 @@ die() {
# if the user press ctrl+c then execute die() # if the user press ctrl+c then execute die()
trap "die" SIGINT trap "die" SIGINT
ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","driver:","no-virt" -n $(basename $0) -- "$@") ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt" -n $(basename $0) -- "$@")
[[ $? -ne 0 ]] && exit 1 [[ $? -ne 0 ]] && exit 1
eval set -- "$ARGS" eval set -- "$ARGS"
@ -234,6 +238,15 @@ while :; do
SHARE_METHOD="$1" SHARE_METHOD="$1"
shift shift
;; ;;
--ieee80211n)
shift
IEEE80211N=1
;;
--ht_capab)
shift
HT_CAPAB="$1"
shift
;;
--driver) --driver)
shift shift
DRIVER="$1" DRIVER="$1"
@ -376,6 +389,14 @@ ctrl_interface_group=0
ignore_broadcast_ssid=$HIDDEN ignore_broadcast_ssid=$HIDDEN
EOF EOF
if [[ $IEEE80211N -eq 1 ]]; then
cat << EOF >> $CONFDIR/hostapd.conf
ieee80211n=1
wmm_enabled=1
ht_capab=${HT_CAPAB}
EOF
fi
if [[ -n "$PASSPHRASE" ]]; then if [[ -n "$PASSPHRASE" ]]; then
[[ "$WPA_VERSION" == "1+2" || "$WPA_VERSION" == "2+1" ]] && WPA_VERSION=3 [[ "$WPA_VERSION" == "1+2" || "$WPA_VERSION" == "2+1" ]] && WPA_VERSION=3
cat << EOF >> $CONFDIR/hostapd.conf cat << EOF >> $CONFDIR/hostapd.conf