Commit Graph

9 Commits

Author SHA1 Message Date
Zach Koopmans 8a2f7e716d [syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.

PiperOrigin-RevId: 365651233
2021-03-29 13:30:21 -07:00
Mithun Iyer b9c2174b08 Fix race in tcp_retransmits_test
The test queries for RTO via TCP_INFO and applies that to the
rest of the test. The RTO is estimated by processing incoming ACK.
There is a race in the test where we may query for RTO before the
incoming ACK was processed. Fix the race in the test by letting the
DUT complete a payload receive, thus estimating RTO before proceeding
to query the RTO. Bump up the time correction to reduce flakes.

PiperOrigin-RevId: 362865904
2021-03-14 22:30:25 -07:00
Zeling Feng 2a888a106d Give TCP flags a dedicated type
- Implement Stringer for it so that we can improve error messages.
- Use TCPFlags through the code base. There used to be a mixed usage of byte,
  uint8 and int as TCP flags.

PiperOrigin-RevId: 361940150
2021-03-09 18:00:03 -08:00
Nayana Bidari 3145fe1d1e Use TCP_INFO to get RTO in tcp_retransmits_test
- TCP_INFO is used to get the RTO instead of calculating it manually.

PiperOrigin-RevId: 358032487
2021-02-17 14:25:29 -08:00
Zeling Feng d4951e05a0 [1/3] Support isolated containers for parallel packetimpact tests
Summary of the approach: the test runner will set up a few DUTs according to
a flag and pass all the test networks to the testbench. The testbench will only
reside in a single container. The testbench will put all the test networks into
a buffered channel which served as a semaphore and now the user can freely use
t.Parallel() in (sub)tests and the true parallelism will be determined by how
many DUTs are configured. Creating DUTs on demand is not supported yet, the
test author should determine the number of DUTs to be used statically.

Specifically in this change:
- Don't export any global variables about the test network in testbench.
- Sniffer only binds on the local interface because it will be possible to have
  multiple interfaces to multiple DUTs in a single testbench container.
- Migrate existing tests to stop using global variables.

PiperOrigin-RevId: 343965962
2020-11-23 18:13:07 -08:00
Jay Zhuang cf7141fb43 Ask for *testing.T instead of storing it
Storing *testing.T on test helper structs is problematic when
subtests are used, because it is possible for nested tests to call
Fatal on parent test, which incorrect terminates the parent test.

For example

  func TestOuter(t *testing.T) {
    dut := NewDUT(t)

    t.Run("first test", func(t *testing.T) {
      dut.FallibleCall()
    })

    t.Run("second test", func(t *testing.T) {
      dut.FallibleCall()
    }
  }

In the example above, assuming `FallibleCall` calls `t.Fatal` on the
`t` it holds, if `dut.FallibleCall` fails in "first test", it will
call `Fatal` on the parent `t`, quitting `TestOuter`. This is not a
behavior we want.

PiperOrigin-RevId: 323350241
2020-07-27 06:39:06 -07:00
Mithun Iyer 61d6c059ac Replace use of %v in packetimpact tests
PiperOrigin-RevId: 316027588
2020-06-11 19:46:49 -07:00
Mithun Iyer f766366091 Handle TCP segment split cases as per MSS.
- Always split segments larger than MSS.
  Currently, we base the segment split decision as a function of the
  send congestion window and MSS, which could be greater than the MSS
  advertised by remote.
- While splitting segments, ensure the PSH flag is reset when there
  are segments that are queued to be sent.
- With TCP_CORK, hold up segments up until MSS. Fix a bug in computing
  available send space before attempting to coalesce segments.

Fixes #2832

PiperOrigin-RevId: 314802928
2020-06-05 11:28:24 -07:00
Mithun Iyer f1ad2d54ab Fix TCP segment retransmit timeout handling.
As per RFC 1122 and Linux retransmit timeout handling:
- The segment retransmit timeout needs to exponentially increase and
  cap at a predefined value.
- TCP connection needs to timeout after a predefined number of
  segment retransmissions.
- TCP connection should not timeout when the retranmission timeout
  exceeds MaxRTO, predefined upper bound.

Fixes #2673

PiperOrigin-RevId: 311463961
2020-05-13 21:26:54 -07:00