From 120edfef7eaad9c79e4144baf0bc1f7a6b18ea83 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Sep 2021 19:40:38 +0100 Subject: [PATCH] Add no_haveged option --- src/ui/glade/wifih.ui | 13 +++++++++++++ src/ui/h_prop.c | 5 ++++- src/ui/read_config.cpp | 3 +++ src/ui/read_config.h | 2 ++ src/ui/ui.c | 14 +++++++++++++- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/ui/glade/wifih.ui b/src/ui/glade/wifih.ui index 6654919..2dab4a8 100644 --- a/src/ui/glade/wifih.ui +++ b/src/ui/glade/wifih.ui @@ -233,6 +233,19 @@ 1 + + + No Haveged + True + True + False + True + + + 0 + 9 + + Use psk diff --git a/src/ui/h_prop.c b/src/ui/h_prop.c index 09107f3..93c7379 100644 --- a/src/ui/h_prop.c +++ b/src/ui/h_prop.c @@ -116,6 +116,9 @@ const char *build_wh_mkconfig_command(ConfigValues* cv){ if(cv->hidden!=NULL && (strcmp(cv->hidden,"1") == 0)) strcat(cmd_mkconfig," --hidden "); + if(cv->no_haveged!=NULL && (strcmp(cv->no_haveged,"1") == 0)) + strcat(cmd_mkconfig," --no-haveged "); + if(cv->channel!=NULL && (strcmp(cv->channel,"default") != 0) && (cv->freq==NULL||(strcmp(cv->freq,"2.4") == 0)|| (strcmp(cv->freq,"5") == 0))){ strcat(cmd_mkconfig," -c "); @@ -472,4 +475,4 @@ PtrToNode add_device_node(PtrToNode l, int number, char line[BUFSIZE], int marke next->Next = NULL; l->Next = next; return next; -} \ No newline at end of file +} diff --git a/src/ui/read_config.cpp b/src/ui/read_config.cpp index 18f8831..8eb3b3e 100644 --- a/src/ui/read_config.cpp +++ b/src/ui/read_config.cpp @@ -104,6 +104,9 @@ static void setConfigValues(const char * key, char *value){ if( !strcmp ( HIDDEN, key )) configValues.hidden = value; + if( !strcmp ( NO_HAVEGED, key )) + configValues.no_haveged = value; + if( !strcmp ( NO_VIRT, key )) configValues.no_virt = value; diff --git a/src/ui/read_config.h b/src/ui/read_config.h index f4807b2..a46769a 100644 --- a/src/ui/read_config.h +++ b/src/ui/read_config.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define NO_DNS "NO_DNS" #define NO_DNSMASQ "NO_DNSMASQ" #define HIDDEN "HIDDEN" +#define NO_HAVEGED "NO_HAVEGED" #define MAC_FILTER "MAC_FILTER" #define MAC_FILTER_ACCEP "MAC_FILTER_ACCEPT" #define ISOLATE_CLIENTS "ISOLATE_CLIENTS" @@ -90,6 +91,7 @@ typedef struct{ char *accepted_macs; char *ieee80211n; char *ieee80211ac; + char *no_haveged; } ConfigValues; diff --git a/src/ui/ui.c b/src/ui/ui.c index 418b05e..d2911ec 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -82,6 +82,7 @@ GtkRadioButton *rb_freq_2; GtkRadioButton *rb_freq_5; GtkCheckButton *cb_hidden; +GtkCheckButton *cb_no_haveged; GtkCheckButton *cb_psk; GtkCheckButton *cb_mac; GtkCheckButton *cb_novirt; @@ -385,6 +386,7 @@ int initUi(int argc, char *argv[]){ combo_internet = (GtkComboBox *) gtk_builder_get_object(builder, "combo_internet"); cb_hidden = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_hidden"); + cb_no_haveged = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_no_haveged"); cb_psk = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_psk"); cb_mac = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_mac"); cb_novirt = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_novirt"); @@ -476,10 +478,15 @@ void init_ui_from_config(){ } if(strcmp(values->hidden,"1")==0){ - + gtk_toggle_button_set_active((GtkToggleButton*) cb_hidden,TRUE); } + if(strcmp(values->no_haveged,"1")==0){ + + gtk_toggle_button_set_active((GtkToggleButton*) cb_no_haveged,TRUE); + } + if(strcmp(values->use_psk,"1")==0){ gtk_toggle_button_set_active((GtkToggleButton*) cb_psk,TRUE); @@ -826,6 +833,11 @@ static int init_config_val_input(ConfigValues* cv){ else cv->hidden =NULL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_no_haveged))) + cv->no_haveged = "1"; + + else + cv->no_haveged =NULL; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_novirt))) cv->no_virt = "1";