Only issue a single dhcp requests per interface with the host-name
authorrpe <rpe@openbsd.org>
Sun, 20 Apr 2014 15:53:57 +0000 (15:53 +0000)
committerrpe <rpe@openbsd.org>
Sun, 20 Apr 2014 15:53:57 +0000 (15:53 +0000)
option set. Remove the second request, which does not provide the
host-name option. The client supplied hostname is used in certain
setups by DHCP servers to update DNS records on behalf of clients
and ensures that the hostname information is in the lease db.

discussed with deraadt
ok krw@ halex@

distrib/miniroot/install.sub

index 968bd84..cb2d6d5 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: install.sub,v 1.762 2014/04/20 10:51:59 rpe Exp $
+#      $OpenBSD: install.sub,v 1.763 2014/04/20 15:53:57 rpe Exp $
 #
 # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
 # All rights reserved.
@@ -783,22 +783,15 @@ dhclient() {
 # no IP address assigned to $1.
 #
 # $1 == interface
-# $2 == hostname (optional).
+# $2 == hostname
 dhcp_request() {
        local _ifs=$1 _hn=$2
 
        echo "lookup file bind" >/etc/resolv.conf.tail
 
-       if [[ -n $_hn ]]; then
-               _hn="send host-name \"$_hn\";"
-               echo "Issuing hostname-associated DHCP request for $_ifs."
-       else
-               echo "Issuing free-roaming DHCP request for $_ifs."
-       fi
-
        cat >/etc/dhclient.conf <<__EOT
 initial-interval 1;
-$_hn
+send host-name "$_hn";
 request subnet-mask, broadcast-address, routers, domain-name,
        domain-name-servers, host-name;
 __EOT
@@ -932,7 +925,7 @@ v4_config() {
        none)   ;;
        dhcp)   if [[ ! -x /sbin/dhclient ]]; then
                        echo "DHCP not possible - no /sbin/dhclient."
-               elif dhcp_request $_ifs "$_name" || dhcp_request $_ifs; then
+               elif dhcp_request $_ifs "$_name"; then
                        echo "dhcp" >>$_hn
                fi
                ;;