1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-26 18:19:53 +03:00

Merge PR #473: IPC: use hostname as client identifier, if available

This commit is contained in:
Davide Beatrici 2018-07-21 05:19:14 +02:00 committed by GitHub
commit 23fd1fc94e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1235,7 +1235,6 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt)
{
LIST *o;
UCHAR opcode;
UCHAR client_id[7];
BUF *ret;
// Validate arguments
if (ipc == NULL || opt == NULL)
@ -1255,11 +1254,6 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt)
Add(o, NewDhcpOption(DHCP_ID_SERVER_ADDRESS, &opt->ServerAddress, 4));
}
// Client MAC Address
client_id[0] = ARP_HARDWARE_TYPE_ETHERNET;
Copy(client_id + 1, ipc->MacAddress, 6);
Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, sizeof(client_id)));
// Requested IP Address
if (opt->RequestedIp != 0)
{
@ -1270,6 +1264,14 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt)
if (IsEmptyStr(opt->Hostname) == false)
{
Add(o, NewDhcpOption(DHCP_ID_HOST_NAME, opt->Hostname, StrLen(opt->Hostname)));
Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, opt->Hostname, StrLen(opt->Hostname)));
}
else // Client MAC Address
{
UCHAR client_id[7];
client_id[0] = ARP_HARDWARE_TYPE_ETHERNET;
Copy(client_id + 1, ipc->MacAddress, 6);
Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, sizeof(client_id)));
}
// User Class