mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
Compare commits
1 Commits
086fb7165c
...
0701ee7b3f
Author | SHA1 | Date | |
---|---|---|---|
|
0701ee7b3f |
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
|||||||
build_and_test:
|
build_and_test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-14, macos-13, macos-12]
|
os: [macos-13, macos-12, macos-11]
|
||||||
name: ${{ matrix.os }}
|
name: ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10)
|
|||||||
set(BUILD_NUMBER CACHE STRING "The number of the current build.")
|
set(BUILD_NUMBER CACHE STRING "The number of the current build.")
|
||||||
|
|
||||||
if ("${BUILD_NUMBER}" STREQUAL "")
|
if ("${BUILD_NUMBER}" STREQUAL "")
|
||||||
set(BUILD_NUMBER "5185")
|
set(BUILD_NUMBER "5184")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_NUMBER LESS 5180)
|
if (BUILD_NUMBER LESS 5180)
|
||||||
@ -53,7 +53,7 @@ if(UNIX)
|
|||||||
#
|
#
|
||||||
# use rpath for locating installed libraries
|
# use rpath for locating installed libraries
|
||||||
#
|
#
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"environments": [ { "BuildNumber": "5185" } ],
|
"environments": [ { "BuildNumber": "5184" } ],
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "x64-native",
|
"name": "x64-native",
|
||||||
|
@ -1517,9 +1517,7 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
|
|||||||
// We save the router advertisement data for later use
|
// We save the router advertisement data for later use
|
||||||
IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src);
|
IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src);
|
||||||
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true);
|
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true);
|
||||||
if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer != NULL) {
|
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true);
|
||||||
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true);
|
|
||||||
}
|
|
||||||
ndtProcessed = true;
|
ndtProcessed = true;
|
||||||
header_size = sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER);
|
header_size = sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER);
|
||||||
break;
|
break;
|
||||||
@ -2356,14 +2354,7 @@ void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *m
|
|||||||
IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength);
|
IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength);
|
||||||
CopyIP(&newRA->RouterAddress, ip);
|
CopyIP(&newRA->RouterAddress, ip);
|
||||||
Copy(newRA->RouterMacAddress, macAddress, 6);
|
Copy(newRA->RouterMacAddress, macAddress, 6);
|
||||||
if (recvPrefix->SourceLinkLayer != NULL)
|
Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6);
|
||||||
{
|
|
||||||
Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Zero(newRA->RouterLinkLayerAddress, 6);
|
|
||||||
}
|
|
||||||
Add(ipc->IPv6RouterAdvs, newRA);
|
Add(ipc->IPv6RouterAdvs, newRA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2666,7 +2657,7 @@ void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
destMac = ra.RouterMacAddress;
|
destMac = ra.RouterMacAddress;
|
||||||
if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterLinkLayerAddress))
|
if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterMacAddress))
|
||||||
{
|
{
|
||||||
destMac = ra.RouterLinkLayerAddress;
|
destMac = ra.RouterLinkLayerAddress;
|
||||||
}
|
}
|
||||||
|
@ -9340,75 +9340,20 @@ UINT ServeDhcpDiscoverEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT ret = 0;
|
|
||||||
DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip);
|
DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip);
|
||||||
|
|
||||||
if (d != NULL)
|
if (d != NULL)
|
||||||
{
|
{
|
||||||
// If an entry for the same IP address already exists,
|
// The requested IP address is used already
|
||||||
// check whether it is a request from the same MAC address
|
return 0;
|
||||||
if (Cmp(mac, d->MacAddress, 6) == 0)
|
|
||||||
{
|
|
||||||
// Examine whether the specified IP address is within the range of assignment
|
|
||||||
if (Endian32(v->DhcpIpStart) > Endian32(request_ip) ||
|
|
||||||
Endian32(request_ip) > Endian32(v->DhcpIpEnd))
|
|
||||||
{
|
|
||||||
// Accept if within the range
|
|
||||||
ret = request_ip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Duplicated IPV4 address found. The DHCP server replies to DHCPREQUEST with DHCP NAK.
|
|
||||||
char ipstr[MAX_HOST_NAME_LEN + 1] = { 0 };
|
|
||||||
char macstr[128] = { 0 };
|
|
||||||
IPToStr32(ipstr, sizeof(ipstr), request_ip);
|
|
||||||
BinToStr(macstr, sizeof(macstr), d->MacAddress, 6);
|
|
||||||
Debug("Virtual DHC Server: Duplicated IP address detected. Static IP: %s, Used by MAC:%s\n", ipstr, macstr);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Examine whether the specified IP address is within the range of assignment
|
|
||||||
if (Endian32(v->DhcpIpStart) > Endian32(request_ip) ||
|
|
||||||
Endian32(request_ip) > Endian32(v->DhcpIpEnd))
|
|
||||||
{
|
|
||||||
// Accept if within the range
|
|
||||||
ret = request_ip;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Propose an IP in the range since it's a Discover although It is out of range
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret == 0)
|
|
||||||
{
|
|
||||||
// If there is any entry with the same MAC address
|
|
||||||
// that are already registered, use it with priority
|
|
||||||
DHCP_LEASE *d = SearchDhcpLeaseByMac(v, mac);
|
|
||||||
|
|
||||||
if (d != NULL)
|
|
||||||
{
|
|
||||||
// Examine whether the found IP address is in the allocation region
|
|
||||||
if (Endian32(v->DhcpIpStart) > Endian32(d->IpAddress) ||
|
|
||||||
Endian32(d->IpAddress) > Endian32(v->DhcpIpEnd))
|
|
||||||
{
|
|
||||||
// Use the IP address if it's found within the range
|
|
||||||
ret = d->IpAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret == 0)
|
|
||||||
{
|
|
||||||
// For static IP, the requested IP address must NOT be within the range of the DHCP pool
|
|
||||||
if (Endian32(v->DhcpIpStart) > Endian32(request_ip) ||
|
|
||||||
Endian32(request_ip) > Endian32(v->DhcpIpEnd))
|
|
||||||
{
|
|
||||||
ret = request_ip;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
// For static IP, the requested IP address must NOT be within the range of the DHCP pool
|
||||||
|
if (Endian32(request_ip) < Endian32(v->DhcpIpStart) || Endian32(request_ip) > Endian32(v->DhcpIpEnd))
|
||||||
|
{
|
||||||
|
return request_ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take an appropriate IP addresses that can be assigned newly
|
// Take an appropriate IP addresses that can be assigned newly
|
||||||
@ -9765,40 +9710,36 @@ void VirtualDhcpServer(VH *v, PKT *p)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Reply of DHCP_REQUEST must be either DHCP_ACK or DHCP_NAK.
|
// There is no IP address that can be provided
|
||||||
if (opt->Opcode == DHCP_REQUEST)
|
DHCP_OPTION_LIST ret;
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
// There is no IP address that can be provided
|
BUF *b = BuildDhcpOptionsBuf(o);
|
||||||
DHCP_OPTION_LIST ret;
|
if (b != NULL)
|
||||||
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);
|
UINT dest_ip = p->L3.IPv4Header->SrcIP;
|
||||||
if (b != NULL)
|
if (dest_ip == 0)
|
||||||
{
|
{
|
||||||
UINT dest_ip = p->L3.IPv4Header->SrcIP;
|
dest_ip = 0xffffffff;
|
||||||
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);
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user