Permalink
Switch branches/tags
Nothing to show
Commits on Aug 30, 2018
  1. net-test: packetdrill: fix error msg in loose segment check path

    Wei Wang Neal Cardwell
    Wei Wang authored and Neal Cardwell 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 Neal Cardwell
    Wei Wang authored and Neal Cardwell 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.
    
    ---
    
    Background:
    
    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.
    
    Note:
      This design idea is from Neal Cardwell <ncardwell@google.com>.
      This change is mostly written by Gabriel Marin <gmx@google.com>
      and small change made by Wei Wang <weiwan@google.com>.
    
    Change-Id: Ie30490fc40e52b1bf94f9fece74c3ad7cd1022b1
Commits on Jul 3, 2018
  1. net-test: packetdrill: define Linux capability symbols, to compile on…

    Neal Cardwell
    Neal Cardwell 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 <ncardwell@google.com>
    Change-Id: Ie7775068b9c31745a3506b2c42d633939a3abc89
Commits on Jun 1, 2018
  1. net-test: packetdrill: allow any size for TCP_INFO and related buffer…

    Neal Cardwell
    Neal Cardwell committed May 30, 2018
    …s in code.c
    
    This is a fix for a bug reported this week upstream on the packetdrill
    list:
    
      https://groups.google.com/d/msg/packetdrill/N_-UyvGrtIM/QKEtQljTCgAJ
    
    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
    fix.
    
    Reported-by: Wang Jian <jianjian.wang1@gmail.com>
    Signed-off-by: Neal Cardwell <ncardwell@google.com>
    Change-Id: I968718c37b387cbb38eda570a1261e6b917aec8c
Commits on Apr 24, 2018
  1. net-test: packetdrill: merge Google packetdrill changes through April…

    Neal Cardwell
    Neal Cardwell 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 <ncardwell@google.com>
    
    Change-Id: I7e9ecb0b1376e9b5cbbfadc0949a07a9c7a444ff
Commits on Feb 5, 2017
  1. net-test: packetdrill: add GRO support to packetdrill

    Eric Dumazet Neal Cardwell
    Eric Dumazet authored and Neal Cardwell 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

    Neal Cardwell
    Neal Cardwell 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 Neal Cardwell
    Eric Salo authored and Neal Cardwell 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 Neal Cardwell
    Thadeu Lima de Souza Cascardo authored and Neal Cardwell 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 <cascardo@redhat.com>
  2. net-test: packetdrill: implement open syscall

    Thadeu Lima de Souza Cascardo Neal Cardwell
    Thadeu Lima de Souza Cascardo authored and Neal Cardwell 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 <cascardo@redhat.com>
Commits on Jul 2, 2016
  1. Update README.md

    nealcardwell committed Jul 2, 2016
  2. Create README.md

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

    Yuchung Cheng Neal Cardwell
    Yuchung Cheng authored and Neal Cardwell 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 <cascardo@redhat.com> 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

    Neal Cardwell
    Neal Cardwell 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…

    Neal Cardwell
    Neal Cardwell 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

    Neal Cardwell
    Neal Cardwell 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

    Neal Cardwell
    Neal Cardwell 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 Neal Cardwell committed Jan 11, 2014
    Signed-off-by: Mike Neilsen <mneilsen@acm.org>
  2. net-test: packetdrill: add ICMPv4 and ICMPv6 packet parsing

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

    Neal Cardwell
    Neal Cardwell 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 Neal Cardwell 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 <tuexen@fh-muenster.de>
Commits on Dec 23, 2013
  1. net-test: packetdrill: Add support for the checksum used by SCTP.

    tuexen authored and Neal Cardwell 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 <tuexen@fh-muenster.de>
  2. net-test: packetdrill: config: fixed typos

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

    tuexen authored and Neal Cardwell committed Dec 22, 2013
    Fixes "make tests" on FreeBSD/arm.
    
    Signed-off-by: tuexen@fh-muenster.de
Commits on Nov 30, 2013
  1. net-test: Adds the --dry_run flag to packetdrill to verify but not st…

    Barath Raghavan Neal Cardwell
    Barath Raghavan authored and Neal Cardwell 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…

    Neal Cardwell
    Neal Cardwell 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

    Neal Cardwell
    Neal Cardwell 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

    Neal Cardwell
    Neal Cardwell 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
  5. net-test: packetdrill MPLS support: print MPLS label stacks

    Neal Cardwell
    Neal Cardwell committed Nov 23, 2013
    Code to print MPLS label stacks in a human-readable format matching
    the script syntax:
    
      mpls (label 123, tc 1, [S], ttl 255) (label 456, tc 1, [S], ttl 255)
    
    Change-Id: I706be8aab089fbad79eabde67125345330728517
  6. net-test: packetdrill MPLS support: parse MPLS label stacks in packets

    Neal Cardwell
    Neal Cardwell committed Nov 22, 2013
    Code to parse on-the-wire packets using an encapsulation layer that is an
    MPLS label stack.
    
    Change-Id: I62585d491303cd8bd85c8afe5b652c4f1be572d9
  7. net-test: packetdrill MPLS support: parse MPLS label stacks in scripts

    Neal Cardwell
    Neal Cardwell committed Nov 28, 2013
    Code to parse script packets using an encapsulation layer that is an
    MPLS label stack.
    
    The syntax looks like:
    
      mpls (label 123, tc 1, [S], ttl 255) (label 456, tc 1, [S], ttl 255)
    
    This is borrowed from the syntax from tcpdump, which is:
    
      MPLS (label 123, exp 1, [S], ttl 255) (label 456, exp 1, [S], ttl 255)
    
    We use "tc" because RFC 5462 renamed the EXP ("experimental") field to
    the TC ("traffic class") field. We use lower-case "mpls" instead of
    "MPLS" for consistency with other packetdrill protocols, and for ease
    of typing.
    
    Change-Id: I2e797aead8605da9fe3f0461594cf7273d4ef0ec
  8. net-test: packetdrill MPLS support: appending MPLS headers to packets

    Neal Cardwell
    Neal Cardwell committed Nov 22, 2013
    Basic code for filling in MPLS headers and appending them to packets.
    
    Change-Id: Id31ef8e97de3e9b95c3b05ff42aade6a3d8490a5
  9. net-test: packetdrill MPLS support: MPLS header definitions

    Neal Cardwell
    Neal Cardwell committed Nov 22, 2013
    Basic definitions for reading and writing MPLS label stacks.
    
    Change-Id: I4190b816082fe57a6cbececfee368aabeab57daa
  10. net-test: packetdrill fix: add "recursion_control" field for big-endi…

    Neal Cardwell
    Neal Cardwell committed Nov 21, 2013
    …an GRE header
    
    The big endian folks would also need a recursion_control field too,
    now wouldn't they?
    
    Change-Id: Ie535241873d3a576d76993e14a803319e3c07250