From dcf7dde14532f48c9adcdcea0805c4c998e25902 Mon Sep 17 00:00:00 2001 From: brooks Date: Wed, 19 Sep 2001 21:27:27 +0000 Subject: Add a new rc.conf variable, cloned_interfaces, to create cloned interfaces at boot. --- etc/defaults/rc.conf | 2 ++ etc/network.subr | 11 ++++++++++- etc/rc.d/netoptions | 11 ++++++++++- etc/rc.d/network1 | 11 ++++++++++- etc/rc.d/network2 | 11 ++++++++++- etc/rc.d/network3 | 11 ++++++++++- etc/rc.d/routing | 11 ++++++++++- etc/rc.network | 11 ++++++++++- share/man/man5/rc.conf.5 | 8 ++++++++ 9 files changed, 80 insertions(+), 7 deletions(-) diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 5310643..f703c8e 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -86,6 +86,8 @@ tcp_drop_synfin="NO" # Set to YES to drop TCP packets with SYN+FIN 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 gif1 gif2 gif3" # 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. diff --git a/etc/network.subr b/etc/network.subr index 2bf0b58..b715539 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index 2bf0b58..b715539 100644 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.d/network1 b/etc/rc.d/network1 index 2bf0b58..b715539 100644 --- a/etc/rc.d/network1 +++ b/etc/rc.d/network1 @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.d/network2 b/etc/rc.d/network2 index 2bf0b58..b715539 100644 --- a/etc/rc.d/network2 +++ b/etc/rc.d/network2 @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index 2bf0b58..b715539 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.d/routing b/etc/rc.d/routing index 2bf0b58..b715539 100644 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/etc/rc.network b/etc/rc.network index 2bf0b58..b715539 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -127,6 +127,11 @@ network_pass1() { ;; 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 @@ network_pass1() { [Aa][Uu][Tt][Oo]) network_interfaces="`ifconfig -l`" ;; + *) + network_interfaces="${network_interfaces} ${cloned_interfaces}" + ;; esac dhcp_interfaces="" @@ -795,7 +803,8 @@ network_gif_setup() { continue ;; *) - ifconfig $i create tunnel ${peers} + ifconfig $i create >/dev/null 2>&1 + ifconfig $i tunnel ${peers} ;; esac done diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index e34f12a..c813ae6 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -608,6 +608,14 @@ it is possible to use something like: .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 -- cgit v1.1