From 6bcacb2fd17fadefbc9fb2eed9059eb36ae2783b Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Mon, 13 Sep 2021 10:51:23 -0700 Subject: Support anonymous structs in checklocks. Fixes #6558 PiperOrigin-RevId: 396393293 --- pkg/tcpip/stack/nic.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'pkg/tcpip/stack') diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index bb56ca9cb..a796942ab 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -41,17 +41,6 @@ func (l *linkResolver) confirmReachable(addr tcpip.Address) { var _ NetworkInterface = (*nic)(nil) -// TODO(https://gvisor.dev/issue/6558): Use an anonymous struct in nic for this -// once copylocks supports anonymous structs. -type packetEPs struct { - mu sync.RWMutex - - // eps is protected by the mutex, but the values contained in it are not. - // - // +checklocks:mu - eps map[tcpip.NetworkProtocolNumber]*packetEndpointList -} - // nic represents a "network interface card" to which the networking stack is // attached. type nic struct { @@ -85,7 +74,14 @@ type nic struct { promiscuous bool } - packetEPs packetEPs + packetEPs struct { + mu sync.RWMutex + + // eps is protected by the mutex, but the values contained in it are not. + // + // +checklocks:mu + eps map[tcpip.NetworkProtocolNumber]*packetEndpointList + } } // makeNICStats initializes the NIC statistics and associates them to the global -- cgit v1.2.3