diff options
author | David Kaspar [Dee'Kej] <dkaspar@redhat.com> | 2016-11-15 17:21:03 +0100 |
---|---|---|
committer | Lukáš Nykrýn <lnykryn@redhat.com> | 2016-11-16 12:17:54 +0100 |
commit | 2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24 (patch) | |
tree | e2fd5a42d72bfb1b963ea82a0512d5c1ae91f0f6 /sysconfig/network-scripts/ifup-eth | |
parent | 02760563d7ea60bf767812aa0cf5cd97d20a2217 (diff) | |
download | initscripts-2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24.tar initscripts-2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24.tar.gz initscripts-2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24.tar.bz2 initscripts-2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24.tar.xz initscripts-2ea1dcf2d22606f4b30ae16a14a736d0d9dddf24.zip |
sysconfig/network: NO_DHCP_HOSTNAME option introduced
Previously, some administrators were unable to force initscripts to
not obtatin hostname from DHCP, even though they were using static
configuration of network. Righ now, setting 'NO_DHCP_HOSTNAME' to
'yes', 'true' or '1' in /etc/sysconfig/network will allow them to do so.
Diffstat (limited to 'sysconfig/network-scripts/ifup-eth')
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index e884fa73..7f21477c 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -186,10 +186,12 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then generate_config_file_name generate_lease_file_name - if need_hostname; then - DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" - else + if is_hostname_set; then + # We already have the hostname ->> send it to DHCP: DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" + else + # We need to acquire the hostname: + DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" fi echo @@ -333,10 +335,12 @@ if is_true "${DHCPV6C}" && [ -x /sbin/dhclient ]; then echo echo -n $"Determining IPv6 information for ${DEVICE}..." - 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 + if is_hostname_set; then + # We already have the hostname ->> send it to DHCP: DHCLIENTARGS="-6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}" + else + # We need to acquire the hostname: + DHCLIENTARGS="-6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${DEVICE}" fi if /sbin/dhclient "$DHCLIENTARGS"; then |