mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Merge pull request #1758 from domosekai/ipv6rs
Cedar/IPC: Change IPv6 router lookup to non-blocking
This commit is contained in:
commit
7c642c7d55
@ -2365,8 +2365,11 @@ bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVER
|
||||
IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL;
|
||||
bool isInPrefix = false;
|
||||
|
||||
if (LIST_NUM(ipc->IPv6RouterAdvs) == 0 && IPCSendIPv6RouterSoliciation(ipc) == false)
|
||||
if (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
|
||||
{
|
||||
// We have a unicast packet but we haven't got any RAs.
|
||||
// The client is probably misconfigured in IPv6. We send non-blocking RS at best effort.
|
||||
IPCSendIPv6RouterSoliciation(ipc, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2390,16 +2393,8 @@ bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVER
|
||||
}
|
||||
|
||||
// Send router solicitation to find a router
|
||||
bool IPCSendIPv6RouterSoliciation(IPC *ipc)
|
||||
bool IPCSendIPv6RouterSoliciation(IPC *ipc, bool blocking)
|
||||
{
|
||||
// If we don't have a valid client EUI, we can't generate a correct link local
|
||||
if (ipc->IPv6ClientEUI == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
|
||||
{
|
||||
IP destIP;
|
||||
IPV6_ADDR destV6;
|
||||
UCHAR destMacAddress[6];
|
||||
@ -2408,6 +2403,12 @@ bool IPCSendIPv6RouterSoliciation(IPC *ipc)
|
||||
UINT64 giveup_time = Tick64() + (UINT64)(IPC_IPV6_RA_MAX_RETRIES * IPC_IPV6_RA_INTERVAL);
|
||||
UINT64 timeout_retry = 0;
|
||||
|
||||
// If we don't have a valid client EUI, we can't generate a correct link local
|
||||
if (ipc->IPv6ClientEUI == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Zero(&linkLocal, sizeof(IPV6_ADDR));
|
||||
|
||||
// Generate link local from client's EUI
|
||||
@ -2426,6 +2427,12 @@ bool IPCSendIPv6RouterSoliciation(IPC *ipc)
|
||||
|
||||
packet = BuildICMPv6RouterSoliciation(&linkLocal, &destV6, ipc->MacAddress, 0);
|
||||
|
||||
if (blocking == false) {
|
||||
IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress);
|
||||
FreeBuf(packet);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
|
||||
{
|
||||
UINT64 now = Tick64();
|
||||
@ -2449,8 +2456,6 @@ bool IPCSendIPv6RouterSoliciation(IPC *ipc)
|
||||
}
|
||||
|
||||
FreeBuf(packet);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui);
|
||||
// RA
|
||||
void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip);
|
||||
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA);
|
||||
bool IPCSendIPv6RouterSoliciation(IPC *ipc);
|
||||
bool IPCSendIPv6RouterSoliciation(IPC *ipc, bool blocking);
|
||||
// Data flow
|
||||
BLOCK *IPCIPv6Recv(IPC *ipc);
|
||||
void IPCIPv6Send(IPC *ipc, void *data, UINT size);
|
||||
|
Loading…
Reference in New Issue
Block a user