version 1.104, 2005/04/04 04:26:27 |
version 1.105, 2005/05/22 08:56:08 |
|
|
done < /etc/hostname.$if |
done < /etc/hostname.$if |
} |
} |
|
|
|
# Start multiple: |
|
# start "$1" interfaces in order or all interfaces if empty |
|
# don't start "$2" interfaces |
|
ifmstart() { |
|
for sif in ${1:-ALL}; do |
|
for hn in /etc/hostname.*; do |
|
# Strip off /etc/hostname. prefix |
|
if=${hn#/etc/hostname.} |
|
test "$if" = "*" && continue |
|
|
|
# Skip unwanted ifs |
|
s="" |
|
for xf in $2; do |
|
test "$xf" = "${if%%[0-9]*}" && s="1" && break |
|
done |
|
test "$s" = "1" && continue |
|
|
|
# Start wanted ifs |
|
test "$sif" = "ALL" -o \ |
|
"$sif" = "${if%%[0-9]*}" \ |
|
&& ifstart $if |
|
done |
|
done |
|
} |
|
|
# Start the $1 bridge |
# Start the $1 bridge |
bridgestart() { |
bridgestart() { |
# Interface names must be alphanumeric only. We check to avoid |
# Interface names must be alphanumeric only. We check to avoid |
|
|
ip6kernel=NO |
ip6kernel=NO |
fi |
fi |
|
|
# Configure all the non-loopback interfaces which we know about. |
|
|
# Configure all the non-loopback interfaces which we know about, but |
|
# do not start interfaces which must be delayed. |
# Refer to hostname.if(5) and bridgename.if(5) |
# Refer to hostname.if(5) and bridgename.if(5) |
for hn in /etc/hostname.*; do |
ifmstart "" "carp gif gre pfsync pppoe" |
# Strip off /etc/hostname. prefix |
|
if=${hn#/etc/hostname.} |
|
test "$if" = "*" && continue |
|
|
|
case $if in |
|
"carp"*|"gif"*|"gre"*|"pfsync"*) |
|
# CARP, GIF, GRE and PFSYNC interfaces need the routes to be setup |
|
# before they are configured. |
|
continue |
|
;; |
|
*) |
|
ifstart $if |
|
;; |
|
esac |
|
done |
|
|
|
if [ "$ip6kernel" = "YES" -a "x$rtsolif" != "x" ]; then |
if [ "$ip6kernel" = "YES" -a "x$rtsolif" != "x" ]; then |
fw=`sysctl -n net.inet6.ip6.forwarding` |
fw=`sysctl -n net.inet6.ip6.forwarding` |
ra=`sysctl -n net.inet6.ip6.accept_rtadv` |
ra=`sysctl -n net.inet6.ip6.accept_rtadv` |
|
|
fi |
fi |
|
|
# The pfsync interface needs to come up before carp. |
# The pfsync interface needs to come up before carp. |
if [ -f /etc/hostname.pfsync0 ]; then |
|
ifstart pfsync0 |
|
fi |
|
|
|
# Configure all the carp interfaces which we know about. |
# Configure all the carp interfaces which we know about. |
# They must come up after pfsync but before default route. |
# They must come up after pfsync but before default route. |
for hn in /etc/hostname.*; do |
ifmstart "pfsync carp" |
# Strip off /etc/hostname. prefix |
|
if=${hn#/etc/hostname.} |
|
test "$if" = "*" && continue |
|
|
|
case $if in |
|
"carp"*) |
|
ifstart $if |
|
;; |
|
*) |
|
# Regular interfaces have already been configured. |
|
continue |
|
;; |
|
esac |
|
done |
|
|
|
# /etc/mygate, if it exists, contains the name of my gateway host |
# /etc/mygate, if it exists, contains the name of my gateway host |
# that name must be in /etc/hosts. |
# that name must be in /etc/hosts. |
if [ "X${setgateway}" != X"N" -a -f /etc/mygate ]; then |
if [ "X${setgateway}" != X"N" -a -f /etc/mygate ]; then |
|
|
;; |
;; |
esac |
esac |
|
|
# Configure all the gif and gre interfaces which we know about. |
|
# They were delayed because they require the routes to be set. |
|
for hn in /etc/hostname.*; do |
|
# Strip off /etc/hostname. prefix |
|
if=${hn#/etc/hostname.} |
|
test "$if" = "*" && continue |
|
|
|
case $if in |
# Configure PPPoE, GIF, GRE interfaces, delayed because they require routes |
"gif"*|"gre"*) |
# to be set. PPPoE must be first, as GIF and GRE may depend on it. |
ifstart $if |
ifmstart "pppoe gif gre" |
;; |
|
*) |
|
# Regular interfaces have already been configured. |
|
continue |
|
;; |
|
esac |
|
done |
|
|
|
# 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 |