Skip to content
Branch: mtu_probe-1
Commits on Aug 27, 2019
  1. packetdrill: test mtu probe with tx timestamp

    wdebruij committed Aug 27, 2019
    When building a large mtu probe packet, TCP may coalesce packets.
    Verify that it also correctly coalesces the tx timestamp request.
    This exposes a bug due to missing support in tcp_mtu_probe. Though
    with the following change to that function:
        -       size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache;
        +       size_needed = probe_size;
    1. TCP associates a timestamp request with the last byte from send()
    2. tcp_mtu_probe builds a probe from the oldest unacked bytes and
    3. sized_needed exceeds probe_size
    So the last byte in the current send call always > probe_size.
    So this bug is rare and not easy to trigger deterministically from a
    script without the above hack. But it may happen with more outstanding
    unacked data.
    Signed-off-by: Willem de Bruijn <>
  2. packetdrill: add tcp mtu probing

    wdebruij committed Aug 27, 2019
    Enable the tcp_mtu_probing sysctl, observe a probe and adjusted MSS.
    - enable the tcp_mtu_probing sysctl
    - open a connection with small route MTU
    - increase route MTU
    - send multiple segments
      - observe one larger probe segment
      - followed by multiple MSS sized segments
    - send multiple segments again
      - observe increased MSS
    The function tcp_mtu_probe has a number of prerequisites before probes
    are sent, mainly a minimal cwnd and size_needed. Ensure that these are
    met, somewhat complicating the packetdrill script.
    Signed-off-by: Willem de Bruijn <>
Commits on May 30, 2019
  1. Merge pull request google#12 from wdebruij/master

    nealcardwell committed May 30, 2019
    net-test: packetdrill: add script
Commits on May 28, 2019
  1. packetdrill: add tcp zerocopy fastopen tests

    wdebruij committed Jan 16, 2019
    Add tests that combine MSG_ZEROCOPY with MSG_FASTOPEN.
    The fastopen-client test verifies that an active fastopen with
    zerocopy will result in a zerocopy notification on the socket.
    The fastopen-server test verifies that a server with the SO_ZEROCOPY
    option set can send in SYN_RECV state. Also that this data generates
    a notification -- but as it uses the normal send path, that is more
    Based on earlier patches by Neal Cardwell and Yuchung Cheng.
    Signed-off-by: Willem de Bruijn <>
  2. packetdrill: add tcp zerocopy closed test

    wdebruij committed Jan 16, 2019
    Verify that a sendmsg() on a socket with SO_ZEROCOPY set does not
    increment the notification counter (sk_zckey) when sendmsg is called
    in a wrong tcp state.
    Signed-off-by: Willem de Bruijn <>
  3. net-test: packetdrill: add script

    wdebruij committed Nov 30, 2018
    Add a script to run all tests under a directory:
        ./packetdrill/ tcp
        Ran   15 tests:   15 passing,    0 failing,    0 timed out (6.03 sec): tcp/
    Tests run in parallel. Optionally pass -S to serialize.
    Optionally report separate results for each subdirectory.
        ./packetdrill/ -s tcp
        Ran    0 tests:    0 passing,    0 failing,    0 timed out (0.00 sec): tcp/common
        Ran   15 tests:   15 passing,    0 failing,    0 timed out (6.03 sec): tcp/zerocopy
    To debug errors, pass -v and optionally -l for logging.
    To demonstrate, also import initial scripts in directory
    and helpers in
    Import from the Linux kernel sources
    (also GPLv2, and I am the author)
