From b7ef7c3cd0bcce1c4d77694be607b6b8d81fcc58 Mon Sep 17 00:00:00 2001 From: "Michael K. Johnson" Date: Sat, 2 May 1998 21:37:53 +0000 Subject: linuxconf support --- sysconfig/network-scripts/ifup-aliases | 40 ++++++++++++++++++++++++++++++++++ sysconfig/network-scripts/ifup-post | 6 +---- sysconfig/network-scripts/ifup-routes | 22 +++++++++++++------ 3 files changed, 56 insertions(+), 12 deletions(-) create mode 100755 sysconfig/network-scripts/ifup-aliases (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases new file mode 100755 index 00000000..39233819 --- /dev/null +++ b/sysconfig/network-scripts/ifup-aliases @@ -0,0 +1,40 @@ +#!/bin/sh + +# adds aliases of device $1 + +if [ "$1" = "" ]; then + echo "usage: $0 " + exit 1 +fi + +if [ -x /bin/linuxconf ] ; then + # ask linuxconf for lines like: + # add + # del + # reload + linuxconf --hint ipalias $1 | while read verb arg1 arg2 ; do + case $verb in + add) + /sbin/ifconfig $arg1 $arg2 + /sbin/route add $arg2 $arg1 + ;; + del) + # the - 0.0.0.0 tells the kernel to remove the device + # it is necessary to remove it in order for reload to work. + /sbin/ifconfig ${arg1}- 0.0.0.0 + ;; + reload) + echo $arg1 > /proc/sys/net/core/net_alias_max + ;; + esac + done + +else + # we don't have linuxconf to fall back on, so presumably we do + # not have to parse linuxconf ipalias ranges, either. + allow_null_glob_expansion=foo + for alias in /etc/sysconfig/network-scripts/ifcfg-$1:* ; do + /etc/sysconfig/network-scripts/ifup $alias + done + unset allow_null_glob_expansion +fi diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post index 6dee839a..414bae6a 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -19,11 +19,7 @@ fi /etc/sysconfig/network-scripts/ifup-routes ${DEVICE} if [ "$ISALIAS" = no ] ; then - allow_null_glob_expansion=foo - for alias in /etc/sysconfig/network-scripts/ifcfg-${DEVICE}:* ; do - /etc/sysconfig/network-scripts/ifup $alias - done - unset allow_null_glob_expansion + /etc/sysconfig/network-scripts/ifup-aliases ${DEVICE} fi if [ -n "$NEEDHOSTNAME" -a ${DEVICE} != lo ]; then diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes index f8006b8b..6cae8d4c 100755 --- a/sysconfig/network-scripts/ifup-routes +++ b/sysconfig/network-scripts/ifup-routes @@ -7,11 +7,19 @@ if [ "$1" = "" ]; then exit 1 fi -if [ ! -f /etc/sysconfig/static-routes ]; then - exit 0 -fi +if [ -x /bin/linuxconf ] ; then + rm -f /var/run/routes.current + linuxconf --hint routing "$1" | while read args; do + /sbin/route $args + echo $args >> /var/run/routes.current + done +else + if [ ! -f /etc/sysconfig/static-routes ]; then + exit 0 + fi -#note the trailing space in the grep gets rid of aliases -grep "^$1 " /etc/sysconfig/static-routes | while read device args; do - /sbin/route add -$args $device -done + #note the trailing space in the grep gets rid of aliases + grep "^$1 " /etc/sysconfig/static-routes | while read device args; do + /sbin/route add -$args $device + done +fi -- cgit v1.2.1