Subject: Flexible interface selection
To: None <current-users@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: current-users
Date: 08/11/2001 18:30:14
I'm trying to find a clean way to express a feature I sort of want.  The
feature is this:  When my wireless card is plugged in, I want NetBSD to
use it.  When it's not, I want NetBSD to use the ethernet port.

What I currently have is the following in /etc/rc.conf:

case `ifconfig -l` in
*wi0*)  T=wi0;;
*)      T=tlp0;;
esac
eval "ifconfig_$T=\"inet 205.166.146.72 netmask 255.255.255.0\""

What I am thinking of is trying to make rc.d/network a little smarter,
so I could just write
ifconfig_path="wi0 tlp0"
ifconfig_if0="inet 205.166.146.72 netmask 255.255.255.0"

1.  Is this useful enough that anyone else would want it?
2.  If so, is there a better way to specify the interface?  My idea was
that if ifconfig_path was set, it would be used to specify the interfaces
to be used, and then the first one found would get "if0", the second would
get "if1", and so on.

I'm not proposing adding something where "ifconfig if0" does anything, just
a notation for rc.d/network to understand.

Good idea?  Bad idea?

-s