summaryrefslogtreecommitdiffstats
path: root/if-options.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-26 12:00:01 +0000
committerRoy Marples <roy@marples.name>2009-01-26 12:00:01 +0000
commit9d9af32de8a952e1dd93f38206acea8fb18f48c8 (patch)
treea20c9a63f130929b2e831380687c9302ac48f536 /if-options.c
parent4fb0c27c39d95db8fd8d4da3a3fb552d79f20613 (diff)
downloaddhcpcd-9d9af32de8a952e1dd93f38206acea8fb18f48c8.tar.xz
We should only send short hostnames as qualfied ones confuse ISC DHCP server. If a FQDN is required, then use that option instead of the hostname.
Diffstat (limited to 'if-options.c')
-rw-r--r--if-options.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/if-options.c b/if-options.c
index e8eb5186..36dd1a0d 100644
--- a/if-options.c
+++ b/if-options.c
@@ -676,13 +676,12 @@ read_config(const char *file, const char *ifname, const char *ssid)
ifo->timeout = DEFAULT_TIMEOUT;
ifo->reboot = DEFAULT_REBOOT;
ifo->metric = -1;
- gethostname(ifo->hostname + 1, HOSTNAME_MAX_LEN);
+ gethostname(ifo->hostname, HOSTNAME_MAX_LEN);
/* Ensure that the hostname is NULL terminated */
- ifo->hostname[HOSTNAME_MAX_LEN + 1] = '\0';
- if (strcmp(ifo->hostname + 1, "(none)") == 0 ||
- strcmp(ifo->hostname + 1, "localhost") == 0)
- ifo->hostname[1] = '\0';
- *ifo->hostname = strlen(ifo->hostname + 1);
+ ifo->hostname[HOSTNAME_MAX_LEN] = '\0';
+ if (strcmp(ifo->hostname, "(none)") == 0 ||
+ strcmp(ifo->hostname, "localhost") == 0)
+ ifo->hostname[0] = '\0';
strlcpy(ifo->script, SCRIPT, sizeof(ifo->script));
ifo->vendorclassid[0] = snprintf((char *)ifo->vendorclassid + 1,
VENDORCLASSID_MAX_LEN,