1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge pull request #1112 from Evengard/making-unique-clientid-dhcp

Make DHCP Client ID more unique
This commit is contained in:
Ilya Shipitsin 2020-05-05 16:00:23 +05:00 committed by GitHub
commit 7e8b3c0b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -1077,8 +1077,14 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt)
// Hostname // Hostname
if (IsEmptyStr(opt->Hostname) == false) 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_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 else // Client MAC Address
{ {

View File

@ -257,9 +257,9 @@ void PPPThread(THREAD *thread, void *param)
case PPP_EAP_TYPE_IDENTITY: case PPP_EAP_TYPE_IDENTITY:
default: // We treat the unspecified protocol as the IDENTITY protocol default: // We treat the unspecified protocol as the IDENTITY protocol
p->Eap_Protocol = PPP_EAP_TYPE_IDENTITY; p->Eap_Protocol = PPP_EAP_TYPE_IDENTITY;
lcpEap = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_IDENTITY, sizeof(welcomeMessage)); lcpEap = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_IDENTITY, StrLen(welcomeMessage) + 1);
eapPacket = lcpEap->Data; eapPacket = lcpEap->Data;
Copy(eapPacket->Data, welcomeMessage, sizeof(welcomeMessage)); Copy(eapPacket->Data, welcomeMessage, StrLen(welcomeMessage));
PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); PPPSetStatus(p, PPP_STATUS_AUTHENTICATING);
if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap)) if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap))
{ {
@ -3447,7 +3447,7 @@ void FreePPPSession(PPP_SESSION *p)
} }
if (p->Eap_TlsCtx.CachedBufferSend != NULL) if (p->Eap_TlsCtx.CachedBufferSend != NULL)
{ {
Free(p->Eap_TlsCtx.CachedBufferRecv); Free(p->Eap_TlsCtx.CachedBufferSend);
} }
if (p->Eap_TlsCtx.SslPipe != NULL) if (p->Eap_TlsCtx.SslPipe != NULL)
{ {