wifi profiles in hostname.if

2015-09-26 Thread Chris Lobkowicz
Good day, I am curious if there is the possibility of adding/using multiple
profiles or network entries, much like ~/.ssh/config ?

eg:

In /etc/hostname.iwn0

nwid primary
wpakey key
dhcp

​nwid ​secondary
wpakey key
dhcp


Is this possible? I would imagine that wrapping some sort of
identifiers/formatting around the network information would be required,
much like the ssh/config parameters.

Net primary {
  nwid primary
  wpakey key
  dhcp
}
Net secondary {
  nwid secondary
  wpakey key
  dhcp
}


The manpage of hostname.if(5) does not specifically mention/allow for this.



My work-around for this is to have all my locations/ap's use the same nwid
where possible. And where not, just use # comments in my hostname.if files
and just manually edit the appropriate entries in/out, and rerun
/etc/netstart.

Is it possible to bake this in, rather than going down the wpa_supplicant
path as others have done? Or am I getting my hopes up for the sake of being
lazy?

Thanks
Chris



Re: wifi profiles in hostname.if

2015-09-26 Thread Marc Peters
On 09/26/15 15:44, Chris Lobkowicz wrote:
> Good day, I am curious if there is the possibility of adding/using multiple
> profiles or network entries, much like ~/.ssh/config ?
> 

I use the scripts provided by afresh1@. They're available at
https://gist.github.com/afresh1/7149844


Marc

> eg:
> 
> In /etc/hostname.iwn0
> 
> nwid primary
> wpakey key
> dhcp
> 
> ​nwid ​secondary
> wpakey key
> dhcp
> 
> 
> Is this possible? I would imagine that wrapping some sort of
> identifiers/formatting around the network information would be required,
> much like the ssh/config parameters.
> 
> Net primary {
>   nwid primary
>   wpakey key
>   dhcp
> }
> Net secondary {
>   nwid secondary
>   wpakey key
>   dhcp
> }
> 
> 
> The manpage of hostname.if(5) does not specifically mention/allow for this.
> 
> 
> 
> My work-around for this is to have all my locations/ap's use the same nwid
> where possible. And where not, just use # comments in my hostname.if files
> and just manually edit the appropriate entries in/out, and rerun
> /etc/netstart.
> 
> Is it possible to bake this in, rather than going down the wpa_supplicant
> path as others have done? Or am I getting my hopes up for the sake of being
> lazy?
> 
> Thanks
> Chris



Re: wifi profiles in hostname.if

2015-09-26 Thread Steve Dee
On Sat, Sep 26, 2015 at 10:00 AM Stefan Sperling  wrote:

> On Sat, Sep 26, 2015 at 07:44:45AM -0600, Chris Lobkowicz wrote:
> > Good day, I am curious if there is the possibility of adding/using
> multiple
> > profiles or network entries, much like ~/.ssh/config ?
> >
> > eg:
> >
> > In /etc/hostname.iwn0
> >
> > nwid primary
> > wpakey key
> > dhcp
> >
> > ???nwid ???secondary
> > wpakey key
> > dhcp
> >
> >
> > Is this possible? I would imagine that wrapping some sort of
> > identifiers/formatting around the network information would be required,
> > much like the ssh/config parameters.
> >
> > Net primary {
> >   nwid primary
> >   wpakey key
> >   dhcp
> > }
> > Net secondary {
> >   nwid secondary
> >   wpakey key
> >   dhcp
> > }
> >
> >
> > The manpage of hostname.if(5) does not specifically mention/allow for
> this.
> >
> >
> >
> > My work-around for this is to have all my locations/ap's use the same
> nwid
> > where possible. And where not, just use # comments in my hostname.if
> files
> > and just manually edit the appropriate entries in/out, and rerun
> > /etc/netstart.
> >
> > Is it possible to bake this in, rather than going down the wpa_supplicant
> > path as others have done? Or am I getting my hopes up for the sake of
> being
> > lazy?
> >
> > Thanks
> > Chris
>
> Various people have written various scripts.
>

My own solution for this is here:

https://github.com/mrdomino/autonet

It relies on a config.h mapping bssids / nwids to filenames in a
/etc/hostname.d directory. So you just write each config in a file like
/etc/hostname.d/., and autonet picks one to symlink to
/etc/hostname. based on the results of a scan, then defers to
netstart to bring up the network.

I've been using this daily since February. By now I've ironed out most bugs
in autonet proper, although netpref-new could still use a bit of polish.
I'd love to have more users to catch more edge cases.

I have a call to autonet in /etc/apm/resume, and another in /etc/rc (a
patch for the latter comes with the repo). I only ever have to run it
manually when I'm adding a new network.



> There is no built-in solution yet. Ideally, the wireless layer itself
> would provide some help with supporting this. E.g. via support for
> roaming, remembering networks that have been used, or other useful
> features. But at present it does not. From my point of view we don't
> have a very clear plan yet. There are various ideas floating around,
> though.
>

I'd be into something like that! That said, I think it's really awesome
that autonet is even possible on OpenBSD -- I believe that the equivalent
program in, say, Linux would be significantly more complicated.


> BTW this discussion comes up at +/- every hackathon I'm attending.
> It's not just you ;-)



Re: wifi profiles in hostname.if

2015-09-26 Thread Stefan Sperling
On Sat, Sep 26, 2015 at 07:44:45AM -0600, Chris Lobkowicz wrote:
> Good day, I am curious if there is the possibility of adding/using multiple
> profiles or network entries, much like ~/.ssh/config ?
> 
> eg:
> 
> In /etc/hostname.iwn0
> 
> nwid primary
> wpakey key
> dhcp
> 
> ???nwid ???secondary
> wpakey key
> dhcp
> 
> 
> Is this possible? I would imagine that wrapping some sort of
> identifiers/formatting around the network information would be required,
> much like the ssh/config parameters.
> 
> Net primary {
>   nwid primary
>   wpakey key
>   dhcp
> }
> Net secondary {
>   nwid secondary
>   wpakey key
>   dhcp
> }
> 
> 
> The manpage of hostname.if(5) does not specifically mention/allow for this.
> 
> 
> 
> My work-around for this is to have all my locations/ap's use the same nwid
> where possible. And where not, just use # comments in my hostname.if files
> and just manually edit the appropriate entries in/out, and rerun
> /etc/netstart.
> 
> Is it possible to bake this in, rather than going down the wpa_supplicant
> path as others have done? Or am I getting my hopes up for the sake of being
> lazy?
> 
> Thanks
> Chris

Various people have written various scripts.

There is no built-in solution yet. Ideally, the wireless layer itself
would provide some help with supporting this. E.g. via support for
roaming, remembering networks that have been used, or other useful
features. But at present it does not. From my point of view we don't
have a very clear plan yet. There are various ideas floating around,
though.

BTW this discussion comes up at +/- every hackathon I'm attending.
It's not just you ;-)