aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2013-04-12 12:59:20 +0200
committerLukas Nykryn <lnykryn@redhat.com>2013-04-12 12:59:20 +0200
commit17ab37ef0a032855aaa3ce77c1765b982e903ca0 (patch)
tree6aa3d5058e29c2674f74d7c4e55eb25020ea0bcd
parent47b1b79a5e8776b2100e8b55d7ab7be067e1bcd7 (diff)
downloadinitscripts-17ab37ef0a032855aaa3ce77c1765b982e903ca0.tar
initscripts-17ab37ef0a032855aaa3ce77c1765b982e903ca0.tar.gz
initscripts-17ab37ef0a032855aaa3ce77c1765b982e903ca0.tar.bz2
initscripts-17ab37ef0a032855aaa3ce77c1765b982e903ca0.tar.xz
initscripts-17ab37ef0a032855aaa3ce77c1765b982e903ca0.zip
try dhcpv6 after v4 failed
-rw-r--r--sysconfig.txt3
-rwxr-xr-xsysconfig/network-scripts/ifup-eth22
2 files changed, 23 insertions, 2 deletions
diff --git a/sysconfig.txt b/sysconfig.txt
index fde8934e..c002eb5f 100644
--- a/sysconfig.txt
+++ b/sysconfig.txt
@@ -586,6 +586,9 @@ Files in /etc/sysconfig/network-scripts/
If set to 'no', ifup will not try to determine, if requested ip address
is used by other machine in network.
Defaults to 'yes'.
+ IPV4_FAILURE_FATAL=yes|no
+ If set to yes, ifup-eth will end immediately after ipv4 dhclient fails.
+ Defaults to 'no'.
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-eth b/sysconfig/network-scripts/ifup-eth
index e76d4c24..bd524343 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -172,9 +172,16 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
echo $" done."
+ dhcpipv4="good"
else
echo $" failed."
- exit 1
+ if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then
+ exit 1
+ fi
+ if [[ "$IPV6INIT" != [yY1]* && "$DHCPV6C" != [yY1]* ]] ; then
+ exit 1
+ fi
+ net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
fi
# end dynamic device configuration
else
@@ -275,7 +282,18 @@ fi
if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
generate_config_file_name 6
generate_lease_file_name 6
- /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}
+ echo
+ echo -n $"Determining IPv6 information for ${DEVICE}..."
+ if /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} ; then
+ echo $" done."
+ else
+ echo $" failed."
+ if [ "${dhcpipv4}" = "good" -o -n "${IPADDR}" ]; then
+ net_log "Unable to obtain IPv6 DHCP address ${DEVICE}." warning
+ else
+ exit 1
+ fi
+ fi
fi
if [ "${IPX}" = yes ]; then