Use fine grained locks while sending NUD probes

Previously when sending probe messages, we would hold a shared lock
which lead to deadlocks (due to synchronous packet loooping (e.g. pipe
and loopback link endpoints)) and lock contention.

Writing packets may be an expensive operation which could prevent other
goroutines from doing meaningful work if a shared lock is held while
writing packets.

This change upates the NUD timers to not hold shared locks while
sending packets.

PiperOrigin-RevId: 356048697

This is a cherry-pick of 1d0fbea. This changed required manual updates
as it does not include 56d1850 or 4eaf674.

Bug: 72285
Change-Id: I2d4be5d90de768cb36c0a360d5d5d50d29726bf5
1 file changed
tree: f1ace742c2456ec2321b7afffc40ce9ced049b72
  1. pkg/
  3. go.mod
  4. go.sum