From: rpe Date: Sun, 20 Apr 2014 15:53:57 +0000 (+0000) Subject: Only issue a single dhcp requests per interface with the host-name X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4b81c52b8b7d70161bf17c2a66401ed8c44c3b19;p=openbsd Only issue a single dhcp requests per interface with the host-name 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@ --- diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 968bd847c44..cb2d6d54a5a 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -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 ;;