summaryrefslogtreecommitdiff
path: root/gdhcp/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdhcp/client.c')
-rw-r--r--gdhcp/client.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index c11f019d..a3b4b8a9 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2470,6 +2470,28 @@ static uint8_t *alloc_dhcp_string_option(int code, const char *str)
return alloc_dhcp_data_option(code, (const uint8_t *)str, strlen(str));
}
+GDHCPClientError g_dhcp_client_set_id(GDHCPClient *dhcp_client)
+{
+ const unsigned maclen = 6;
+ const unsigned idlen = maclen + 1;
+ const uint8_t option_code = G_DHCP_CLIENT_ID;
+ uint8_t idbuf[idlen];
+ uint8_t *data_option;
+
+ idbuf[0] = ARPHRD_ETHER;
+
+ memcpy(&idbuf[1], dhcp_client->mac_address, maclen);
+
+ data_option = alloc_dhcp_data_option(option_code, idbuf, idlen);
+ if (data_option == NULL)
+ return G_DHCP_CLIENT_ERROR_NOMEM;
+
+ g_hash_table_insert(dhcp_client->send_value_hash,
+ GINT_TO_POINTER((int) option_code), data_option);
+
+ return G_DHCP_CLIENT_ERROR_NONE;
+}
+
/* Now only support send hostname */
GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
unsigned char option_code, const char *option_value)