From f10c56a70b7e4a3d06449c408c492768f4c09e99 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 20 Jun 2001 22:59:03 +0000 Subject: - fix testing for link so that modules will actually get loaded - don't use $MACADDR for testing device's MAC address when it's a configuration parameter to change it; use $HWADDR instead. - fix broken ipcalc --prefix calls - re-add ifcfg-lo - fix check_default_route - fix up some of the stdout/stderr redirections --- sysconfig/network-scripts/ifcfg-lo | 9 +++++++++ sysconfig/network-scripts/ifup | 20 +++++++++++--------- sysconfig/network-scripts/network-functions | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 sysconfig/network-scripts/ifcfg-lo (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifcfg-lo b/sysconfig/network-scripts/ifcfg-lo new file mode 100644 index 00000000..cb4f3f94 --- /dev/null +++ b/sysconfig/network-scripts/ifcfg-lo @@ -0,0 +1,9 @@ +DEVICE=lo +IPADDR=127.0.0.1 +NETMASK=255.0.0.0 +NETWORK=127.0.0.0 +# If you're having problems with gated making 127.0.0.0/8 a martian, +# you can change this to something else (255.255.255.255, for example) +BROADCAST=127.255.255.255 +ONBOOT=yes +NAME=loopback diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index f1aad49c..00f650fd 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -89,13 +89,15 @@ fi # is this device available? (this catches PCMCIA devices for us) LC_ALL= LANG= ip -o link | grep -q ${REALDEVICE} if [ "$?" = "1" ]; then - echo $"Device does not seem to be present, delaying ${DEVICE} initialization." - exit 1 + modprobe -c | grep -q ${REALDEVICE} && modprobe ${REALDEVICE} || { + echo $"Device does not seem to be present, delaying ${DEVICE} initialization." + exit 1 + } fi -if [ -n "${MACADDR}" ]; then +if [ -n "${HWADDR}" ]; then FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \ sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'` - if [ "${FOUNDMACADDR}" != "${MACADDR}" ]; then + if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then echo $"Device ${DEVICE} has different MAC address than expected, ignoring." exit 1 fi @@ -179,11 +181,11 @@ else fi if [ -z "${NETMASK}" ]; then - eval `/bin/ipcalc --prefix ${IPADDR}` + eval `/bin/ipcalc --netmask ${IPADDR}` fi if [ -z "${PREFIX}" ]; then - eval `/bin/ipcalc --prefix ${NETMASK}` + eval `/bin/ipcalc --prefix ${IPADDR} ${NETMASK}` fi if [ -z "${BROADCAST}" ]; then @@ -218,9 +220,9 @@ else # update ARP cache of neighboring computers arping -q -A -c 1 -I ${DEVICE} ${IPADDR} ( sleep 2; - arping -q -U -c 1 -I ${DEVICE} ${IPADDR} ) >& /dev/null < /dev/null & - ip route add unreachable 224.0.0.0/24 >& /dev/null - ip route add unreachable 255.255.255.255 >& /dev/null + arping -q -U -c 1 -I ${DEVICE} ${IPADDR} ) > /dev/null 2>&1 < /dev/null & + ip route add unreachable 224.0.0.0/24 > /dev/null 2>&1 + ip route add unreachable 255.255.255.255 > /dev/null 2>&1 # if the device is multicast enabled, add a default multicast route if [ `ip link ls ${DEVICE} | grep -c MULTICAST` -ge 1 ]; then diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index fdd4a211..3dbe4b96 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -98,7 +98,8 @@ check_link_down () check_default_route () { - return ip route | grep -q default + ip route | grep -q default + return $? } find_gateway_dev () -- cgit v1.2.1