aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2012-10-08 14:53:09 +0200
committerVáclav Pavlín <vpavlin@redhat.com>2013-01-21 15:49:27 +0100
commit814fac877b22577f4835afcfb2597677270f6a4c (patch)
tree16740c730c77936d4872ba6150eef59c298655ed /sysconfig
parent9fcf01add06e4dbf4064cfd2e97c8236c2f5a194 (diff)
downloadinitscripts-814fac877b22577f4835afcfb2597677270f6a4c.tar
initscripts-814fac877b22577f4835afcfb2597677270f6a4c.tar.gz
initscripts-814fac877b22577f4835afcfb2597677270f6a4c.tar.bz2
initscripts-814fac877b22577f4835afcfb2597677270f6a4c.tar.xz
initscripts-814fac877b22577f4835afcfb2597677270f6a4c.zip
check an IP address for existence in ifup-alias (#852005)
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index a647044f..8a59dd0a 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -139,6 +139,7 @@ function ini_env ()
GATEWAY=$default_GATEWAY
NO_ALIASROUTING=$default_NO_ALIASROUTING
ONPARENT=""
+ ARPCHECK=""
}
function is_default_gateway ()
@@ -256,6 +257,14 @@ function new_interface ()
fi
if [ "$setup_this" = "yes" ] ; then
+ [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \
+ is_available ${parent_device} && \
+ grep -qswi "up" /sys/class/net/${parent_device}/operstate && \
+ if ! /sbin/arping -q -c 2 -w 3 -D -I ${parent_device} ${IPADDR} ; then
+ net_log $"Error, some other host already uses address ${IPADDR}."
+ return 1
+ fi
+
/sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE}
[ "$IPV6INIT" = "yes" ] && /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}