Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Feb 2007 18:01:20 +0000
From:      Florent Thoumie <flz@FreeBSD.org>
To:        Norikatsu Shigemura <nork@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org, bug-followup@FreeBSD.org
Subject:   Re: conf/104884: Add support EtherChannel configuration to rc.conf
Message-ID:  <45CB6570.8020809@FreeBSD.org>
In-Reply-To: <20070208021810.6bc5ccb1.nork@FreeBSD.org>
References:  <200702051930.l15JUS8O064334@freefall.freebsd.org> <20070208021810.6bc5ccb1.nork@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigA2FD93C2FA429C281902AD54
Content-Type: multipart/mixed; boundary="------------070003080308050907030409"

This is a multi-part message in MIME format.
--------------070003080308050907030409
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Norikatsu Shigemura wrote:
> On Mon, 5 Feb 2007 19:30:28 GMT
> Florent Thoumie <flz@freebsd.org> wrote:
>>  I just noticed two other things.
>>  > +# fec_up ifn
>>              ^^^
>>  fec_up uses fec_interfaces, not $1, so this is wrong.
>>  > +# Configure Fast EtherChannel for interface $ifn. Returns 0 if FEC=

>>  > +# arguments were found and configured; returns 1 otherwise.
>>  fec_up is never called with an argument anyway at the moment. It
>>  wouldn't be hard to do: work on $1 or $fec_interfaces if $1 is empty.=
 I
>>  guess we could use both 'fec_up $ifn' and 'gif_up $ifn' in rc.d/netif=
=2E
>=20
> 	Yes.  This is ng_fec_create's comment.  I rewrote my patch.
> 	Please check following patch.
>=20
>>  The newly introduced variables also need to be documented in rc.conf.=
5.
>>  Could you please provide a patch for this?
>=20
> 	I made it, but please fix my broken English:-).
>=20
>>  I also noticed we don't have gif_down (hence no fec_down).
>=20
> 	I noticed.  But it's too hard how should we do.

I've rewritten the patch with the modifications we've discussed earlier
(set default to "" instead of "NO"). I think it's fine now, so this
version is likely to be the one that will hit the tree (in two or three
days unless someone thinks there's something wrong).

I guess a MFC delayed by 3 weeks will be ok. I'll include the "NO"
compatibility at that time.

--=20
Florent Thoumie
flz@FreeBSD.org
FreeBSD Committer

--------------070003080308050907030409
Content-Type: text/x-patch;
 name="patch-fec.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="patch-fec.diff"

Index: src/etc/defaults/rc.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.303
diff -u -r1.303 rc.conf
--- src/etc/defaults/rc.conf	20 Jan 2007 04:24:19 -0000	1.303
+++ src/etc/defaults/rc.conf	8 Feb 2007 17:57:13 -0000
@@ -178,11 +178,15 @@
 sppp_interfaces=3D""		# List of sppp interfaces.
 #sppp_interfaces=3D"isp0"		# example: sppp over ISDN
 #spppconfig_isp0=3D"authproto=3Dchap myauthname=3Dfoo myauthsecret=3D'to=
p secret' hisauthname=3Dsome-gw hisauthsecret=3D'another secret'"
-gif_interfaces=3D"NO"		# List of GIF tunnels (or "NO").
+gif_interfaces=3D""		# List of GIF tunnels.
 #gif_interfaces=3D"gif0 gif1"	# Examples typically for a router.
 				# Choose correct tunnel addrs.
 #gifconfig_gif0=3D"10.1.1.1 10.1.2.1"	# Examples typically for a router.=

 #gifconfig_gif1=3D"10.1.1.2 10.1.2.2"	# Examples typically for a router.=

+fec_interfaces=3D""		# List of Fast EtherChannels.
+#fec_interfaces=3D"fec0 fec1"
+#fecconfig_fec0=3D"fxp0 dc0"	# Examples typically for two NICs
+#fecconfig_fec1=3D"em0 em1 bge0 bge1"	# Examples typically for four NICs=

=20
 # User ppp configuration.
 ppp_enable=3D"NO"		# Start user-ppp (or NO).
Index: src/etc/rc.d/netif
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/etc/rc.d/netif,v
retrieving revision 1.21
diff -u -r1.21 netif
--- src/etc/rc.d/netif	30 Dec 2006 22:53:20 -0000	1.21
+++ src/etc/rc.d/netif	8 Feb 2007 17:57:13 -0000
@@ -57,6 +57,9 @@
 		# Create cloned interfaces
 		clone_up
=20
+		# Create Fast EtherChannel interfaces
+		fec_up
+
 		# Create IPv6<-->IPv4 tunnels
 		gif_up
=20
Index: src/etc/network.subr
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/etc/network.subr,v
retrieving revision 1.176
diff -u -r1.176 network.subr
--- src/etc/network.subr	29 Oct 2006 13:29:49 -0000	1.176
+++ src/etc/network.subr	8 Feb 2007 17:57:13 -0000
@@ -455,26 +455,82 @@
 	debug "Destroyed clones: ${_list}"
 }
