Add support for EtherChannel configuration to rc startup scripts.
Note: This also deprecates "NO" as a way to specify an empty list of interfaces for gif_interfaces. PR: conf/104884 Submitted by: nork Harassed by: brd Discussed with: brooks, dougb
This commit is contained in:
parent
1b58411365
commit
2d69b43eb2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166583
@ -178,11 +178,15 @@ ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
|
|||||||
sppp_interfaces="" # List of sppp interfaces.
|
sppp_interfaces="" # List of sppp interfaces.
|
||||||
#sppp_interfaces="isp0" # example: sppp over ISDN
|
#sppp_interfaces="isp0" # example: sppp over ISDN
|
||||||
#spppconfig_isp0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'"
|
#spppconfig_isp0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'"
|
||||||
gif_interfaces="NO" # List of GIF tunnels (or "NO").
|
gif_interfaces="" # List of GIF tunnels.
|
||||||
#gif_interfaces="gif0 gif1" # Examples typically for a router.
|
#gif_interfaces="gif0 gif1" # Examples typically for a router.
|
||||||
# Choose correct tunnel addrs.
|
# Choose correct tunnel addrs.
|
||||||
#gifconfig_gif0="10.1.1.1 10.1.2.1" # Examples typically for a router.
|
#gifconfig_gif0="10.1.1.1 10.1.2.1" # Examples typically for a router.
|
||||||
#gifconfig_gif1="10.1.1.2 10.1.2.2" # Examples typically for a router.
|
#gifconfig_gif1="10.1.1.2 10.1.2.2" # Examples typically for a router.
|
||||||
|
fec_interfaces="" # List of Fast EtherChannels.
|
||||||
|
#fec_interfaces="fec0 fec1"
|
||||||
|
#fecconfig_fec0="fxp0 dc0" # Examples typically for two NICs
|
||||||
|
#fecconfig_fec1="em0 em1 bge0 bge1" # Examples typically for four NICs
|
||||||
|
|
||||||
# User ppp configuration.
|
# User ppp configuration.
|
||||||
ppp_enable="NO" # Start user-ppp (or NO).
|
ppp_enable="NO" # Start user-ppp (or NO).
|
||||||
|
@ -455,26 +455,89 @@ clone_down()
|
|||||||
debug "Destroyed clones: ${_list}"
|
debug "Destroyed clones: ${_list}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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=`expr "${line}" : '.* name="\([a-z]*[0-9]*\)" .*'`
|
||||||
|
if [ -n "${t}" ]; then
|
||||||
|
echo ${t}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
gif_up() {
|
gif_up() {
|
||||||
|
# The following must be removed once RELENG_7 is branched.
|
||||||
case ${gif_interfaces} in
|
case ${gif_interfaces} in
|
||||||
[Nn][Oo] | '')
|
[Nn][Oo])
|
||||||
|
warn "gif_interfaces=\"NO\" is deprecated, use gif_interfaces=\"\" instead."
|
||||||
|
gif_interfaces=""
|
||||||
;;
|
;;
|
||||||
*)
|
esac
|
||||||
for i in ${gif_interfaces}; do
|
|
||||||
peers=`get_if_var $i gifconfig_IF`
|
for i in ${gif_interfaces}; do
|
||||||
case ${peers} in
|
peers=`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="$1"
|
||||||
|
|
||||||
|
ngctl shutdown ${req_iface}: > /dev/null 2>&1
|
||||||
|
|
||||||
|
bogus=""
|
||||||
|
while true; do
|
||||||
|
iface=`ng_create_one fec dummy fec`
|
||||||
|
if [ -z "${iface}" ]; then
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
if [ "${iface}" = "${req_iface}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
bogus="${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
|
continue
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ifconfig $i create >/dev/null 2>&1
|
ngctl msg ${i}: add_iface "\"${j}\""
|
||||||
ifconfig $i tunnel ${peers}
|
|
||||||
ifconfig $i up
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
done
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -57,6 +57,9 @@ network_start()
|
|||||||
# Create cloned interfaces
|
# Create cloned interfaces
|
||||||
clone_up
|
clone_up
|
||||||
|
|
||||||
|
# Create Fast EtherChannel interfaces
|
||||||
|
fec_up
|
||||||
|
|
||||||
# Create IPv6<-->IPv4 tunnels
|
# Create IPv6<-->IPv4 tunnels
|
||||||
gif_up
|
gif_up
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd January 23, 2007
|
.Dd February 9, 2007
|
||||||
.Dt RC.CONF 5
|
.Dt RC.CONF 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -1163,6 +1163,33 @@ Entries in
|
|||||||
are automatically appended to
|
are automatically appended to
|
||||||
.Va network_interfaces
|
.Va network_interfaces
|
||||||
for configuration.
|
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 interfaces
|
||||||
|
according to the syntax of the
|
||||||
|
.Cm NGM_FEC_ADD_IFACE
|
||||||
|
to
|
||||||
|
.Xr ngctl 8
|
||||||
|
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="fec0"
|
||||||
|
fecconfig_fec0="em0 em1"
|
||||||
|
ifconfig_fec0="DHCP"
|
||||||
|
.Ed
|
||||||
.It Va gif_interfaces
|
.It Va gif_interfaces
|
||||||
.Pq Vt str
|
.Pq Vt str
|
||||||
Set to the list of
|
Set to the list of
|
||||||
|
Loading…
Reference in New Issue
Block a user