From 60ddb21fcdfb0594a35978aa0b04af4527c46d6e Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 31 May 2011 17:35:33 -0400 Subject: Ensure DHCP_HOSTNAME is a short hostname, seed it from HOSTNAME if needed. (#697877) --- sysconfig/network-scripts/ifup-eth | 4 ++-- sysconfig/network-scripts/network-functions | 2 ++ 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 -- cgit v1.2.1