From 098087cbe4bd9dc4a5805eac15c3e86f1721ca43 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 11 Jan 2010 16:14:09 -0500 Subject: dhclient's got a send-hostname option, use that It certainly makes more sense than relying on the writing of temporary config files in /etc. Use the same mechanism for IPv6 as well. --- sysconfig/network-scripts/ifup-eth | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 2aead689..43d7ca3a 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -168,27 +168,11 @@ if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then fi if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then - # Remove any temporary references which were previously added to dhclient config - if [ -w /etc/dhclient-${DEVICE}.conf ] ; then - LC_ALL=C grep -v "# temporary RHL ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null - cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf - rm -f /etc/dhclient-${DEVICE}.conf.ifupnew - fi if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then ONESHOT=""; else ONESHOT="-1"; fi; - if [ -n "${DHCP_HOSTNAME}" ]; then - # Send a host-name to the DHCP server (requ. by some dhcp servers). - if [ -w /etc/dhclient-${DEVICE}.conf ] ; then - if ! LC_ALL=C grep "send *host-name *\"${DHCP_HOSTNAME}\"" /etc/dhclient-${DEVICE}.conf > /dev/null 2>&1 ; then - echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf - fi - elif ! [ -e /etc/dhclient-${DEVICE}.conf ] ; then - echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf - fi - fi # allow users to use generic '/etc/dhclient.conf' (as documented in manpage!) # if per-device file doesn't exist or is empty if [ -s /etc/dhclient-${DEVICE}.conf ]; then @@ -203,7 +187,7 @@ if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then [ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1 fi done - DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid" + DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_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 @@ -306,7 +290,7 @@ fi # IPv6 initialisation? /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then - /sbin/dhclient -6 ${DHCPV6C_OPTIONS} ${DEVICE} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid + /sbin/dhclient -6 ${DHCPV6C_OPTIONS} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${DEVICE} fi if [ "${IPX}" = yes ]; then -- cgit v1.2.1