diff options
author | Toshi Kikuchi <toshik@google.com> | 2020-09-29 11:27:43 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-29 11:29:50 -0700 |
commit | f15182243e508b0754d59350a886397e2a0ba0b2 (patch) | |
tree | a63485d3f7e2ec2365b0962eecdf683330a0852f /pkg/tcpip/faketime | |
parent | b6fb11a290518c569147da48cb2427740b04a041 (diff) |
Discard IP fragments as soon as it expires
Currently expired IP fragments are discarded only if another fragment for the
same IP datagram is received after timeout or the total size of the fragment
queue exceeded a predefined value.
Test: fragmentation.TestReassemblingTimeout
Fixes #3960
PiperOrigin-RevId: 334423710
Diffstat (limited to 'pkg/tcpip/faketime')
-rw-r--r-- | pkg/tcpip/faketime/faketime.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/tcpip/faketime/faketime.go b/pkg/tcpip/faketime/faketime.go index 1193f1d7d..f7a4fbde1 100644 --- a/pkg/tcpip/faketime/faketime.go +++ b/pkg/tcpip/faketime/faketime.go @@ -24,6 +24,26 @@ import ( "gvisor.dev/gvisor/pkg/tcpip" ) +// NullClock implements a clock that never advances. +type NullClock struct{} + +var _ tcpip.Clock = (*NullClock)(nil) + +// NowNanoseconds implements tcpip.Clock.NowNanoseconds. +func (*NullClock) NowNanoseconds() int64 { + return 0 +} + +// NowMonotonic implements tcpip.Clock.NowMonotonic. +func (*NullClock) NowMonotonic() int64 { + return 0 +} + +// AfterFunc implements tcpip.Clock.AfterFunc. +func (*NullClock) AfterFunc(time.Duration, func()) tcpip.Timer { + return nil +} + // ManualClock implements tcpip.Clock and only advances manually with Advance // method. type ManualClock struct { |