Commits on Aug 30, 2018
  1. net-test: packetdrill: fix error msg in loose segment check path

    Wei Wang authored and nealcardwell committed Jul 2, 2018
    Fix the following misleading error msg introduced in commit:
      net-test: packetdrill: loose segmentation checks (non-strict by default now)
    which implements loose segment check:
    1. Subtract isn from tcp_seq/ack_seq for all segments so error msg
    displays those sequence number correctly
    2. when segment length is not expected, print expected and actual total
    length seen apart from the expected and actual length of this segment.
    Change-Id: I4138c357d5b69ac6025156ee7e91fa2bb128707a
  2. net-test: packetdrill: loose segmentation checks (non-strict by defau…

    Wei Wang authored and nealcardwell committed Aug 30, 2018
    …lt now)
    This patch adds "loose segmentation checks" for packetdrill.
    Now, by default, if a packetdrill test says the kernel under test
    should send a TCP segment with N bytes, the test will pass as long as
    the kernel under test sends some combination of in-order packets
    starting at that sequence number that add (in a reasonable way) up to
    N bytes.
    This allows tests written assuming TSO/GSO to pass whether the system
    under test is using TSO/GSO or not. The packetdrill interpreter will
    allow either. And if the TCP stack changes its TSO autosizing
    decisions, most tests should still pass.
    If you want the old-style behavior, with strict checks, pass the new
    command line flag: --strict_segments. Tests that are testing that TSO
    autosizing behaves in a certain way can use this flag.
    We want to improve remote mode support for existing packetdrill tests.
    This patch adds packet aggregation for outbound packet events to allow
    remote mode execution of scripts that expect TSO or GSO segmentation.
      This design idea is from Neal Cardwell <>.
      This change is mostly written by Gabriel Marin <>
      and small change made by Wei Wang <>.
    Change-Id: Ie30490fc40e52b1bf94f9fece74c3ad7cd1022b1
Commits on Jul 3, 2018
  1. net-test: packetdrill: define Linux capability symbols, to compile on…

    nealcardwell committed Jul 2, 2018
    … older systems
    A user on the public bbr-dev list reported the following compile error
    on "Red Hat Enterprise Linux Server release 6.7 (Santiago)" with an
    ancient kernel 2.6.32-573.26.1.el6.x86_64:
      cc -g -Wall -Werror   -c -o symbols_linux.o symbols_linux.c
      symbols_linux.c:467: error: 'CAP_SYSLOG' undeclared here ...
      symbols_linux.c:468: error: 'CAP_WAKE_ALARM' undeclared here ...
      symbols_linux.c:469: error: 'CAP_BLOCK_SUSPEND' undeclared here ...
      <builtin>: recipe for target 'symbols_linux.o' failed
      make: *** [symbols_linux.o] Error 1
    This commit adds #define clauses for the Linux capability symbols used
    by packetdrill, to enable compilation on older systems, while still
    compiling on newer systems that already define these symbols.
    Signed-off-by: Neal Cardwell <>
    Change-Id: Ie7775068b9c31745a3506b2c42d633939a3abc89
Commits on Jun 1, 2018
  1. net-test: packetdrill: allow any size for TCP_INFO and related buffer…

    nealcardwell committed May 30, 2018
    …s in code.c
    This is a fix for a bug reported this week upstream on the packetdrill
    We recently pushed an update to packetdrill that knows about more
    recent fields of tcp_info (192 bytes worth of fields). But some
    distributions have kernels that are older. In a recent bug report, the
    OS only exports 104 bytes, which met packetdrill's previous
    expectations, but does not meet the expectations of the more recent
    packetdrill release.
    In general, there is no easy way for packetdrill to tell how old the
    kernel is in order to validate the amount of data returned by
    tcp_info. So this commit removes this size check from the packetdrill
    tool. This will mean that fields not exported by the kernel under test
    will be zero (get_data() in code.c uses calloc()).
    There are other potential approaches, but this seems like a simple
    Reported-by: Wang Jian <>
    Signed-off-by: Neal Cardwell <>
    Change-Id: I968718c37b387cbb38eda570a1261e6b917aec8c
