:: Re: [DNG] wpa_supplicant/ifup integ…
Pàgina inicial
Delete this message
Reply to this message
Autor: Isaac Dunham
Data:  
A: Didier Kryn
CC: dng
Assumpte: Re: [DNG] wpa_supplicant/ifup integration documentation
On Thu, Aug 27, 2015 at 10:29:31AM +0200, Didier Kryn wrote:
> Le 25/08/2015 03:40, Isaac Dunham a ??crit :
> >For your perusal, here's an overview of how they work together; it's a 100+
> >line summary.
> >If anyone wants more details, here are some sources:
> >Manual pages:
> >interfaces(5), wpa_supplicant.conf(5), wpa_supplicant(8), wpa_cli(8),
> >wpa_action(8).
> >Scripts:
> >/sbin/wpa_action
> >/etc/network/if-*.d/wpasupplicant
> >/etc/wpa_supplicant/*.sh
> >(/etc/wpa_supplicant/functions.sh is going to be needed if you want a
> >low-level understanding of what's going on; the script authors have an
> >exceptional capacity for indirection.)
>
> >You will need to read the scripts for a practical understanding of how
> >it works, but the interfaces, wpa_cli, and wpa_action manpages are rather
> >helpful for understanding the glue.
>
>     Thanks, Isaac, I had made my best to RTFM :-) but what I couldn't find
> is how the line wpa_roam ... is passed to the script.


Did you look at the summary I attached?

>     Here is the idea I got from looking at the scripts. Any line following
> the iface line is interpreted by ifup in the following way before invoking
> all the scripts:

>
>     The first token in the line is capitallized and prefixed with "IF_",
> then, an environment variable with this name is created and its  value is
> the rest of the line. Each line following the iface line is treated like
> this and all the scripts can then check the enviroment variables. This is


Correct.
man 5 interfaces, IFACE OPTIONS (just over INET ADDRESS FAMILY):
       Additionally,  all  options given in an interface definition stanza are
       exported to the environment in upper case with "IF_" prepended and with
       hyphens  converted  to underscores and non-alphanumeric characters dis-
       carded.


> not the whole story though, since I remember it is also possible to put
> command lines -- I did it a few years ago to configure bonding interfaces.


In man 5 interfaces, IFACE OPTIONS, at the top, see the descriptions of
pre-up, up, post-up, pre-down, down, and post-down options.

These, as well as scripts in /etc/network/if-*.d, are run directly by ifup.

>     Therefore, asserting all this is still on my todo list, and maybe the
> only way is to look at the source of ifup, althoug I would have preferred a
> more authoritative description. For now, my feeling is still that it makes
> little sense to set up a parallel framework when what is missing is only a
> tinier version of wpa_gui, and maybe first a curses version.


wpa_config is supposed to be that curses version, though I'm sure it's
a long way off.
I could make something similar to wpa_config but using wpa_cli more
rather than writing a config file; *however*, this would be harder to
edit and would lose comments if you make the changes permanent.

Anyhow, ifup/wpa_supplicant integration features two paths:
-roaming/user-specified config file, as shown in wpa_action(8)
Here, you have two files: interfaces and wpa_supplicant.conf
wpa_config (but not the rest of wpanet) works with this method,
and might eventually be enhanced for static configuration via this
method.

-configuration in /etc/network/interfaces
 Here, you specify
    ...
    wpa-ssid mynetwork
    wpa-psk  "topsecret"
 in the configuration for a logical interface.
 Presumably, one *could* parse 
 iwlist IFACE scanning
 in a mapping script, though it's a brittle approach.


Edward and tilt! seem to be working on a tool that simply writes
a new interfaces file for the second approach.
wpanet is a knockoff of the first, originally intended for Busybox-based
systems.

HTH,
Isaac Dunham