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

Bugfix: Imperfect Virtual Hub FDB lock may cause process crush.

This commit is contained in:
Daiyuu Nobori 2020-01-01 10:57:51 +09:00
parent 41e023b369
commit f083c59905

View File

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