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

Merge pull request #1060 from dnobori/200101_fix_imperfect_lock

Merge pull request #1060: src/Cedar/Hub.c: fix possible crash because of imperfect Virtual Hub FDB lock
This commit is contained in:
Ilya Shipitsin 2020-01-01 12:33:15 +05:00 committed by GitHub
commit 9487bc8d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1563,13 +1563,15 @@ void HubWatchDogThread(THREAD *t, void *param)
o2 = NewListFast(NULL);
// Send an ARP packet
LockList(hub->IpTable);
LockHashList(hub->MacHashTable);
{
num = LIST_NUM(hub->IpTable);
for (i = 0;i < LIST_NUM(hub->IpTable);i++)
{
IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i);
if (e == NULL) continue;
if ((e->UpdatedTime + (UINT64)(IP_TABLE_EXPIRE_TIME)) > Tick64())
{
if (e->MacAddress[0] != 0xff || e->MacAddress[1] != 0xff || e->MacAddress[2] != 0xff ||
@ -1645,7 +1647,7 @@ void HubWatchDogThread(THREAD *t, void *param)
}
}
}
UnlockList(hub->IpTable);
UnlockHashList(hub->MacHashTable);
if ((LIST_NUM(o) + LIST_NUM(o2)) != 0)
{