diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-02-06 10:44:59 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-06 10:47:28 -0800 |
commit | a83c8585aff55fb5fa2b8b61bf8e1c79d23d59bf (patch) | |
tree | 0d3042fd974d9c298446472c4ea57a986a9125e1 /pkg/tcpip/stack/nic.go | |
parent | 9530f624e971183a0e72fe5123f542e0a4e1b329 (diff) |
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
Diffstat (limited to 'pkg/tcpip/stack/nic.go')
-rw-r--r-- | pkg/tcpip/stack/nic.go | 8 |
1 files changed, 1 insertions, 7 deletions
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) |