aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2011-05-31 17:35:33 -0400
committerBill Nottingham <notting@redhat.com>2011-05-31 17:35:33 -0400
commit60ddb21fcdfb0594a35978aa0b04af4527c46d6e (patch)
treec1dec0611ba7e8c0306982f4548b535694ef5711
parent1019b73ba59dd0b842550eb79aef7c4ae8d1dce2 (diff)
downloadinitscripts-60ddb21fcdfb0594a35978aa0b04af4527c46d6e.tar
initscripts-60ddb21fcdfb0594a35978aa0b04af4527c46d6e.tar.gz
initscripts-60ddb21fcdfb0594a35978aa0b04af4527c46d6e.tar.bz2
initscripts-60ddb21fcdfb0594a35978aa0b04af4527c46d6e.tar.xz
initscripts-60ddb21fcdfb0594a35978aa0b04af4527c46d6e.zip
Ensure DHCP_HOSTNAME is a short hostname, seed it from HOSTNAME if needed. (#697877)
-rwxr-xr-xsysconfig/network-scripts/ifup-eth4
-rw-r--r--sysconfig/network-scripts/network-functions2
2 files changed, 4 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 764d27a2..f46a8843 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -191,7 +191,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
[ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1
fi
done
- DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid"
+ DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid"
echo
echo -n $"Determining IP information for ${DEVICE}..."
if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then
@@ -304,7 +304,7 @@ fi
# IPv6 initialisation?
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
- /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${DEVICE}
+ /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}
fi
if [ "${IPX}" = yes ]; then
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 5815eaa9..2d3263a2 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -190,6 +190,8 @@ expand_config ()
i=$((i+1))
done
+ [ -n "$DHCP_HOSTNAME" ] && DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*}
+
if [ -z "${NETWORK}" ]; then
eval $(/bin/ipcalc --network ${ipaddr[0]} ${netmask[0]})
fi