[pkg-wpa-devel] Re: Patch: Support for mapping scripts, e.g. guessnet

Kel Modderman kelrin at tpg.com.au
Fri Aug 4 23:09:41 UTC 2006


On Saturday 05 August 2006 06:59, Felix Homann wrote:
> Hi Kel,
>
> On Thursday 03 August 2006 23:32, Kel Modderman wrote:
> > Ok, maybe its time to investigate whether or not we can optionally use
> > guessnet somehow. It could allow further flexibility to the roaming
> > setup, but no idea how it can be done yet ;-)
>
> please take a look at the attached patch. It allows for calling mapping
> scripts from wpa_action. The syntax is very similar to ifupdowns mapping
> syntax.

Cool. I am going to check this out ASAP.

>
> A mapping script is specified by a line "wpa-mapping-script script-name".
>
> By default the mapping script will only be used if there's no logical
> interface matching the id_str, or if there's no id_str at all.

Excellent.

>
> If the mapping script should be used even if there's a matching
> id_str/iface pair you can do this by adding a line "wpa-script-priority 1".
> The whole "grep for matching LOGICAL interface stanza in interfaces file"
> step will be skipped then.

Fine.

>
> ifupdown would pass the contents of a "map" line to stdin of the mapping
> script. So do we with "wpa-map" lines. Unfortunately there can be only one
> wpa-map line, but you can even use wpa-map0...wpa-map20. So there can only
> be up to 21 wpa-map lines. This is due to the bracket expansion I've used.
> The number can easily be extended but maybe there's a better solution.


I think the bracket expansion depends on bash. But the idea is there, I am 
sure we can clean this up and implement it.


>
> Here's a snippet from /e/n/i illustrating its usage. In this example we use
> guessnet as the mapping script (the test lines are for guessnet):
>
> -----
> iface wlan inet manual
>         wpa-driver wext
>         wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
>         wpa-mapping-script guessnet-ifupdown
> #       wpa-script-priority 1
>         wpa-map logical1 logical2 default
>         wpa-map0 default: default
> #       wpa-map1 default: default
> #       wpa-map2 anything in a wpa-map line will be passed to stdin
> # 	  wpa-map20 	of the mapping script
>
> iface logical1 inet dhcp
> test peer address 192.168.1.1 mac 00:01:02:03:04:22
>
> iface logical2 inet dhcp
> test peer address 192.168.1.2 mac 00:01:02:03:04:22
>
> iface default inet dhcp
> -------

That looks quite excellent.

>
> I'm quite sure that the patch needs some polishing, it's a rather quick
> shot at the problem and I'm not the most talented programmer ;-)

I don't care, the idea and effort is what counts ;-) We probably share a 
similar level of programming skills.

>
> > Say, while you attention is this way Felix, would you mind having a read
> > of the doc thats being drafted?
>
> I've only taken a glimpse so far but I'm quite pleased. I'll have a deeper
> look at the weekend.

That would be most appreciated.

Thanks, Kel.



More information about the Pkg-wpa-devel mailing list