version 1.83, 2002/02/21 02:32:01 |
version 1.84, 2002/02/23 01:55:24 |
|
|
|
|
# Start the $1 interface |
# Start the $1 interface |
ifstart() { |
ifstart() { |
|
if=$1 |
# Interface names must be alphanumeric only. We check to avoid |
# Interface names must be alphanumeric only. We check to avoid |
# configuring backup or temp files, and to catch the "*" case. |
# configuring backup or temp files, and to catch the "*" case. |
if ! isalphanumeric "$1"; then |
if ! isalphanumeric "$if"; then |
return |
return |
fi |
fi |
|
|
ifconfig $1 > /dev/null 2>&1 |
ifconfig $if > /dev/null 2>&1 |
if [ "$?" != "0" ]; then |
if [ "$?" != "0" ]; then |
return |
return |
fi |
fi |
|
|
cmd="${af#*!} ${name} ${mask} ${bcaddr} ${ext1} ${ext2}" |
cmd="${af#*!} ${name} ${mask} ${bcaddr} ${ext1} ${ext2}" |
;; |
;; |
"bridge") |
"bridge") |
cmd="echo /etc/hostname.$1: bridges now supported via bridgename.* files" |
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= |
[ "$bcaddr" = "NONE" ] && bcaddr= |
[ "$bcaddr" = "NONE" ] && bcaddr= |
ifconfig $1 $name $mask $bcaddr $ext1 $ext2 down |
ifconfig $if $name $mask $bcaddr $ext1 $ext2 down |
cmd="dhclient $1" |
cmd="dhclient $if" |
;; |
;; |
"rtsol") |
"rtsol") |
ifconfig $1 $name $mask $bcaddr $ext1 $ext2 up |
ifconfig $if $name $mask $bcaddr $ext1 $ext2 up |
rtsolif="$rtsolif $1" |
rtsolif="$rtsolif $if" |
cmd= |
cmd= |
;; |
;; |
"up") |
"up") |
# The only one of these guaranteed to be set is $1. |
# The only one of these guaranteed to be set is $if. |
# The remaining ones exist so that media controls work. |
# The remaining ones exist so that media controls work. |
cmd="ifconfig $1 $name $mask $bcaddr $ext1 $ext2 up" |
cmd="ifconfig $if $name $mask $bcaddr $ext1 $ext2 up" |
;; |
;; |
*) |
*) |
read dt dtaddr |
read dt dtaddr |
|
|
else |
else |
alias= |
alias= |
fi |
fi |
cmd="ifconfig $1 $af $alias $name " |
cmd="ifconfig $if $af $alias $name " |
case "$dt" in |
case "$dt" in |
dest) |
dest) |
cmd="$cmd $dtaddr" |
cmd="$cmd $dtaddr" |
|
|
;; |
;; |
esac |
esac |
if [ ! -n "$name" ]; then |
if [ ! -n "$name" ]; then |
echo "/etc/hostname.$1: invalid network configuration file" |
echo "/etc/hostname.$if: invalid network configuration file" |
return |
return |
fi |
fi |
case $af in |
case $af in |
|
|
;; |
;; |
esac |
esac |
eval "$cmd" |
eval "$cmd" |
done < /etc/hostname.$1 |
done < /etc/hostname.$if |
} |
} |
|
|
# Start the $1 bridge |
# Start the $1 bridge |