1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
hiura2023
8a303607c2
Merge 6227919bc2 into 9ce27f363e 2024-04-29 01:24:49 +09:00
hiura2023
6227919bc2
Merge branch 'SoftEtherVPN:master' into master 2024-04-26 12:44:30 +09:00
hiura
7f074d0c0b Fix Virtual DHCP Server: Correct HDCP Sequence 2024-04-26 12:42:27 +09:00

View File

@ -9710,36 +9710,40 @@ void VirtualDhcpServer(VH *v, PKT *p)
} }
else else
{ {
// There is no IP address that can be provided // Reply of DHCP_REQUEST must be either DHCP_ACK or DHCP_NAK.
DHCP_OPTION_LIST ret; if (opt->Opcode == DHCP_REQUEST)
LIST *o;
Zero(&ret, sizeof(ret));
ret.Opcode = DHCP_NACK;
ret.ServerAddress = v->HostIP;
StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain);
ret.SubnetMask = v->DhcpMask;
// Build the DHCP option
o = BuildDhcpOption(&ret);
if (o != NULL)
{ {
BUF *b = BuildDhcpOptionsBuf(o); // There is no IP address that can be provided
if (b != NULL) DHCP_OPTION_LIST ret;
{ LIST *o;
UINT dest_ip = p->L3.IPv4Header->SrcIP; Zero(&ret, sizeof(ret));
if (dest_ip == 0)
{
dest_ip = 0xffffffff;
}
// Transmission
VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort),
ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize);
// Release the memory ret.Opcode = DHCP_NACK;
FreeBuf(b); ret.ServerAddress = v->HostIP;
StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain);
ret.SubnetMask = v->DhcpMask;
// Build the DHCP option
o = BuildDhcpOption(&ret);
if (o != NULL)
{
BUF *b = BuildDhcpOptionsBuf(o);
if (b != NULL)
{
UINT dest_ip = p->L3.IPv4Header->SrcIP;
if (dest_ip == 0)
{
dest_ip = 0xffffffff;
}
// Transmission
VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort),
ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize);
// Release the memory
FreeBuf(b);
}
FreeDhcpOptions(o);
} }
FreeDhcpOptions(o);
} }
} }
} }