From a83c8585aff55fb5fa2b8b61bf8e1c79d23d59bf Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Sat, 6 Feb 2021 10:44:59 -0800 Subject: Use embedded mutex pattern in neighbor cache/entry Also while I'm here, update neighbor cahce/entry tests to use the stack's RNG instead of creating a neigbor cache/entry specific one. PiperOrigin-RevId: 356040581 --- pkg/tcpip/stack/nic.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'pkg/tcpip/stack/nic.go') diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 6c09ba5ff..f85652093 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -190,13 +190,7 @@ func newNIC(stack *Stack, id tcpip.NICID, name string, ep LinkEndpoint, ctx NICC } if stack.useNeighborCache { - l.neighborTable = &neighborCache{ - nic: nic, - state: NewNUDState(stack.nudConfigs, stack.randomGenerator), - linkRes: r, - - cache: make(map[tcpip.Address]*neighborEntry, neighborCacheSize), - } + l.neighborTable = newNeighborCache(nic, r) } else { cache := new(linkAddrCache) cache.init(nic, ageLimit, resolutionTimeout, resolutionAttempts, r) -- cgit v1.2.3