=20
+# Create netgraph nodes.
+#
+ng_mkpeer() {
+	ngctl -f - 2> /dev/null <<EOF
+mkpeer $*
+msg dummy nodeinfo
+EOF
+}
+
+ng_create_one() {
+	ng_mkpeer $* | while read line; do
+		t=3D`expr "${line}" : '.* name=3D"\([a-z]*[0-9]*\)" .*'`
+		if [ -n "${t}" ]; then
+			echo ${t}
+			return
+		fi
+	done
+}
+
 gif_up() {
-	case ${gif_interfaces} in
-	[Nn][Oo] | '')
-		;;
-	*)
-		for i in ${gif_interfaces}; do
-			peers=3D`get_if_var $i gifconfig_IF`
-			case ${peers} in
+	for i in ${gif_interfaces}; do
+		peers=3D`get_if_var $i gifconfig_IF`
+		case ${peers} in
+		'')
+			continue
+			;;
+		*)
+			ifconfig $i create >/dev/null 2>&1
+			ifconfig $i tunnel ${peers}
+			ifconfig $i up
+			;;
+		esac
+	done
+}
+
+# ng_fec_create ifn
+# Configure Fast EtherChannel for interface $ifn. Returns 0 if FEC
+# arguments were found and configured; returns !0 otherwise.
+ng_fec_create() {
+	 local req_iface iface bogus
+	 req_iface=3D"$1"
+
+	 ngctl shutdown ${req_iface}: > /dev/null 2>&1
+
+	 bogus=3D""
+	 while true; do
+		 iface=3D`ng_create_one fec dummy fec`
+		 if [ -z "${iface}" ]; then
+			 exit 2
+		 fi
+		 if [ "${iface}" =3D "${req_iface}" ]; then
+			 echo ${iface}
+			 break
+		 fi
+		 bogus=3D"${bogus} ${iface}"
+	 done
+
+	 for iface in ${bogus}; do
+		 ngctl shutdown ${iface}:
+	 done
+}
+
+fec_up() {
+	for i in ${fec_interfaces}; do
+		ng_fec_create $i
+		for j in `get_if_var $i fecconfig_IF`; do
+			case ${j} in
 			'')
 				continue
 				;;
 			*)
-				ifconfig $i create >/dev/null 2>&1
-				ifconfig $i tunnel ${peers}
-				ifconfig $i up
+				ngctl msg ${i}: add_iface "\"${j}\""
 				;;
 			esac
 		done
-		;;
-	esac
+	done
 }
=20
 #
Index: src/share/man/man5/rc.conf.5
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.314
diff -u -r1.314 rc.conf.5
--- src/share/man/man5/rc.conf.5	24 Jan 2007 09:22:56 -0000	1.314
+++ src/share/man/man5/rc.conf.5	8 Feb 2007 17:57:13 -0000
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.314 2007/01/24 09:22:56 c=
eri Exp $
 .\"
-.Dd January 23, 2007
+.Dd February 8, 2007
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -1163,6 +1163,33 @@
 are automatically appended to
 .Va network_interfaces
 for configuration.
+.It Va fec_interfaces
+.Pq Vt str
+Set to the list of
+.Xr ng_fec 4
+Fast EtherChannel interfaces to configure on this host.
+A
+.Va fecconfig_ Ns Aq Ar interface
+variable is assumed to exist for each value of
+.Ar interface .
+The value of this variable is used to configure link aggregated interfac=
es
+according to the syntax of the
+.Cm NGM_FEC_ADD_IFACE
+to
+.Xr ngctl 8=20
+msg.
+Additionally, this option ensures that each listed interface is created
+via the
+.Cm mkpeer
+command to
+.Xr ngctl 8
+before attempting to configure it.
+For example:
+.Bd -literal
+fec_interfaces=3D"fec0"
+fecconfig_fec0=3D"em0 em1"
+ifconfig_fec0=3D"DHCP"
+.Ed
 .It Va gif_interfaces
 .Pq Vt str
 Set to the list of

--------------070003080308050907030409--

--------------enigA2FD93C2FA429C281902AD54
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFy2V1MxEkbVFH3PQRChnDAJ962eR82AKZl7fmw6XnAT4BOEGDmQCfTxkG
2o+c4NUuBbhYaOErrRA8hdk=
=GmK7
-----END PGP SIGNATURE-----

--------------enigA2FD93C2FA429C281902AD54--



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