From 979bbf238b479345bba46374b99f02bf257314d9 Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Fri, 9 Aug 2024 18:23:25 -0700 Subject: [PATCH] Mark structs as savable in netstack. PiperOrigin-RevId: 661475603 --- pkg/tcpip/link/veth/veth.go | 7 ++++--- pkg/tcpip/stack/nic.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/tcpip/link/veth/veth.go b/pkg/tcpip/link/veth/veth.go index 3deed6e6f5..c5df69ef70 100644 --- a/pkg/tcpip/link/veth/veth.go +++ b/pkg/tcpip/link/veth/veth.go @@ -25,10 +25,11 @@ import ( var _ stack.LinkEndpoint = (*Endpoint)(nil) var _ stack.GSOEndpoint = (*Endpoint)(nil) +// +stateify savable type veth struct { - mu sync.RWMutex + mu sync.RWMutex `state:"nosave"` closed bool - backlogQueue chan vethPacket + backlogQueue chan vethPacket `state:"nosave"` mtu uint32 endpoints [2]Endpoint } @@ -80,7 +81,7 @@ type Endpoint struct { // +checklocks:mu linkAddr tcpip.LinkAddress // +checklocks:mu - onCloseAction func() + onCloseAction func() `state:"nosave"` } // NewPair creates a new veth pair. diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index a4fcc8fba1..9625f6bb4b 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -103,7 +103,7 @@ func makeNICStats(global tcpip.NICStats) sharedStats { // +stateify savable type packetEndpointList struct { - mu packetEndpointListRWMutex + mu packetEndpointListRWMutex `state:"nosave"` // eps is protected by mu, but the contained PacketEndpoint values are not. //