diff options
author | Colin Guthrie <colin@mageia.org> | 2011-11-03 23:21:54 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2011-11-03 23:21:54 +0000 |
commit | 6ef16c72e9b262d695a5d2662dc1999279cc1b22 (patch) | |
tree | 980198a56901acae6fae837cfee0550d9b16fccd /sysconfig/network-scripts/ifup-eth | |
parent | 1e6179bf54cbc84b4ad33480e7f2f713418bb28a (diff) | |
download | initscripts-6ef16c72e9b262d695a5d2662dc1999279cc1b22.tar initscripts-6ef16c72e9b262d695a5d2662dc1999279cc1b22.tar.gz initscripts-6ef16c72e9b262d695a5d2662dc1999279cc1b22.tar.bz2 initscripts-6ef16c72e9b262d695a5d2662dc1999279cc1b22.tar.xz initscripts-6ef16c72e9b262d695a5d2662dc1999279cc1b22.zip |
Reduce differences in network scripts.
This just merges in some upstream changes between 25 and 34 that
allows for multiple static IP addresses to be defined
in the ifcfg files.
Diffstat (limited to 'sysconfig/network-scripts/ifup-eth')
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 93b6241e..50c1a6ab 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -443,32 +443,43 @@ else fi if [ "${REALDEVICE}" != "lo" ]; then - if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then - if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then - echo $"Error, some other host already uses address ${IPADDR}." - mdv-network-event connection_failure ${DEVICE} - exit 1 - fi - if ! ip addr add ${IPADDR}/${PREFIX} \ - brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then - echo $"Error adding address ${IPADDR} for ${DEVICE}." - fi - fi - - if [ -n "$SRCADDR" ]; then - sysctl -w "net.ipv4.conf.${REALDEVICE}.arp_filter=1" >/dev/null 2>&1 - fi + # set IP address(es) + for idx in {0..256} ; do + if [ -z "${ipaddr[$idx]}" ]; then + break + fi + + if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then + [ "${REALDEVICE}" != "lo" ] && \ + if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then + net_log $"Error, some other host already uses address ${ipaddr[$idx]}." + mdv-network-event connection_failure ${DEVICE} + exit 1 + fi + + if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \ + brd ${broadcast[$idx]:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then + net_log $"Error adding address ${ipaddr[$idx]} for ${DEVICE}." + fi + fi - # update ARP cache of neighboring computers - /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${IPADDR} - ( sleep 2; - /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${IPADDR} ) > /dev/null 2>&1 < /dev/null & + if [ -n "$SRCADDR" ]; then + sysctl -w "net.ipv4.conf.${SYSCTLDEVICE}.arp_filter=1" >/dev/null 2>&1 + fi + + # update ARP cache of neighboring computers + if [ "${REALDEVICE}" != "lo" ]; then + /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} + ( sleep 2; + /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} ) > /dev/null 2>&1 < /dev/null & + fi + done fi # Set a default route. if [ "${DEFROUTE}" != "no" ] && [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then # set up default gateway. replace if one already exists - if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then + if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${netmask[0]} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then if [ -n "${ATM_ADDR}" -a -x /usr/sbin/atmarpd -a -x /usr/sbin/atmarp ]; then ip link set dev ${REALDEVICE} down ip link set dev ${REALDEVICE} up |