From 1f06c1deed15c83450c97c8416c5b75507a53926 Mon Sep 17 00:00:00 2001 From: CattySteve Date: Wed, 22 Nov 2023 20:42:15 +0800 Subject: [PATCH 1/2] Add 802.11ax capability and UI --- src/scripts/create_ap.conf | 1 + src/ui/glade/wifih.ui | 412 ++++++++++++++++++++----------------- src/ui/h_prop.c | 4 + src/ui/read_config.cpp | 3 + src/ui/read_config.h | 2 + src/ui/ui.c | 12 ++ 6 files changed, 245 insertions(+), 189 deletions(-) diff --git a/src/scripts/create_ap.conf b/src/scripts/create_ap.conf index aa4527d..029adea 100644 --- a/src/scripts/create_ap.conf +++ b/src/scripts/create_ap.conf @@ -12,6 +12,7 @@ ISOLATE_CLIENTS=0 SHARE_METHOD=nat IEEE80211N=0 IEEE80211AC=0 +IEEE80211AX=0 HT_CAPAB=[HT40+] VHT_CAPAB= DRIVER=nl80211 diff --git a/src/ui/glade/wifih.ui b/src/ui/glade/wifih.ui index bb38fec..d339338 100644 --- a/src/ui/glade/wifih.ui +++ b/src/ui/glade/wifih.ui @@ -1,34 +1,31 @@ - + True - False + False Wi Hotspot - - - True - False - 5 - 10 + False + 5 + 10 vertical 5 True - False + False 3 True True - False + False start - 10 + 10 SSID @@ -41,7 +38,7 @@ True - True + True False @@ -53,13 +50,13 @@ True - False - 20 + False + 20 10 True - False + False Password @@ -72,11 +69,11 @@ Open True - True - False + True + False start - 10 - True + 10 + True False @@ -94,7 +91,7 @@ True - True + True False @@ -114,14 +111,14 @@ True - False + False True True - False + False start - 10 + 10 Wifi interface @@ -134,7 +131,7 @@ True - False + False False @@ -146,9 +143,9 @@ True - False + False start - 20 + 20 Internet interface @@ -161,7 +158,7 @@ True - False + False False @@ -181,7 +178,7 @@ True - False + False False @@ -192,224 +189,225 @@ True - True - True - True + True + True + True True - True - never - in - 160 - True + True + never + in + 160 + True True - False + False True - False + False vertical + True - False - 10 - 5 - 10 - True + False + 10 + 5 + 10 + True 2.4Ghz True - True - False - True + True + False + True rb_freq_auto - 2 - 0 + 2 + 0 Auto True - True - False - True + True + False + True rb_freq_5 - 1 - 0 + 1 + 0 True - False + False start Frequency band - 0 - 0 + 0 + 0 5Ghz True - True - False - True + True + False + True rb_freq_auto - 3 - 0 + 3 + 0 Hidden True - True - False - True + True + False + True - 0 - 1 + 0 + 1 Use psk True - True - False - True + True + False + True - 0 - 2 + 0 + 2 Set MAC True - True - False - True + True + False + True - 0 - 3 + 0 + 3 True - True + True start - 1 - 3 + 1 + 3 No Virt True - True - False - Do not create virtual interface - True + True + False + Do not create virtual interface + True - 0 - 4 + 0 + 4 Channel True - True - False - True + True + False + True - 0 - 5 + 0 + 5 True - True + True start - 1 - 5 + 1 + 5 Gateway True - True - False - True + True + False + True - 0 - 6 + 0 + 6 True - True + True start - 1 - 6 + 1 + 6 Mac Filter True - True - False - True + True + False + True - 0 - 7 + 0 + 7 True - True - False - GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE + True + False + GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE True - 1 - 7 + 1 + 7 2 @@ -417,43 +415,53 @@ IEEE80211n True - True - False - True + True + False + True - 0 - 9 - - - - - IEEE80211ac - True - True - False - True - - - 2 - 9 + 0 + 9 No Haveged True - True - False - True + True + False + True - 0 - 10 + 0 + 10 - + + IEEE80211ac + True + True + False + True + + + 1 + 9 + + + + + IEEE80211ax + True + True + False + True + + + 2 + 9 + @@ -543,7 +551,7 @@ True - False + False Advanced @@ -557,71 +565,96 @@ True - True + True True - True - in - 100 + True + in + 100 True - False + False True - False + False vertical + True - False - True + False + True True - False + False Number - 0 - 0 + 0 + 0 True - False + False Hostname - 1 - 0 + 1 + 0 True - False + False IP - 2 - 0 + 2 + 0 True - False + False MAC - 3 - 0 + 3 + 0 + + + + + + + + + + + + + + + + + + + + + + + + False @@ -630,12 +663,13 @@ + True - False - True - True - 1 + False + True + True + 1 @@ -674,13 +708,13 @@ Refresh True - True - True + True + True False True - end + end 2 @@ -693,7 +727,7 @@ True - False + False Connected devices @@ -707,14 +741,14 @@ True - False + False end About True - True - True + True + True False @@ -727,8 +761,8 @@ Open QR True - True - True + True + True False @@ -740,15 +774,15 @@ Create hotspot True - True - True + True + True end False True 10 - end + end 2 @@ -756,8 +790,8 @@ Stop True - True - True + True + True end @@ -778,12 +812,12 @@ True - False - 10 - 10 - 1 - 1 - 0.20000000000000001 + False + 10 + 10 + 1 + 1 + 0.20 False @@ -794,7 +828,7 @@ True - False + False False @@ -805,17 +839,17 @@ True - False - 5 + False + 5 vertical True - False + False start - 5 - 1 - 1 + 5 + 1 + 1 Running status @@ -827,7 +861,7 @@ True - False + False center @@ -840,7 +874,7 @@ False True - end + end 8 diff --git a/src/ui/h_prop.c b/src/ui/h_prop.c index 7c50d30..06bda69 100644 --- a/src/ui/h_prop.c +++ b/src/ui/h_prop.c @@ -136,6 +136,10 @@ const char *build_wh_mkconfig_command(ConfigValues* cv){ strcat(cmd_mkconfig," --ieee80211ac "); } + if(cv->ieee80211ax!=NULL && (strcmp(cv->ieee80211ax,"1") == 0)){ + strcat(cmd_mkconfig," --ieee80211ax "); + } + if(cv->mac!=NULL) { strcat(cmd_mkconfig, " --mac "); strcat(cmd_mkconfig, cv->mac); diff --git a/src/ui/read_config.cpp b/src/ui/read_config.cpp index 3e2dc72..7148a95 100644 --- a/src/ui/read_config.cpp +++ b/src/ui/read_config.cpp @@ -133,6 +133,9 @@ static void setConfigValues(const char * key, char *value){ if( !strcmp ( IEEE80211AC, key )) configValues.ieee80211ac = value; + + if( !strcmp ( IEEE80211AX, key )) + configValues.ieee80211ax = value; if( !strcmp ( GATEWAY, key )) configValues.gateway = value; diff --git a/src/ui/read_config.h b/src/ui/read_config.h index 2fb240f..51996ae 100644 --- a/src/ui/read_config.h +++ b/src/ui/read_config.h @@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define SHARE_METHOD "SHARE_METHOD" #define IEEE80211N "IEEE80211N" #define IEEE80211AC "IEEE80211AC" +#define IEEE80211AX "IEEE80211AX" #define HT_CAPAB "HT_CAPAB" #define VHT_CAPAB "VHT_CAPAB" #define DRIVER "DRIVER" @@ -91,6 +92,7 @@ typedef struct{ char *accepted_macs; char *ieee80211n; char *ieee80211ac; + char *ieee80211ax; char *no_haveged; char *gateway; } ConfigValues; diff --git a/src/ui/ui.c b/src/ui/ui.c index d43cd8c..63c6c74 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -98,6 +98,7 @@ GtkCheckButton *cb_open; GtkCheckButton *cb_mac_filter; GtkCheckButton *cb_ieee80211n; GtkCheckButton *cb_ieee80211ac; +GtkCheckButton *cb_ieee80211ax; GtkProgressBar *progress_bar; @@ -440,6 +441,7 @@ int initUi(int argc, char *argv[]){ cb_mac_filter = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_mac_filter"); cb_ieee80211n = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211n"); cb_ieee80211ac= (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211ac"); + cb_ieee80211ax= (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211ax"); rb_freq_auto = (GtkRadioButton *) gtk_builder_get_object(builder, "rb_freq_auto"); rb_freq_2 = (GtkRadioButton *) gtk_builder_get_object(builder, "rb_freq_2"); @@ -557,6 +559,11 @@ void init_ui_from_config(){ gtk_toggle_button_set_active((GtkToggleButton*) cb_ieee80211ac,TRUE); } + if(strcmp(values->ieee80211ax,"1")==0){ + + gtk_toggle_button_set_active((GtkToggleButton*) cb_ieee80211ax,TRUE); + } + if(strcmp(values->channel,"")!=0 && strcmp(values->channel,"default")!=0){ gtk_toggle_button_set_active((GtkToggleButton*) cb_channel,TRUE); gtk_entry_set_text(entry_channel,values->channel); @@ -943,6 +950,11 @@ static int init_config_val_input(ConfigValues* cv){ else cv->ieee80211ac =NULL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_ieee80211ax))) + cv->ieee80211ax = "1"; + else + cv->ieee80211ax =NULL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_mac_filter))){ cv->mac_filter = "1"; From 38e4828c5d51ac4c6f86ad1eac79cda5dbb01f63 Mon Sep 17 00:00:00 2001 From: CattySteve Date: Wed, 22 Nov 2023 20:49:15 +0800 Subject: [PATCH 2/2] Add 802.11ax in create_ap --- README.md | 2 +- src/scripts/bash_completion | 6 ++++++ src/scripts/create_ap | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 85e7c09..bcb7cf4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ * Customise wifi Channel, Change MAC address, etc. * Hide SSID * customize gateway IP address -* Enable IEEE 80211n, IEEE 80211ac modes +* Enable IEEE 80211n, IEEE 80211ac and IEEE 80211ax modes ![screenshot](docs/sc4.png) diff --git a/src/scripts/bash_completion b/src/scripts/bash_completion index aae0bb2..356c327 100644 --- a/src/scripts/bash_completion +++ b/src/scripts/bash_completion @@ -70,6 +70,12 @@ _create_ap() { --ieee80211n) # No Options ;; + --ieee80211ac) + # No Options + ;; + --ieee80211ax) + # No Options + ;; --ht_capab) # Refer http://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf opts=' diff --git a/src/scripts/create_ap b/src/scripts/create_ap index bf52b24..b921092 100755 --- a/src/scripts/create_ap +++ b/src/scripts/create_ap @@ -14,7 +14,7 @@ # dnsmasq # iptables -VERSION=0.4.7 +VERSION=0.4.8 PROGNAME="$(basename $0)" # make sure that all command outputs are in english @@ -50,6 +50,7 @@ usage() { echo " --isolate-clients Disable communication between clients" echo " --ieee80211n Enable IEEE 802.11n (HT)" echo " --ieee80211ac Enable IEEE 802.11ac (VHT)" + echo " --ieee80211ax Enable IEEE 802.11ax (VHT)" echo " --ht_capab HT capabilities (default: [HT40+])" echo " --vht_capab VHT capabilities" echo " --country Set two-letter country code for regularity (example: US)" @@ -641,6 +642,7 @@ ISOLATE_CLIENTS=0 SHARE_METHOD=nat IEEE80211N=0 IEEE80211AC=0 +IEEE80211AX=0 HT_CAPAB='[HT40+]' VHT_CAPAB= DRIVER=nl80211 @@ -658,7 +660,7 @@ HOSTAPD_DEBUG_ARGS= REDIRECT_TO_LOCALHOST=0 CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS DHCP_DNS NO_DNS NO_DNSMASQ 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 IEEE80211AX HT_CAPAB VHT_CAPAB DRIVER NO_VIRT COUNTRY FREQ_BAND NEW_MACADDR DAEMONIZE DAEMON_PIDFILE DAEMON_LOGFILE NO_HAVEGED WIFI_IFACE INTERNET_IFACE SSID PASSPHRASE USE_PSK ADDN_HOSTS) @@ -1062,7 +1064,7 @@ for ((i=0; i<$#; i++)); do fi done -GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","hostapd-timestamps","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","pidfile:","logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@") +GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","hostapd-timestamps","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ieee80211ax","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","pidfile:","logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@") [[ $? -ne 0 ]] && exit 1 eval set -- "$GETOPT_ARGS" @@ -1135,6 +1137,10 @@ while :; do shift IEEE80211AC=1 ;; + --ieee80211ax) + shift + IEEE80211AX=1 + ;; --ht_capab) shift HT_CAPAB="$1" @@ -1703,6 +1709,10 @@ if [[ $IEEE80211AC -eq 1 ]]; then echo "ieee80211ac=1" >> $CONFDIR/hostapd.conf fi +if [[ $IEEE80211AX -eq 1 ]]; then + echo "ieee80211ax=1" >> $CONFDIR/hostapd.conf +fi + if [[ -n "$VHT_CAPAB" ]]; then echo "vht_capab=${VHT_CAPAB}" >> $CONFDIR/hostapd.conf fi