diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2012-10-08 14:53:09 +0200 |
---|---|---|
committer | Václav Pavlín <vpavlin@redhat.com> | 2013-01-21 15:49:27 +0100 |
commit | 814fac877b22577f4835afcfb2597677270f6a4c (patch) | |
tree | 16740c730c77936d4872ba6150eef59c298655ed | |
parent | 9fcf01add06e4dbf4064cfd2e97c8236c2f5a194 (diff) | |
download | initscripts-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)
-rw-r--r-- | sysconfig.txt | 4 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-aliases | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sysconfig.txt b/sysconfig.txt index 7746671c..4d87599d 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -586,6 +586,10 @@ Files in /etc/sysconfig/network-scripts/ Network zone (trust level) of this connection. If not set, default zone (specified in /etc/firewalld/firewalld.conf) is used. To see all available zones, run 'firewall-cmd --get-zones'. + ARPCHECKn=yes|no + If set to 'no', ifup will not try to determine, if requested ip address + is used by other machine in network. + Defaults to 'yes'. For dynamic addressing (BOOTPROTO=dhcp) only DEVICE needs to be set; all the rest will be determined by the boot protocol. 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} |