conf/104884: Add support EtherChannel configuration to rc.conf

Norikatsu Shigemura nork at FreeBSD.org
Sat Oct 28 16:10:20 UTC 2006


>Number:         104884
>Category:       conf
>Synopsis:       Add support EtherChannel configuration to rc.conf
>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:   Sat Oct 28 16:10:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Norikatsu Shigemura
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
Ensure Technology LTD.
>Environment:
System: FreeBSD melfina.ninth-nine.com 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #32: Sun Oct 22 05:57:55 JST 2006 nork at melfina.ninth-nine.com:/usr/obj/usr/src/sys/MELFINA i386

>Description:
	Add support EtherChannel configuration to rc startup script.

	How to use it:
	/etc/rc.conf  - - - - - - - - - - - - - - - - - - - - - - - - - - -
	fec_interfaces="fec0"
	fecconfig_fec0="fxp0 fxp1"
	ifconfig_fec0="DHCP"
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	And reboot the machine.

>How-To-Repeat:
	None.

>Fix:
	Obtained from:	net/dtcpclient
	Thanks:		ume

	I tested with Cisco Catalyst 2940 and FreeBSD 6.2-PRERELEASE.

--- fecconfig.diff begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	DIFF.etc-defaults-rc.conf
#	DIFF.etc-network.subr
#	DIFF.etc-rc.d-netif
#
echo x - DIFF.etc-defaults-rc.conf
sed 's/^X//' >DIFF.etc-defaults-rc.conf << 'END-of-DIFF.etc-defaults-rc.conf'
X--- etc/defaults/rc.conf.orig	Mon Oct 16 13:32:35 2006
X+++ etc/defaults/rc.conf	Tue Oct 24 22:52:02 2006
X@@ -178,6 +178,10 @@
X 				# Choose correct tunnel addrs.
X #gifconfig_gif0="10.1.1.1 10.1.2.1"	# Examples typically for a router.
X #gifconfig_gif1="10.1.1.2 10.1.2.2"	# Examples typically for a router.
X+fec_interfaces="NO"		# List of Fast EtherChannels (or "NO")
X+#fec_interfaces="fec0 fec1"
X+#fecconfig_fec0="fxp0 dc0"	# Examples typically for two NICs
X+#fecconfig_fec1="em0 em1 bge0 bge1"	# Examples typically for four NICs
X 
X # User ppp configuration.
X ppp_enable="NO"		# Start user-ppp (or NO).
END-of-DIFF.etc-defaults-rc.conf
echo x - DIFF.etc-network.subr
sed 's/^X//' >DIFF.etc-network.subr << 'END-of-DIFF.etc-network.subr'
X--- etc/network.subr.orig	Thu Oct 12 01:16:37 2006
X+++ etc/network.subr	Tue Oct 24 22:50:41 2006
X@@ -907,3 +907,78 @@
X 		esac
X 	done
X }
X+
X+ng_mkpeer() {
X+	ngctl -f - 2> /dev/null <<EOF
X+mkpeer $*
X+msg dummy nodeinfo
X+EOF
X+}
X+
X+ng_create_one() {
X+	ng_mkpeer $* | while read line; do
X+		t=`expr "${line}" : '.* name="\([a-z]*[0-9]*\)" .*'`
X+		if [ -n "${t}" ]; then
X+			echo ${t}
X+			return
X+		fi
X+	done
X+}
X+
X+ng_fec_create() {
X+	 local req_iface iface bogus
X+	 req_iface="$1"
X+
X+	 if [ -z "${req_iface}" ]; then
X+		 iface=`ng_create_one fec dummy fec`
X+		 if [ -z "${iface}" ]; then
X+			 exit 2
X+		 fi
X+		 echo ${iface}
X+		 return
X+	 fi
X+
X+	 ngctl shutdown ${req_iface}: > /dev/null 2>&1
X+
X+	 bogus=""
X+	 while true; do
X+		 iface=`ng_create_one fec dummy fec`
X+		 if [ -z "${iface}" ]; then
X+			 exit 2
X+		 fi
X+		 if [ "${iface}" = "${req_iface}" ]; then
X+			 echo ${iface}
X+			 break
X+		 fi
X+		 bogus="${bogus} ${iface}"
X+	 done
X+
X+	 for iface in ${bogus}; do
X+		 ngctl shutdown ${iface}:
X+	 done
X+}
X+
X+# fec_up ifn
X+# Configure Fast EtherChannel for interface $ifn. Returns 0 if FEC
X+# arguments were found and configured; returns 1 otherwise.
X+fec_up() {
X+	case ${fec_interfaces} in
X+	[Nn][Oo] | '')
X+		;;
X+	*)
X+		for i in ${fec_interfaces}; do
X+			ng_fec_create $i
X+			for j in `get_if_var $i fecconfig_IF`; do
X+				case ${j} in
X+				'')
X+					continue
X+					;;
X+				*)
X+					ngctl msg ${i}: add_iface "\"${j}\""
X+					;;
X+				esac
X+			done
X+		done
X+		;;
X+	esac
X+}
END-of-DIFF.etc-network.subr
echo x - DIFF.etc-rc.d-netif
sed 's/^X//' >DIFF.etc-rc.d-netif << 'END-of-DIFF.etc-rc.d-netif'
X--- etc/rc.d/netif.orig	Tue Jul 25 05:46:14 2006
X+++ etc/rc.d/netif	Tue Oct 24 22:53:00 2006
X@@ -57,6 +57,9 @@
X 		# Create cloned interfaces
X 		clone_up
X 
X+		# Create Fast EtherChannel interfaces
X+		fec_up
X+
X 		# Create IPv6<-->IPv4 tunnels
X 		gif_up
X 
END-of-DIFF.etc-rc.d-netif
exit
--- fecconfig.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list