oblique / create_ap

[NOT MAINTAINED] This script creates a NATed or Bridged WiFi Access Point.
BSD 2-Clause "Simplified" License
4.44k stars 1k forks source link

[PATCH] noscan option of patched hostapd versions ins´t available in create_ap #284

Open semeion opened 7 years ago

semeion commented 7 years ago

@oblique Thanks for creating this nice tool.

I would like to propose the inclusion of an option available in patched hostapd versions. Such versions are available in archival repositories such as archlinux, archlinux-ARM, etc. And it would be interesting to make them available in create_ap, because this patch doubles the speed of the AP to 150MBits using HT40 (which although it is planned in the project, it does not work correctly).

Patched version of hostapd in archlinux repository: https://git.archlinux.org/svntogit/community.git/tree/trunk/hostapd-2.3-noscan.patch?h=packages/hostapd

Ref.: https://www.brunsware.de/blog/gentoo/hostapd-40mhz-disable-neighbor-check.html

Here is an explanation of the problem in Russian (please use google translator): https://www.linux.org.ru/forum/desktop/11359337#comments

Please add my patch to the project.. I patched and tested, doubled the speed of the AP to TX 150MBits and RX 150MBits using atheros chipset (ath9k_htc).

My patch/code:

diff -ura src.origin/create_ap-0.4.6/create_ap src.new/create_ap-0.4.6/create_ap
--- src.origin/create_ap-0.4.6/create_ap    2017-10-05 21:18:46.322356641 -0300
+++ src.new/create_ap-0.4.6/create_ap   2017-10-05 21:40:03.640053323 -0300
@@ -618,6 +618,7 @@
 HT_CAPAB='[HT40+]'
 VHT_CAPAB=
 DRIVER=nl80211
+NO_SCAN=0
 NO_VIRT=0
 COUNTRY=
 FREQ_BAND=2.4
@@ -630,7 +631,7 @@
 REDIRECT_TO_LOCALHOST=0

 CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS DHCP_DNS NO_DNS HIDDEN MAC_FILTER MAC_FILTER_ACCEPT ISOLATE_CLIENTS
-             SHARE_METHOD IEEE80211N IEEE80211AC HT_CAPAB VHT_CAPAB DRIVER NO_VIRT COUNTRY FREQ_BAND
+             SHARE_METHOD IEEE80211N IEEE80211AC HT_CAPAB VHT_CAPAB DRIVER NO_SCAN NO_VIRT COUNTRY FREQ_BAND
              NEW_MACADDR DAEMONIZE NO_HAVEGED WIFI_IFACE INTERNET_IFACE
              SSID PASSPHRASE USE_PSK)

@@ -1023,7 +1024,7 @@
     fi
 done

-GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","hostapd-debug:","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","mkconfig:","config:" -n "$PROGNAME" -- "$@")
+GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","hostapd-debug:","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ht_capab:","vht_capab:","driver:","no-scan","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","mkconfig:","config:" -n "$PROGNAME" -- "$@")
 [[ $? -ne 0 ]] && exit 1
 eval set -- "$GETOPT_ARGS"

@@ -1106,6 +1107,10 @@
             DRIVER="$1"
             shift
             ;;
+        --no-scan)
+            shift
+            NO_SCAN=1
+            ;;
         --no-virt)
             shift
             NO_VIRT=1
@@ -1627,6 +1632,10 @@
     echo "wmm_enabled=1" >> $CONFDIR/hostapd.conf
 fi

+if [[ $NO_SCAN -eq 1 ]]; then
+    echo "noscan=1" >> $CONFDIR/hostapd.conf
+fi
+
 if [[ -n "$PASSPHRASE" ]]; then
     [[ "$WPA_VERSION" == "1+2" ]] && WPA_VERSION=3
     if [[ $USE_PSK -eq 0 ]]; then
diff -ura src.origin/create_ap-0.4.6/create_ap.conf src.new/create_ap-0.4.6/create_ap.conf
--- src.origin/create_ap-0.4.6/create_ap.conf   2017-10-05 21:18:46.322356641 -0300
+++ src.new/create_ap-0.4.6/create_ap.conf  2017-10-05 21:41:21.870735740 -0300
@@ -14,6 +14,7 @@
 HT_CAPAB=[HT40+]
 VHT_CAPAB=
 DRIVER=nl80211
+NO_SCAN=0
 NO_VIRT=0
 COUNTRY=
 FREQ_BAND=2.4

Thank you in advance.

oblique commented 7 years ago

Please create a pull request and I will merge it.

semeion commented 7 years ago

Thank you for accept my patch, but i have no idea how to create a pull request. I tried but seems like it need something to compare.

That New Pull Request button don´t get focused. What is necessary to do it?

I don´t have experience creating github pull requests :(

igorpecovnik commented 7 years ago

https://help.github.com/articles/creating-a-pull-request https://www.exchangecore.com/blog/contributing-concrete5-github

semeion commented 7 years ago

@igorpecovnik very complicated, I do not know how to make this Pull Request :(

semeion commented 7 years ago

I feel stupid :(

semeion commented 7 years ago

Okay! Finally i did my first Pull Request! I hope it is right...

igorpecovnik commented 7 years ago

Good job! Btw. In armbian this patch is in by default for years :)

semeion commented 7 years ago

I think a better way to make all options of hostapd to work could be modify the script to execute /etc/hostapd/hostapd.conf before run create_ap.conf. So every hostapd options should to work with create_ap.conf without conflicts...