mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Correctly lock when listing neighbor entries
PiperOrigin-RevId: 345162450
This commit is contained in:
committed by
gVisor bot
parent
93d29719cc
commit
0c49739422
@@ -182,14 +182,15 @@ func (n *neighborCache) removeWaker(addr tcpip.Address, waker *sleep.Waker) {
|
||||
|
||||
// entries returns all entries in the neighbor cache.
|
||||
func (n *neighborCache) entries() []NeighborEntry {
|
||||
entries := make([]NeighborEntry, 0, len(n.cache))
|
||||
n.mu.RLock()
|
||||
defer n.mu.RUnlock()
|
||||
|
||||
entries := make([]NeighborEntry, 0, len(n.cache))
|
||||
for _, entry := range n.cache {
|
||||
entry.mu.RLock()
|
||||
entries = append(entries, entry.neigh)
|
||||
entry.mu.RUnlock()
|
||||
}
|
||||
n.mu.RUnlock()
|
||||
return entries
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user