summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-08-03 16:24:25 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2010-08-03 16:24:25 (GMT)
commit0029c2ecea7899800a9238ab90b561bc54d83f02 (patch)
treebe5317292fcde60336ea6d21ad0db08f2d6ec428
parent37a9470eb4f45412c15cbb44e9e83e4b78b20903 (diff)
downloadconnman-0029c2ecea7899800a9238ab90b561bc54d83f02.zip
connman-0029c2ecea7899800a9238ab90b561bc54d83f02.tar.gz
connman-0029c2ecea7899800a9238ab90b561bc54d83f02.tar.bz2
If hostname is not provided then don't request one via DHCP
-rw-r--r--gdhcp/client.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 7a44724..81fa443 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1190,32 +1190,15 @@ static uint8_t *alloc_dhcp_option(int code, const char *str, int extra)
return storage;
}
-static const char *get_hostname(const char *host)
-{
- char local_host_name[HOST_NAME_MAX + 1];
-
- if (g_strcmp0("<hostname>", host) != 0)
- return g_strdup(host);
-
- if (gethostname(local_host_name, HOST_NAME_MAX) != 0)
- return NULL;
-
- local_host_name[HOST_NAME_MAX] = 0;
-
- return g_strdup(local_host_name);
-}
-
/* Now only support send hostname */
GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
unsigned char option_code, const char *option_value)
{
uint8_t *binary_option;
- const char *hostname;
-
- if (option_code == G_DHCP_HOST_NAME) {
- hostname = get_hostname(option_value);
- binary_option = alloc_dhcp_option(option_code, hostname, 0);
+ if (option_code == G_DHCP_HOST_NAME && option_value != NULL) {
+ binary_option = alloc_dhcp_option(option_code,
+ option_value, 0);
g_hash_table_insert(dhcp_client->send_value_hash,
GINT_TO_POINTER((int) option_code), binary_option);