Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Nov 1999 17:14:34 GMT
From:      hibma@skylink.it
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   conf/14810: [PATCH] initialising multiple interfaces through DHCP does not work
Message-ID:  <199911091714.RAA02566@heidi.plazza.it>

next in thread | raw e-mail | index | archive | help

>Number:         14810
>Category:       conf
>Synopsis:       [PATCH] initialising multiple interfaces through DHCP does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 10 02:40:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Nick Hibma
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

FreeBSD hare 4.0-CURRENT FreeBSD 4.0-CURRENT #7: Tue Nov  9 17:58:56 CET 1999     toor@henny:/usr/src/sys/compile/HARE  i386


>Description:

In my configuration I have two ethernet interfaces that I would like to
configure through DHCP. In rc.conf:

	ifconfig_ed1="DHCP"
	ifconfig_wb0="DHCP"

This does not work for the second interface as dhclient bails out on the
fact that port 68 is already taken (by dhclient started for the first
interface).

>How-To-Repeat:

	Add a second (bogus possibly) network interface to your rc.conf

>Fix:
	
Instead of starting a dhclient for each interface, start on for all of them at
the same time.

--- /etc/rc.network.orig	Tue Nov  9 17:01:34 1999
+++ /etc/rc.network	Tue Nov  9 18:04:12 1999
@@ -77,11 +77,11 @@
 		;;
 	esac
 
+	dhcp_interfaces=""
 	for ifn in ${network_interfaces}; do
-		showstat=false
 		if [ -r /etc/start_if.${ifn} ]; then
 			. /etc/start_if.${ifn}
-			showstat=true
+			eval showstat_$ifn=1
 		fi
 
 		# Do the primary ifconfig if specified
@@ -92,15 +92,22 @@
 		'')
 			;;
 		[Dd][Hh][Cc][Pp])
-			${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${ifn}
-			showstat=true
+			# DHCP inits are done all in one go below
+			dhcp_interfaces="$dhcp_interfaces $ifn"
+			eval showstat_$ifn=1
 			;;
 		*)
 			ifconfig ${ifn} ${ifconfig_args}
-			showstat=true
+			eval showstat_$ifn=1
 			;;
 		esac
+	done
+
+	if [ ! -z "${dhcp_interfaces}" ]; then
+		${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces}
+	fi
 
+	for ifn in ${network_interfaces}; do
 		# Check to see if aliases need to be added
 		#
 		alias=0
@@ -108,7 +115,7 @@
 			eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
 			if [ -n "${ifconfig_args}" ]; then
 				ifconfig ${ifn} ${ifconfig_args} alias
-				showstat=true
+				eval showstat_$ifn=1
 				alias=`expr ${alias} + 1`
 			else
 				break;
@@ -120,14 +127,15 @@
 		eval ifconfig_args=\$ifconfig_${ifn}_ipx
 		if [ -n "${ifconfig_args}" ]; then
 			ifconfig ${ifn} ${ifconfig_args}
-			showstat=true
+			eval showstat_$ifn=1
 		fi
+	done
 
-		case ${showstat} in
-		true)
+	for ifn in ${network_interfaces}; do
+		eval showstat=\$showstat_${ifn}
+		if [ ! -z ${showstat} ]; then
 			ifconfig ${ifn}
-			;;
-		esac
+		fi
 	done
 
 	# Warm up user ppp if required, must happen before natd.


And the uuencoded version (to maintain overlong lines):

begin 644 rc.network.diff
M+2TM("]E=&,O<F,N;F5T=V]R:RYO<FEG"51U92!.;W8@(#D@,3<Z,#$Z,S0@
M,3DY.0HK*RL@+V5T8R]R8RYN971W;W)K"51U92!.;W8@(#D@,3@Z,#0Z,3(@
M,3DY.0I`0"`M-S<L,3$@*S<W+#$Q($!`"B`)"3L["B`)97-A8PH@"BL)9&AC
M<%]I;G1E<F9A8V5S/2(B"B`)9F]R(&EF;B!I;B`D>VYE='=O<FM?:6YT97)F
M86-E<WT[(&1O"BT)"7-H;W=S=&%T/69A;'-E"B`)"6EF(%L@+7(@+V5T8R]S
M=&%R=%]I9BXD>VEF;GT@73L@=&AE;@H@"0D)+B`O971C+W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&AE;@H@"0D)"6EF8V]N9FEG("1[:69N
M?2`D>VEF8V]N9FEG7V%R9W-](&%L:6%S"BT)"0D)<VAO=W-T870]=')U90HK
M"0D)"65V86P@<VAO=W-T871?)&EF;CTQ"B`)"0D)86QI87,]8&5X<'(@)'MA
M;&EA<WT@*R`Q8`H@"0D)96QS90H@"0D)"6)R96%K.PI`0"`M,3(P+#$T("LQ
M,C<L,34@0$`*(`D)979A;"!I9F-O;F9I9U]A<F=S/5PD:69C;VYF:6=?)'MI
M9FY]7VEP>`H@"0EI9B!;("UN("(D>VEF8V]N9FEG7V%R9W-](B!=.R!T:&5N
M"B`)"0EI9F-O;F9I9R`D>VEF;GT@)'MI9F-O;F9I9U]A<F=S?0HM"0D)<VAO
M=W-T870]=')U90HK"0D)979A;"!S:&]W<W1A=%\D:69N/3$*(`D)9FD**PED
M;VYE"B`*+0D)8V%S92`D>W-H;W=S=&%T?2!I;@HM"0ET<G5E*0HK"69O<B!I
M9FX@:6X@)'MN971W;W)K7VEN=&5R9F%C97-].R!D;PHK"0EE=F%L('-H;W=S
M=&%T/5PD<VAO=W-T871?)'MI9FY]"BL)"6EF(%L@(2`M>B`D>W-H;W=S=&%T
M?2!=.R!T:&5N"B`)"0EI9F-O;F9I9R`D>VEF;GT*+0D)"3L["BT)"65S86,*
M*PD)9FD*(`ED;VYE"B`*(`DC(%=A<FT@=7`@=7-E<B!P<'`@:68@<F5Q=6ER
=960L(&UU<W0@:&%P<&5N(&)E9F]R92!N871D+@IE
`
end


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911091714.RAA02566>