diff options
Diffstat (limited to 'network')
-rwxr-xr-x | network | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -5,6 +5,10 @@ ifup() { + if [ "$1" = "" ]; then + echo "usage: $0 ifup <interface_name>" + return 1 + fi varname="\$${1}" eval new_ifline=$varname if [ "$new_ifline" = "dhcp" ]; then @@ -19,6 +23,10 @@ ifup() ifdown() { + if [ "$1" = "" ]; then + echo "usage: $0 ifdown <interface_name>" + return 1 + fi varname="\$${1}" eval new_ifline=$varname if [ "$new_ifline" = "dhcp" ]; then @@ -30,8 +38,25 @@ ifdown() return $? } +iflist() +{ + for ifline in ${INTERFACES[@]}; do + if echo $ifline | grep '^[^\!]' >/dev/null 2>&1; then + echo -en " $ifline:\t" + else + echo -en "$ifline:\t" + fi + eval real_ifline=\$${ifline#!} + echo $real_ifline + done +} + rtup() { + if [ "$1" = "" ]; then + echo "usage: $0 rtup <route_name>" + return 1 + fi varname="\$${1}" eval new_rtline=$varname /sbin/route add $new_rtline @@ -40,12 +65,29 @@ rtup() rtdown() { + if [ "$1" = "" ]; then + echo "usage: $0 rtdown <route_name>" + return 1 + fi varname="\$${1}" eval new_rtline=$varname /sbin/route del $new_rtline return $? } +rtlist() +{ + for rtline in ${ROUTES[@]}; do + if echo $rtline | grep '^[^\!]' >/dev/null 2>&1; then + echo -en " $rtline:\t" + else + echo -en "$rtline:\t" + fi + eval real_rtline=\$${rtline#!} + echo $real_rtline + done +} + case "$1" in start) if ! ck_daemon network; then @@ -100,6 +142,10 @@ case "$1" in sleep 2 $0 start ;; + ifup|ifdown|iflist|rtup|rtdown|rtlist) + $1 $2 + ;; *) echo "usage: $0 {start|stop|restart}" + echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}" esac |