Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2001 20:02:21 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        net@freebsd.org, arch@freebsd.org
Subject:   review request: creating cloneable interfaces at boot
Message-ID:  <20010913200221.A11788@Odin.AC.HMC.Edu>

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

[-- Attachment #1 --]
I'd like to commit something like the following patch to create clonable
interfaces at boot so they can be configured the normal way.  Any one
have comments or suggestions?

-- Brooks

Index: etc/rc.network
===================================================================
RCS file: /usr/cvs/src/etc/rc.network,v
retrieving revision 1.102
diff -u -r1.102 rc.network
--- etc/rc.network	30 Jul 2001 23:12:02 -0000	1.102
+++ etc/rc.network	14 Sep 2001 02:54:15 -0000
@@ -127,6 +127,11 @@
 		;;
 	esac
 
+	# Attempt to create cloned interfaces.
+	for ifn in ${cloned_interfaces}; do
+		ifconfig ${ifn} create
+	done
+
 	# Special options for sppp(4) interfaces go here.  These need
 	# to go _before_ the general ifconfig section, since in the case
 	# of hardwired (no link1 flag) but required authentication, you
@@ -151,6 +156,9 @@
 	[Aa][Uu][Tt][Oo])
 		network_interfaces="`ifconfig -l`"
 		;;
+	*)
+		network_interfaces="${network_interfaces} ${cloned_interfaces}"
+		;;
 	esac
 
 	dhcp_interfaces=""
@@ -796,7 +804,8 @@
 				continue
 				;;
 			*)
-				ifconfig $i create tunnel ${peers}
+				ifconfig $i create >/dev/null 2>&1
+				ifconfig $i tunnel ${peers}
 				;;
 			esac
 		done
Index: etc/defaults/rc.conf
===================================================================
RCS file: /usr/cvs/src/etc/defaults/rc.conf,v
retrieving revision 1.122
diff -u -r1.122 rc.conf
--- etc/defaults/rc.conf	2 Sep 2001 23:34:19 -0000	1.122
+++ etc/defaults/rc.conf	12 Sep 2001 20:54:50 -0000
@@ -85,6 +85,8 @@
 icmp_drop_redirect="NO"		# Set to YES to ignore ICMP REDIRECT packets
 icmp_log_redirect="NO"		# Set to YES to log ICMP REDIRECT packets
 network_interfaces="auto"	# List of network interfaces (or "auto").
+cloned_interfaces=""		# List of cloned network interfaces to create.
+#cloned_interfaces="gif0"	# Restore pre-cloning GENERIC config.
 ifconfig_lo0="inet 127.0.0.1"	# default loopback device configuration.
 #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 #ifconfig_ed0_ipx="ipx 0x00010010"	# Sample IPX address family entry.
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /usr/cvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.133
diff -u -r1.133 rc.conf.5
--- share/man/man5/rc.conf.5	29 Aug 2001 05:39:06 -0000	1.133
+++ share/man/man5/rc.conf.5	14 Sep 2001 02:45:31 -0000
@@ -598,6 +598,14 @@
 .Bd -literal
 ifconfig_ed0="DHCP"
 .Ed
+.It Va cloned_interfaces
+.Pq Vt str
+Set to the list of clonable network interfaces to create on this host.
+Entries in
+.Va cloned_interfaces
+are automaticly appended to
+.Va network_interfaces
+for configuration.
 .It Va ppp_enable
 .Pq Vt bool
 If set to

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7oXM7XY6L6fI4GtQRAjUyAJ4oaqm5nzuq8eOHng6zbeis6CwhjgCdH2aY
phfrNOAdiB/5ZqufZKqG1Bg=
=fyDE
-----END PGP SIGNATURE-----

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