summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/nic.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-01-14 01:30:11 +0000
committergVisor bot <gvisor-bot@google.com>2021-01-14 01:30:11 +0000
commit6cc587a931cb704006e5d843f725b4be2d1523c9 (patch)
treec1d79a2e8c140e5780b7614d0b6d2f60b877d0f7 /pkg/tcpip/stack/nic.go
parentfc9aec0925d6ff6bdbc8a0c0866f6199ea054d9f (diff)
parentc49ce8ca8ab988fd548419c522caf45bda90317b (diff)
Merge release-20201216.0-106-gc49ce8ca8 (automated)
Diffstat (limited to 'pkg/tcpip/stack/nic.go')
-rw-r--r--pkg/tcpip/stack/nic.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go
index 4a34805b5..8a946b4fa 100644
--- a/pkg/tcpip/stack/nic.go
+++ b/pkg/tcpip/stack/nic.go
@@ -217,6 +217,16 @@ func (n *NIC) disableLocked() {
ep.Disable()
}
+ // Clear the neighbour table (including static entries) as we cannot guarantee
+ // that the current neighbour table will be valid when the NIC is enabled
+ // again.
+ //
+ // This matches linux's behaviour at the time of writing:
+ // https://github.com/torvalds/linux/blob/71c061d2443814de15e177489d5cc00a4a253ef3/net/core/neighbour.c#L371
+ if err := n.clearNeighbors(); err != nil && err != tcpip.ErrNotSupported {
+ panic(fmt.Sprintf("n.clearNeighbors(): %s", err))
+ }
+
if !n.setEnabled(false) {
panic("should have only done work to disable the NIC if it was enabled")
}