You are not logged in.

#1 2018-04-24 18:23:52

throbscottle
Member
Registered: 2011-11-05
Posts: 55

wpa_gui deletes some global options

Evening everybody, can anyone please help?

Using wpa_gui from AUR to add new networks to my wpa_supplicant.conf.

ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
ap_scan=1
fast_reauth=1
update_config=1
country=GB
network={
... some networks here....
}

The trouble is it deletes the lines:

ap_scan=1
fast_reauth=1

when I save. I've been copying the lines from a backup of the file and pasting them in again but it's PITA.

How can I stop this behaviour?

Offline

#2 2018-05-18 20:50:23

loh.tar
Member
Registered: 2010-10-17
Posts: 49

Re: wpa_gui deletes some global options

Good Evening too :-)

I fumble the last days also with this tool.

The config file is not written by wpa_gui but by wpa_supplicant. And it seems that wpa_supplicant give not so much about how the config file looks. It read the file as a whole
and write all what he thinks is useful back when triggered to do so. You can test this with

# echo "ap_scan=1" >> /etc/wpa_supplicant/wpa_supplicant-<foo>.conf  # sudo don't work, try ap_scan=1 and ap_scan=2
$ wpa_cli reconfigure
$ wpa_cli save_config
$ cat /etc/wpa_supplicant/wpa_supplicant-<foo>.conf

The two settings you are concerned about are defaults, and wpa_supplicant seems not to see a need for these to write.

Offline

#3 2018-05-18 21:08:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: wpa_gui deletes some global options

EDIT: sorry I really misread this thread, and I read the reply as if it was the first post.

Those example commands don't make much sense.  Wpa_cli is not the same as wpa_supplicant, they are different programs.  Wpa_supplicant does not change your config files. Wpa_cli can change your config file, that's it's entire purpose.

But wpa_cli would not change /etc/wpa_supplicant/wpa_supplicant-foo.conf unless you specify that as a parameter as the default config file is /etc/wpa_supplicant/wpa_supplicant.conf.  Further, wpa_cli will not run either of those commands as a normal user, those must be run as root.

Are you suggesting that wpa_gui just runs wpa_cli commands?

Last edited by Trilby (2018-05-18 21:11:07)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2018-05-18 22:34:38

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: wpa_gui deletes some global options

@Trilby: as far as I know, wpa_cli only sends commands to a wpa_supplicant via the control interface. wpa_supplicant itself then performs the requested action. wpa_gui does the same.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2018-05-18 23:53:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: wpa_gui deletes some global options

And which command would it send to overwrite the config?

There is a macro in the code called CONFIG_NO_CONFIG_WRITE for conditionally compiling in parts of the code that make changes to the wpa_supplicant config file.  That macro is used in wpa_cli.c, not in wpa_supplicant.c

Last edited by Trilby (2018-05-19 00:01:12)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2018-05-19 00:22:50

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: wpa_gui deletes some global options

wpa_cli sends the command "SAVE_CONFIG" to wpa_supplicant.
https://w1.fi/cgit/hostap/tree/wpa_supp … _2_6#n1534
wpa_gui does it as well:
https://w1.fi/cgit/hostap/tree/wpa_supp … _2_6#n1322

Here it is received and processed in the control interface code:
https://w1.fi/cgit/hostap/tree/wpa_supp … _2_6#n9158
https://w1.fi/cgit/hostap/tree/wpa_supp … 2_6#n10041

The purpose of wpa_cli is to control a running wpa_supplicant and change its parameters. Then the changes can be saved in the config file if you have enabled that with update_config=1. wpa_cli never reads the configuration files, it only interacts with the wpa_supplicant control socket. This is similar to nmcli for networkmanager or connmanctl for connman I believe.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2018-05-19 01:25:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: wpa_gui deletes some global options

Hmm, then this would look like a wpa_supplicant bug.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-05-19 01:48:30

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: wpa_gui deletes some global options

Trilby wrote:

Hmm, then this would look like a wpa_supplicant bug.

It is not really a bug. It doesn't matter if ap_scan=1 and fast_reauth=1 are explicitly set in the config. These are the default values and update_config only saves values that differ from the default to make the output shorter. Otherwise you'd get hundreds of lines of default values. Implementing logic to store if a default value should be written to the config probably adds too much complexity for a bit of config file cosmetics.

loh.tar wrote:

The two settings you are concerned about are defaults, and wpa_supplicant seems not to see a need for these to write.

https://w1.fi/cgit/hostap/tree/wpa_supp … _2_6#n1001

Last edited by progandy (2018-05-19 01:49:06)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2018-05-19 05:12:58

loh.tar
Member
Registered: 2010-10-17
Posts: 49

Re: wpa_gui deletes some global options

progandy wrote:
loh.tar wrote:

The two settings you are concerned about are defaults, and wpa_supplicant seems not to see a need for these to write.

Oops! little ugly typo. Would write: "..semms to see NO need for these to write"

Offline

#10 2018-05-19 10:31:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: wpa_gui deletes some global options

Ah, I seem to have misunderstood loh.tar's original point.  Although it's actually not due to the alleged typo: the way it was originally written seems perfectly grammatically valid to me.  The error was on the receiver end who was caught up with the oversimplification in the example commands - mostly because when I first read that post I thought it was the first post describing a problem where simplified command/examples wouldn't really be appropriate.

Sorry for my noise in the thread.  I concur, all seems as it should be.  I'd just never allow one of those tools to rewrite my config for me.

throbscottle, is the absence of those lines in your config file resulting in any problem?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2018-05-19 12:54:57

loh.tar
Member
Registered: 2010-10-17
Posts: 49

Re: wpa_gui deletes some global options

Thanks for your apologies Trilby, nice move :-) Fortunately progandy went by with his exquisite explanations before I could be scared beyond my beta-blocker skills. Thanks progandy!

Ähm, yeah, when I now read my original sentence it looks good again to me.

These complete rewrite of the config file surprised me too. I can't remember somewhere to read a note that these config file will complete rewritten in case of allowed updates by the setting of update_config=1. All the nice comments you can read in example configurations are gone then too.

Offline

Board footer

Powered by FluxBB