version 1.126, 2009/09/17 08:22:22 |
version 1.127, 2009/11/22 23:09:50 |
|
|
"!"*) # parse commands |
"!"*) # parse commands |
cmd="${af#*!} ${name} ${mask} ${bcaddr} ${ext1} ${ext2}" |
cmd="${af#*!} ${name} ${mask} ${bcaddr} ${ext1} ${ext2}" |
;; |
;; |
"bridge") |
|
cmd="echo /etc/hostname.$if: bridges now supported via bridgename.* files" |
|
;; |
|
"dhcp") |
"dhcp") |
[ "$name" = "NONE" ] && name= |
[ "$name" = "NONE" ] && name= |
[ "$mask" = "NONE" ] && mask= |
[ "$mask" = "NONE" ] && mask= |
|
|
done |
done |
} |
} |
|
|
# Start the $1 bridge |
|
bridgestart() { |
|
# Interface names must be alphanumeric only. We check to avoid |
|
# configuring backup or temp files, and to catch the "*" case. |
|
if ! isalphanumeric "$1"; then |
|
return |
|
fi |
|
brconfig $1 > /dev/null 2>&1 |
|
if [ "$?" != "0" ]; then |
|
# Try to create interface if it does not exist |
|
ifconfig $1 create > /dev/null 2>&1 |
|
if [ "$?" != "0" ]; then |
|
return |
|
fi |
|
fi |
|
|
|
# Now parse the bridgename.* file |
|
# All lines are run as brconfig(8) commands. |
|
while read line ; do |
|
line=${line%%#*} # strip comments |
|
test -z "$line" && continue |
|
case "$line" in |
|
"!"*) |
|
cmd="${line#*!}" |
|
;; |
|
*) |
|
cmd="brconfig $1 $line" |
|
;; |
|
esac |
|
eval "$cmd" |
|
done < /etc/bridgename.$1 |
|
} |
|
|
|
# Re-read /etc/rc.conf |
# Re-read /etc/rc.conf |
. /etc/rc.conf |
. /etc/rc.conf |
|
|
|
|
fi |
fi |
if [ $# -gt 0 ]; then |
if [ $# -gt 0 ]; then |
while [ $# -gt 0 ]; do |
while [ $# -gt 0 ]; do |
if [ -f /etc/bridgename.$1 ]; then |
ifstart $1 |
bridgestart $1 |
|
else |
|
ifstart $1 |
|
fi |
|
shift |
shift |
done |
done |
return |
return |
|
|
|
|
|
|
# Configure all the non-loopback interfaces which we know about, but |
# Configure all the non-loopback interfaces which we know about, but |
# do not start interfaces which must be delayed. |
# do not start interfaces which must be delayed. Refer to hostname.if(5) |
# Refer to hostname.if(5) and bridgename.if(5) |
ifmstart "" "trunk vlan carp gif gre pfsync pppoe tun bridge" |
ifmstart "" "trunk vlan carp gif gre pfsync pppoe tun" |
|
|
|
# The trunk interfaces need to come up first in this list. |
# The trunk interfaces need to come up first in this list. |
# The vlan interfaces need to come up after trunk. |
# The vlan interfaces need to come up after trunk. |
|
|
# Configure PPPoE, GIF, GRE and TUN interfaces, delayed because they require |
# Configure PPPoE, GIF, GRE and TUN interfaces, delayed because they require |
# routes to be set. TUN might depend on PPPoE, and GIF or GRE may depend on |
# routes to be set. TUN might depend on PPPoE, and GIF or GRE may depend on |
# either of them. |
# either of them. |
ifmstart "pppoe tun gif gre" |
ifmstart "pppoe tun gif gre bridge" |
|
|
# reject 127/8 other than 127.0.0.1 |
# reject 127/8 other than 127.0.0.1 |
route -qn add -net 127 127.0.0.1 -reject > /dev/null |
route -qn add -net 127 127.0.0.1 -reject > /dev/null |
|
|
# Configure all the bridges. |
|
for bn in /etc/bridgename.*; do |
|
# Strip off /etc/bridgename. prefix |
|
if=${bn#/etc/bridgename.} |
|
test "$if" = "*" && continue |
|
|
|
bridgestart $if |
|
done |
|
|
|
if [ "$ip6kernel" = "YES" ]; then |
if [ "$ip6kernel" = "YES" ]; then |
# this is to make sure DAD is completed before going further. |
# this is to make sure DAD is completed before going further. |