Commits on Apr 24, 2018
  1. net-test: packetdrill: merge Google packetdrill changes through April…

    nealcardwell committed Mar 10, 2018
    … 2018
    This commit merges into Google's public packetdrill repository the
    majority of the packetdrill tool changes made at Google in the period
    2013-2018 (after the initial open source release of packetdrill).
    Major features added in this commit include:
    + support for testing:
      + cmsg data
      + TCP send timestamping
      + TCP timestamping opt stats (TCP_NLA_BUSY and friends)
      + TCP zero-copy (e.g. see --send_omit_free)
      + TCP MD5 options
      + TCP urgent pointer field
      + experimental and RFC-compliant TCP Fast Open options
      + ICMP sockets
      + the IPv4 or IPv6 TOS field
      + IPv6 flow labels
      + in IPv6-only environments
    + wider system call support:
      + epoll system calls (epoll_create(), epoll_ctl(), epoll_wait())
      + pipe()
      + splice()
      + cap_set()
    + optional final clean-up commands for destructor-like tear-down
      commands that are basically always executed at termination, whether
      scripts fail or succeed
    + improved Python support:
      + exporting symbolic names for tcpi_state values
      + exporting recent additions to Linux struct tcp_info
      + exporting TCP_CC_INFO for Vegas, DCTCP, BBR
      + exporting SO_MEMINFO
    + the ability to test shared libraries that support the sockets API,
      rather than just the kernel sockets API (see packetdrill.h)
    + preprocessor-style symbol definitions, e.g. -Dfoo=bar
    + support for random local IP addresses
    Willem de Bruijn spearheaded this effort to upstream this batch of
    changes, and put in a huge amount of work to make this happen. I would
    like to thank him for all his work on this.
    I would also like to thank the following Googlers for their
    contributions over the years to the packetdrill code base, which are
    reflected in this patch:
      Wei Wang
      Maciej Żenczykowski
      Yuchung Cheng
      Eric Dumazet
      Soheil Hassas Yeganeh
      Dimitris Michailidis
      Willem de Bruijn
      Yaogong Wang
      Eric Salo
      Chonggang Li
      Priyaranjan Jha
      Andreas Terzis
      Xiao Jia
      Mike Maloney
      Barath Raghavan
      Yousuk Seung
      Nandita Dukkipati
      Michael Davidson
      Hsiao-keng Jerry Chu
      Greg Thelen
      Chema Gonzalez
      Luigi Rizzo
      Kevin Athey
      Jeff Grafton
      Francis Y. Yan
      Fabien Duchene
      Bill Sommerfeld
      Anatol Pomazau
    This commit has been verified to build cleanly with the default gcc
    compiler on the following Linux distributions:
      Debian 8
      Debian 9
      Red Hat Enterprise Linux 7.4
      Ubuntu 14.04
      Ubuntu 17.10
    This commit has not been tested on or ported to any BSD variants, due
    to lack of time among members of our team. We are happy to accept
    patches to get it to compile/run on popular BSD variants.
    Signed-off-by: Neal Cardwell <>
    Change-Id: I7e9ecb0b1376e9b5cbbfadc0949a07a9c7a444ff
Commits on Feb 5, 2017
  1. net-test: packetdrill: add GRO support to packetdrill

    Eric Dumazet authored and nealcardwell committed Feb 1, 2017
    As far as TCP is concerned, a GRO packet simply has a gso_size attribute,
    which express the size of every MSS included in the packet.
    A normal GRO packet would also have a gso_segs, but TCP stack does not
    use this information (yet). User space can not set it, linux stack
    uses the SKB_GSO_DODGY bit because we would not trust user space to
    provide this information.
    For the moment, we do not expect changing gso_size dynamically,
    but this could be done later if needed.
    --mss=xxxx can be used as a command line parameter or in
    a packetdrill scenario.
    Change-Id: I7431bbefde79619adab5fcc89bccb0b48d6b909d
Commits on Jan 8, 2017
  1. net-test: packetdrill: enable sniffer timestamps during initialization

    nealcardwell committed Jan 7, 2017
    It can cost a little more than 10ms to enable timestamps in
    net_enable_timestamp(), due to the static key operation.
    This commit uses a fix from Eric Dumazet: tweak packetdrill to pay the
    non-trivial latency cost to enable timestamps during initialization,
    before the test script starts, to avoid significant delays in the
    middle of tests.
    Since there is no timestamp yet from this socket, this call will
    return -1 with errno=ENOENT, but we don't care, and I would rather not
    bake in a dependency on that exact result by asserting that we always
    get exactly that error.
    Change-Id: Iac2915b1c5db7e3c7df1be0d81c3fef795d87e58
