summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/conntrack.go
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-02-04 17:58:58 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-04 18:00:54 -0800
commit71def1c5869af69e4127f2b07ebd7d5c62642597 (patch)
tree1cdb54640cd30bf9b199161cdab0ee422a1ce40c /pkg/tcpip/stack/conntrack.go
parent41510d2746756818269b0bf8f3961f026a0c247c (diff)
Lock ConnTrack before initializing buckets
PiperOrigin-RevId: 355751801
Diffstat (limited to 'pkg/tcpip/stack/conntrack.go')
-rw-r--r--pkg/tcpip/stack/conntrack.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/conntrack.go b/pkg/tcpip/stack/conntrack.go
index 54617f2e6..cdb435644 100644
--- a/pkg/tcpip/stack/conntrack.go
+++ b/pkg/tcpip/stack/conntrack.go
@@ -231,6 +231,12 @@ func newConn(orig, reply tupleID, manip manipType, hook Hook) *conn {
return &conn
}
+func (ct *ConnTrack) init() {
+ ct.mu.Lock()
+ defer ct.mu.Unlock()
+ ct.buckets = make([]bucket, numBuckets)
+}
+
// connFor gets the conn for pkt if it exists, or returns nil
// if it does not. It returns an error when pkt does not contain a valid TCP
// header.