From: Roy Marples Date: Mon, 12 May 2008 21:03:38 +0000 (+0000) Subject: Don't encode the hostname as a FQDN by default as not all DHCP servers support this. X-Git-Tag: v4.0.2~426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b3bc4775a960dbf65ffe3f540d63d122311f9c4;p=thirdparty%2Fdhcpcd.git Don't encode the hostname as a FQDN by default as not all DHCP servers support this. --- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index c690700e..2e923704 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 02, 2008 +.Dd May 12, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd @@ -137,9 +137,7 @@ You can use this option to specify the sent, or an empty string to stop any .Ar hostname -from being sent. If -.Ar hostname -is an FQDN (ie, contains a .) then it will be encoded as such. +from being sent. .It Fl i , -classid Ar classid Override the DHCP vendor .Ar classid @@ -245,8 +243,11 @@ Requests that the DHCP server updates DNS using FQDN instead of just a hostname. Valid values for .Ar fqdn are none, ptr and both. +The current hostname or the hostname specified using the +.Fl h , -hostname +option must be a FQDN. .Nm -dhcpcd itself never does any DNS updates. +itself never does any DNS updates. .It Fl I , -clientid Ar clientid Change the default clientid sent from the interface hardware address. If the string is of the format 01:02:03 then it is encoded as hex. @@ -288,7 +289,7 @@ Linux Socket Filter, or LPF device on Linux based systems. Bourne shell script that is run when we configure or deconfigure an interface. .It Pa @SYSCONFDIR@/dhcpcd.duid Text file that holds the DUID used to identify the host. -.It Pa @DBDIR@/dhcpcd- Ns Ar interface Ns .lease +.It Pa @DBDIR@/dhcpcd\- Ns Ar interface Ns .lease The actual DHCP message send by the server. We use this when reading the last lease and use the files mtime as when it was issued. .El diff --git a/dhcpcd.c b/dhcpcd.c index 209e7a2a..11e4b25c 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -650,11 +650,17 @@ main(int argc, char **argv) goto abort; } } - if (strchr(options->hostname, '.')) { + + if ((p = strchr(options->hostname, '.'))) { if (options->fqdn == FQDN_DISABLE) - options->fqdn = FQDN_BOTH; - } else - options->fqdn = FQDN_DISABLE; + *p = '\0'; + } else { + if (options->fqdn != FQDN_DISABLE) { + logger(LOG_WARNING, "hostname `%s' is not a FQDN", + options->hostname); + options->fqdn = FQDN_DISABLE; + } + } if (options->request_address.s_addr == 0 && options->options & DHCPCD_INFORM) diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index e39978c9..53f8ea13 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 02, 2008 +.Dd May 12, 2008 .Dt DHCPCD.CONF 5 SMM .Sh NAME .Nm dhcpcd.conf @@ -67,6 +67,11 @@ if a FQDN (ie, contains a .) then it will be encoded as such. .It Ic fqdn Op none | ptr | both none disables FQDN encoding, ptr just asks the DHCP server to update the PTR record of the host in DNS whereas both also updates the A record. +The current hostname or the hostname specified using the +.Fl h , -hostname +option must be a FQDN. +.Nm dhcpcd +itself never does any DNS updates. .It Ic interface Ar interface Subsequent options are only parsed for this .Ar interface .