From 1fe863e8663043bd2e6efd0102f7e745b78c4e3c Mon Sep 17 00:00:00 2001 From: Evengard Date: Sun, 3 May 2020 17:46:02 +0300 Subject: [PATCH] Generate DHCP Client ID based on MAC all the time --- src/Cedar/IPC.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Cedar/IPC.c b/src/Cedar/IPC.c index 96de8962..47ad93cb 100644 --- a/src/Cedar/IPC.c +++ b/src/Cedar/IPC.c @@ -1077,8 +1077,14 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt) // Hostname if (IsEmptyStr(opt->Hostname) == false) { + UCHAR client_id[MAX_HOST_NAME_LEN + 32]; + UCHAR macstr[30]; + MacToStr(macstr, sizeof(macstr), ipc->MacAddress); + + Format(client_id, sizeof(client_id), "%s/%s", opt->Hostname, macstr); + Add(o, NewDhcpOption(DHCP_ID_HOST_NAME, opt->Hostname, StrLen(opt->Hostname))); - Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, opt->Hostname, StrLen(opt->Hostname))); + Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, StrLen(client_id))); } else // Client MAC Address {