Commits on Nov 18, 2016
  1. net-test: packetdrill: allow negative return codes from socket(), acc…

    Eric Salo authored and nealcardwell committed Nov 11, 2015
    …ept(), and open()
    This commit makes it possible for a packetdrill script to declare that
    it expects failure (negative return code) from socket(), accept(), or
    open(). This patch is identical to one written by Neal Cardwell, plus
    also includes very simple unit tests for the new functionality.
    Change-Id: I4f1182d886ab49a1ea094b82cefe319e24514d8a
Commits on Jul 7, 2016
  1. net-test: packetdrill: implement sendfile syscall

    Thadeu Lima de Souza Cascardo authored and nealcardwell committed Jul 1, 2016
    Implement the sendfile system call. Offset is treated as only an input
    parameter, though still in brackets.
    sendfile is useful when we want the stack to send non linear skbs, as this is
    helpful for reproducing some bugs and scenarios.
    Signed-off-by: Thadeu Lima de Souza Cascardo <>
  2. net-test: packetdrill: implement open syscall

    Thadeu Lima de Souza Cascardo authored and nealcardwell committed Jul 1, 2016
    open system call is implement, as it makes it easier to use the sendfile system
    call as well.
    Signed-off-by: Thadeu Lima de Souza Cascardo <>
Commits on Jul 2, 2016
  1. Update

    nealcardwell committed Jul 2, 2016
  2. Create

    nealcardwell committed Jul 2, 2016
Commits on Jun 29, 2016
  1. net-test: packetdrill: fix packetdrill string len off by 1 error

    yuchungcheng authored and nealcardwell committed Apr 15, 2015
    When doing getsockopt, the c-string stored in the expression string may
    not be null terminated, so the latter strcmp() in syscall_getsockopt()
    may fail randomly.
    A similar fix was independently provided by Thadeu Lima de Souza
    Cascardo <> as:
      [PATCH] packetdrill: Zero out last string byte
    Change-Id: I946beb0b63afd378c454ecf65c57a1862f8407d7
Commits on May 9, 2014
  1. net-test: packetdrill: read outbound packets from tun device

    nealcardwell committed May 1, 2014
    In local mode, read the outbound packets from the tun device.
    A recent Linux patch "tcp: avoid retransmits of TCP packets hanging in
    host queues" means that TCP behavior now depends on whether and when
    the network device (tun device here) consumes the packets. We now read
    all these packets so that the kernel can exercise its normal code
    paths for packet transmit completion.
    An alternative approach would be to set the tun txqueuelen to 0, but
    this would impact qdisc behavior. It is more realistic, and has fewer
    side-effects, to make sure the network device has a non-zero queue
    length, but packets are still consumed.
    Change-Id: Ia922994d4eeea12e61d7876b4c4ef34bc9cef34e
Commits on Jan 24, 2014
  1. net-test: packetdrill: fix packet_append_header() calculations for re…

    nealcardwell committed Jan 21, 2014
    …mote mode
    Fix the packet header location calculations in packet_append_header()
    forgot to account for the fact that there might be layer 2 headers.
    Remote mode has been broken since the addition of encapsulation
    support, partly due to this issue.
    Change-Id: Idfb0670da8799e11fe1b72771ed13d52d8e991fe
  2. net-test: packetdrill: fix packet_buffer_to_string() length calculation

    nealcardwell committed Jan 19, 2014
    packet_buffer_to_string() needs to accont for the fact that
    packet->ip_bytes does not capture the full length of the packet (in
    remote mode there will be layer 2 ethernet headers as well).
    Change-Id: If2c95e68071545a27078141b6ba5f98cd2c46fb9
  3. net-test: packetdrill: fix bug in remote mode packet sniffing direction

    nealcardwell committed Jan 17, 2014
    Fix wire_server_netdev_receive() to reflect the fact that in remote
    mode the server is sniffing packets that are inbound (whereas in local
    mode we are sniffing *outbound* packets).
    This was a bug introduced in "net-test: packetdrill encap
    support: refactor packet receive loops into one loop".
    Remote mode has been broken since the addition of encapsulation
    support, partly due to this issue.
    Change-Id: Ia92f70f48ae90cb2e089ee51d728473a12c63595
