Bug 30441

Summary: Can't set interface arguments for dhcp configured interfaces
Product: Base System Reporter: neil
Component: confAssignee: Doug Barton <dougb>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   

Description neil 2001-09-08 23:10:00 UTC
/etc/rc.network groups interfaces marked "dhcp" and starts
the dhcp-program for them. It doesn't process any additional arguments that
have been passed on the ifconfig_* line of /etc/rc.conf e.g. media.

Fix: 

/etc/rc.network should have some means of parsing interface
arguments/options for dhcp configured interfaces
How-To-Repeat: ifconfig_rl0="dhcp media 10baseT/UTP"
Comment 1 nbliss 2002-05-08 19:59:56 UTC
Hey folks,

I just ran into this problem, and here's my proposed fix for it.  Feel free to
incorporate it, or not. =)

Index: rc.network
===================================================================
RCS file: /home/ncvs/src/etc/rc.network,v
retrieving revision 1.134
diff -c -r1.134 rc.network
*** rc.network  2002/04/11 22:06:27     1.134
--- rc.network  2002/05/08 19:01:20
***************
*** 211,219 ****
                case ${ifconfig_args} in
                '')
                        ;;
!               [Dd][Hh][Cc][Pp])
                        # DHCP inits are done all in one go below
                        dhcp_interfaces="$dhcp_interfaces $ifn"
                        eval showstat_$ifn=1
                        ;;
                *)
--- 211,225 ----
                case ${ifconfig_args} in
                '')
                        ;;
!               [Dd][Hh][Cc][Pp])
                        # DHCP inits are done all in one go below
                        dhcp_interfaces="$dhcp_interfaces $ifn"
                        eval showstat_$ifn=1
                        ;;
                *)
--- 211,225 ----
                case ${ifconfig_args} in
                '')
                        ;;
!               *[Dd][Hh][Cc][Pp]*)
                        # DHCP inits are done all in one go below
                        dhcp_interfaces="$dhcp_interfaces $ifn"
+                       # eat the DHCP token, and apply any other args.
+                       ifconfig_args=`echo $ifconfig_args \
+                               | sed s/[Dd][Hh][Cc][Pp]//`
+                       if [ -n "${ifconfig_args}" ]; then
+                               ifconfig ${ifn} ${ifconfig_args}
+                       fi
                        eval showstat_$ifn=1
                        ;;
                *)


later,

Neil

-- 
Neil Bliss - Monta Vista Technical Support
Yow!-Zippy-says: I once decorated my apartment entirely in ten foot salad forks!!
Comment 2 iedowse 2002-05-13 19:25:31 UTC
In message <20020513091319.G7743@dhcp117.mvista.com>, Neil Bliss writes:
>Actually, it's not anything to do with the dhcp client.  What you're needing to
>be able to do here is to be able to pass any additional ifconfig arguments that
>the card will need to be able to be used.  In my particular case, I'm using a 
>wireless ethernet card, and I need to give it the correct ssid for it to get
>signal at ifconfig time.  With the current setup, if I'd like this interface to
>use dhcp, then that's the *only* thing you can tell rc.network about this card.

dhclient.conf is actually a much more useful place to put such
commands, because dhclient can automatically cycle through different
combinations of ifconfig settings, picking the first one on which
it successfully gets a lease (thanks to Kurt Lidl for pointing this
out to me a while ago). For example, I use something like this:

	interface "wi0" {
		media
			"wepmode on wepkey 0x0000000000",
			"wepmode on wepkey 0x1111111111",
			"wepmode off";
	}

You can list the settings for any networks you use, and then plugging
in the card just works where ever you are.

Ian
Comment 3 Crist J. Clark freebsd_committer freebsd_triage 2002-05-14 07:34:27 UTC
State Changed
From-To: open->feedback

I think Ian's example (which was added to the audit trail) more 
clearly illustrates the point I was trying to make. If you use DHCP to 
configure your interface, you should use DHCP to configure your 
interface. The right place for additional interface configuration is 
dhclient.conf(5) not rc.conf(5). 

Is there some interface configuration that you still cannot accomplish 
through dhclient.conf(5)?
Comment 4 Doug Barton freebsd_committer freebsd_triage 2003-02-02 12:48:26 UTC
State Changed
From-To: feedback->closed


dhclient.conf is the proper place to handle this. 


Comment 5 Doug Barton freebsd_committer freebsd_triage 2003-02-02 12:48:26 UTC
Responsible Changed
From-To: freebsd-bugs->dougb


I closed this one.