diff options
author | Eyal Soha <eyalsoha@google.com> | 2020-04-15 19:36:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-15 19:37:00 -0700 |
commit | 09c7e3f6e497f4ae267772e7357763ac7c18659f (patch) | |
tree | 71471f98505dc40797ba0ac3ffaf8042bf9a1541 /test/packetimpact/testbench | |
parent | 3d3bf9603d9a933b4bf19c38190c583894b75d66 (diff) |
Add tests for segments outside the receive window.
The tests are based on RFC 793 page 69.
Updates #1607
PiperOrigin-RevId: 306768847
Diffstat (limited to 'test/packetimpact/testbench')
-rw-r--r-- | test/packetimpact/testbench/connections.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/packetimpact/testbench/connections.go b/test/packetimpact/testbench/connections.go index 169db01b0..be62d051d 100644 --- a/test/packetimpact/testbench/connections.go +++ b/test/packetimpact/testbench/connections.go @@ -577,13 +577,27 @@ func (conn *TCPIPv4) Expect(tcp TCP, timeout time.Duration) (*TCP, error) { return gotTCP, err } -// RemoteSeqNum returns the next expected sequence number from the DUT. -func (conn *TCPIPv4) RemoteSeqNum() *seqnum.Value { +func (conn *TCPIPv4) state() *tcpState { state, ok := conn.layerStates[len(conn.layerStates)-1].(*tcpState) if !ok { conn.t.Fatalf("expected final state of %v to be tcpState", conn.layerStates) } - return state.remoteSeqNum + return state +} + +// RemoteSeqNum returns the next expected sequence number from the DUT. +func (conn *TCPIPv4) RemoteSeqNum() *seqnum.Value { + return conn.state().remoteSeqNum +} + +// LocalSeqNum returns the next expected sequence number from the DUT. +func (conn *TCPIPv4) LocalSeqNum() *seqnum.Value { + return conn.state().localSeqNum +} + +// SynAck returns the SynAck that was part of the handshake. +func (conn *TCPIPv4) SynAck() *TCP { + return conn.state().synAck } // Drain drains the sniffer's receive buffer by receiving packets until there's |