Commits on Jan 11, 2014
  1. net-test: packetdrill: add a test for ICMPv4 packet parsing

    mneilsen authored and nealcardwell committed Jan 11, 2014
    Signed-off-by: Mike Neilsen <>
  2. net-test: packetdrill: add ICMPv4 and ICMPv6 packet parsing

    mneilsen authored and nealcardwell committed Nov 24, 2013
    Handle ICMPv4 and ICMPv6 parsing separately. Return PACKET_BAD if IP and
    ICMP versions mismatch.
    Signed-off-by: Mike Neilsen <>
    Signed-off-by: Neal Cardwell <>
  3. net-test: packetdrill: add packet_inner_header() helper

    nealcardwell committed Jan 3, 2014
    Add a little helper for accessing the inner-most header of a
    packet. In preparation for a patch to support parsing ICMP packets on
    the wire.
Commits on Dec 28, 2013
  1. net-test: packetdrill: Bugfix: Don't crash on FreeBSD when using an u…

    tuexen authored and nealcardwell committed Dec 25, 2013
    …ndefined symbol in a script.
    This patch adds the missing end of table marker in the platform_symbols_table
    for FreeBSD.
    Signed-off-by: Michael Tuexen <>
Commits on Dec 23, 2013
  1. net-test: packetdrill: Add support for the checksum used by SCTP.

    tuexen authored and nealcardwell committed Dec 23, 2013
    This commit adds support for the CRC32C checksum used by SCTP.
    Also add a unit-test for it.
    Signed-off-by: Michael Tuexen <>
  2. net-test: packetdrill: config: fixed typos

    matttbe authored and nealcardwell committed Dec 23, 2013
    Fixed typos in the 'usage' message: a few ']' were missing
    Signed-off-by: Matthieu Baerts <>
  3. net-test: packetdrill: fix non aligned memory access to TCP SACK option

    tuexen authored and nealcardwell committed Dec 22, 2013
    Fixes "make tests" on FreeBSD/arm.
Commits on Nov 30, 2013
  1. net-test: Adds the --dry_run flag to packetdrill to verify but not st…

    Barath Raghavan authored and nealcardwell committed Jul 1, 2013
    …art a run.
    The --dry_run command line flag causes packetdrill to verify command
    line args, load and parse the given script, but not execute it. If any
    errors are found during these steps, packetdrill will print an error
    as before.  Otherwise, it will exit(0) and produce no output.
    Change-Id: Ibf4502c6ea326539346a58b58d7feb29d4b3da69
  2. net-test: packetdrill MPLS support: test parsing MPLS label stacks in…

    nealcardwell committed Nov 23, 2013
    … packets
    Test the code to parse on-the-wire MPLS label stacks.
    Change-Id: I21884aa720de3c3319636b7391827b54049de574
  3. net-test: packetdrill MPLS support: test for printing MPLS label stacks

    nealcardwell committed Nov 23, 2013
    Test code to print on-the-wire MPLS label stacks in a human-readable
    format matching the script syntax.
    Change-Id: I7e5d0d8d07490fee1fb744bbd03804bb12e22ae4
  4. net-test: packetdrill MPLS support: verify outbound MPLS label stacks

    nealcardwell committed Nov 23, 2013
    Code to verify that the outbound on-the-wire MPLS label stacks from
    the kernel under test match those from the script.
    Change-Id: Ib7e4e4dc04cdd8d760c8099948f7cdda7973202a
You can’t perform that action at this time.