diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-07-13 19:03:18 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-13 19:03:18 +0000 |
commit | 0a49098e2b456f23af79341530d79f9128b58bb5 (patch) | |
tree | dde9d942d1dae331e62bdde25f067286c3b8a390 /pkg/tcpip/stack/iptables_state.go | |
parent | 4e931be12f70e320c7d750fba1c3a3c6b008ddb6 (diff) | |
parent | 43c209f48e0aa9024705583cc6f0fafa7d6380ca (diff) |
Merge release-20200622.1-97-g43c209f48 (automated)
Diffstat (limited to 'pkg/tcpip/stack/iptables_state.go')
-rw-r--r-- | pkg/tcpip/stack/iptables_state.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/iptables_state.go b/pkg/tcpip/stack/iptables_state.go new file mode 100644 index 000000000..529e02a07 --- /dev/null +++ b/pkg/tcpip/stack/iptables_state.go @@ -0,0 +1,40 @@ +// Copyright 2020 The gVisor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stack + +import ( + "time" +) + +// +stateify savable +type unixTime struct { + second int64 + nano int64 +} + +// saveLastUsed is invoked by stateify. +func (cn *conn) saveLastUsed() unixTime { + return unixTime{cn.lastUsed.Unix(), cn.lastUsed.UnixNano()} +} + +// loadLastUsed is invoked by stateify. +func (cn *conn) loadLastUsed(unix unixTime) { + cn.lastUsed = time.Unix(unix.second, unix.nano) +} + +// beforeSave is invoked by stateify. +func (ct *ConnTrack) beforeSave() { + ct.mu.Lock() +} |