aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2016-11-10 12:14:30 +0100
committerDee'Kej <deekej@linuxmail.org>2016-11-10 16:38:18 +0100
commite20a9baff26986d2bbb8201615dd39c9748b7141 (patch)
tree3713320dac1be347d8a8065b8ffb93bd57596375 /sysconfig
parenteb1a9ae171f8be0137c146b9dfb3906f90d5a8be (diff)
downloadinitscripts-e20a9baff26986d2bbb8201615dd39c9748b7141.tar
initscripts-e20a9baff26986d2bbb8201615dd39c9748b7141.tar.gz
initscripts-e20a9baff26986d2bbb8201615dd39c9748b7141.tar.bz2
initscripts-e20a9baff26986d2bbb8201615dd39c9748b7141.tar.xz
initscripts-e20a9baff26986d2bbb8201615dd39c9748b7141.zip
network-functions: do not send hostname via dhclient everytime
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifup-eth17
-rw-r--r--sysconfig/network-scripts/network-functions17
2 files changed, 25 insertions, 9 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 4d022f76..e884fa73 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -185,7 +185,13 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
fi;
generate_config_file_name
generate_lease_file_name
- DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid"
+
+ if need_hostname; then
+ DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid"
+ else
+ DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid"
+ fi
+
echo
echo -n $"Determining IP information for ${DEVICE}..."
if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then
@@ -326,7 +332,14 @@ if is_true "${DHCPV6C}" && [ -x /sbin/dhclient ]; then
generate_lease_file_name 6
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
+
+ if need_hostname; then
+ DHCLIENTARGS="-6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${DEVICE}"
+ else
+ DHCLIENTARGS="-6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}"
+ fi
+
+ if /sbin/dhclient "$DHCLIENTARGS"; then
echo $" done."
else
echo $" failed."
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 7f753e29..4ff6b988 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -355,13 +355,16 @@ is_available_wait ()
need_hostname ()
{
- CHECK_HOSTNAME=$(hostname)
- if [ "$CHECK_HOSTNAME" = "(none)" -o "$CHECK_HOSTNAME" = "localhost" -o \
- "$CHECK_HOSTNAME" = "localhost.localdomain" ]; then
- return 0
- else
- return 1
- fi
+ CHECK_HOSTNAME="$(hostname)"
+
+ case "$CHECK_HOSTNAME" in
+ '(none)' | 'localhost' | 'localhost.localdomain')
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
}
set_hostname ()