Subject: RE: /etc/ifconfig.foo enhancement
To: 'Jun-ichiro itojun Hagino' <itojun@iijlab.net>
From: David Woyciesjes <DAW@yalepress3.unipress.yale.edu>
List: tech-net
Date: 01/11/2001 10:45:35
I would definitly say it's worth a commit. Here's a possible use for it:
(keeping in mind I'm relatively new to NetBSD, so there might be a way to do
this already):

At work, I have a 100Base NIC in my laptop for connecting, with it's IP
info.
At home, the docking station for the laptop has a 3c509 NIC for connecting
with it's own (different) info. With the ! to call a command, I could set it
to automagically switch/change the gateway, hosts, and other IP info needed
for each network; via a little script file...

---   David A Woyciesjes
---   C & IS Support Specialist
---   Yale University Press
---   mailto:david.woyciesjes@yale.edu
---   (203) 432-0953
---   ICQ # - 905818


-> -----Original Message-----
-> From: Jun-ichiro itojun Hagino [mailto:itojun@iijlab.net]
-> Sent: Thursday, January 11, 2001 5:44 AM
-> To: tech-net@netbsd.org
-> Subject: /etc/ifconfig.foo enhancement
-> 
-> 
-> 	the attached patch will allow two things in /etc/ifconfig.*:
-> 	- allow comments started by "#"
-> 	- allow command invocation started by "!"
-> 
-> 	what is good about these?  comment is obvious.  "!" is good
-> 	as it will get invoked only when you have particular 
-> interface on
-> 	the system.  so, for example, if you use two pcmcia 
-> cards (like wi0
-> 	or an0) time to time, you can do something like this, 
-> and only either
-> 	of them (for the currently-inserted card) will get used:
-> 
-> 	ifconfig.wi0:
-> 		up
-> 		# autoconfigure IPv4
-> 		!dhclient $int
-> 		# autoconfigure IPv6
-> 		!rtsol $int
-> 
-> 	ifconfig.an0:
-> 		up
-> 		media auto
-> 		# setup IPv4 manually
-> 		inet 10.1.1.1
-> 		# autoconfigure IPv6
-> 		!rtsol $int
-> 
-> 	do people think it worth a commit, or do people think 
-> it too much?
-> 
-> 	(inspired by openbsd /etc/hostname.foo)
-> 
-> itojun
-> 
-> 
-> 
-> Index: rc.d/network
-> ===================================================================
-> RCS file: /cvsroot/basesrc/etc/rc.d/network,v
-> retrieving revision 1.28
-> diff -u -r1.28 network
-> --- rc.d/network	2001/01/03 17:54:05	1.28
-> +++ rc.d/network	2001/01/11 09:49:22
-> @@ -110,7 +110,16 @@
->  				echo -n " $int"
->  				while read args; do
->  					[ -z "$args" ] && continue
-> -					ifconfig $int $args
-> +					case "$args" in
-> +					"#"*)
-> +						;;
-> +					"!"*)
-> +						eval ${args#*!}
-> +						;;
-> +					*)
-> +						ifconfig $int $args
-> +						;;
-> +					esac
->  				done < /etc/ifconfig.$int
->  			else
->  				if ! checkyesno auto_ifconfig; then
->