Coder Social home page Coder Social logo

google / packetdrill Goto Github PK

View Code? Open in Web Editor NEW
875.0 43.0 225.0 624 KB

The official Google release of packetdrill

License: GNU General Public License v2.0

C 90.57% Emacs Lisp 0.64% Shell 0.37% Lex 0.92% Yacc 4.95% Python 1.16% CMake 0.30% Vim Script 1.09%

packetdrill's Introduction

packetdrill

This is the official Google release of packetdrill.

The packetdrill scripting tool enables quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks, from the system call layer down to the NIC hardware. packetdrill currently works on Linux, FreeBSD, OpenBSD, and NetBSD. It can test network stack behavior over physical NICs on a LAN, or on a single machine using a tun virtual network device.

The code is GPLv2. Currently the source for the testing tool and a number of test scripts is in the git repository. We will continue to post more tests from our team's Linux TCP test suite (described in our USENIX paper), as time permits.

Links:

External links:

How To Get Started with packetdrill

First, download the dependencies that you will need in order to build and run packetdrill. If you are on a Linux system based on Debian/Ubuntu then you can use a command like:

sudo apt install git gcc make bison flex python net-tools

To check out and build packetdrill:

git clone https://github.com/google/packetdrill.git
cd packetdrill/gtests/net/packetdrill
./configure
make

How To Run All Local Tests for Linux

If you are on a machine with a recent Linux kernel you can su to root and run all of the TCP stack tests included in the packetdrill distribution in the tcp/ directory:

cd ..
./packetdrill/run_all.py -S -v -L -l tcp/

packetdrill's Design

Execution Model

packetdrill parses an entire test script, and then executes each timestamped line in real time -- at the pace described by the timestamps -- to replay and verify the scenario. The packetdrill interpreter has one thread for the main flow of events and another for executing any system calls that the script expects to block (e.g., poll()).

For convenience, scripts use an abstracted notation for packets. Internally, packetdrill models aspects of TCP and UDP behavior; to do this, packetdrill maintains mappings to translate between the values in the script and those in the live packet. The translation includes IP, UDP, and TCP header fields, including TCP options such as SACK and timestamps. Thus packetdrill tracks each socket and its IP addresses, port numbers, TCP sequence numbers, and TCP timestamps.

Local and Remote Testing

packetdrill enables two modes of testing: local mode, using a TUN virtual network device, or remote mode, using a physical NIC.

In local mode, packetdrill uses a single machine and a TUN virtual network device as a source and sink for packets. This tests the system call, sockets, TCP, and IP layers, and is easier to use because there is less timing variation, and users need not coordinate access to multiple machines.

In remote mode, users run two packetdrill processes, one of which is on a remote machine and speaks to the system under test over a LAN. This approach tests the full networking system: system calls, sockets, TCP, IP, software and hardware offload mechanisms, the NIC driver, NIC hardware, wire, and switch; however, due to the inherent variability in the many components under test, remote mode can result in larger timing variations, which can cause spurious test failures.

The packet plumbing is, naturally, a bit different in local and remote modes. To capture outgoing packets packetdrill uses a packet socket (on Linux) or libpcap (on BSD-derived OSes). To inject packets locally packetdrill uses a TUN device; to inject packets over the physical network in remote mode packetdrill again uses a packet socket or libpcap. To consume test packets in local mode packetdrill uses a TUN device; remotely, packets go over the physical network and packetdrill sets up filtering rules to drop the packets before layer 4 (UDP or TCP) processing in the remote kernel sees them.

Local Mode

Local mode is the default, so to use it you need no special command line flags; you only need to provide the path of the script to execute:

./packetdrill foo.pkt

Remote Mode

To use remote mode, on the machine under test (the "client" machine), specify the --wire_server_at option to specify the DNS name or IP address of the remote server machine to which the client packetdrill instance will connect. Only the client instance takes a packetdrill script argument, which can be the path of any ordinary packetdrill test script:

client# ./packetdrill --wire_server_at=<server_name_or_ip> foo.pkt

On the remote machine, run the following to have a packetdrill process act as a "wire server" daemon to inject and sniff packets remotely on the wire:

server# ./packetdrill --wire_server

How does this work? First, the client packetdrill instance connects to the server packetdrill instance (using TCP), and sends the command line options and the contents of the script file to the server instance. Then the client and server packetdrill instances work in concert to execute the script and test the client machine's network stack.

IP Addresses for packetdrill Tests

Remote or local mode tests may optionally specify arbitrary IP addresses to use for the test traffic, using the following command line arguments:

--local_ip=<local_ip_addr>     # test traffic address for machine under test
--netmask_ip=<netmask_ip>      # test traffic netmask (if testing IPv4)
--gateway_ip=<gateway_ip_addr> # test traffic address for gateway
--remote_ip=<remote_ip_addr>   # test traffic address for remote endpoint

By default, remote mode tests use the "primary" IP address of the client and server machines for the test traffic (where the "primary" address is the IP address to which the hostname resolves). With this configuration, the client and server can be anywhere in the same layer-3 routable domain (though it is highly recommended to only use packetrill in an internal RFC 1918 IP address space, for "lab" testing, rather than in the public Internet).

When a remote mode test uses arbitrary IP addresses, the packetdrill client and server processes must be on the same layer 2 broadcast domain (e.g., on the same Ethernet switch), so that the server machine may act as a gateway to reach the remote IP address configured via the --remote_ip command line argument.

How To Submit a Patch for packetdrill

We welcome patches with bug fixes or new features for packetdrill. The packetdrill project uses git for source code management. Please follow the following steps when sending in a patch for packetdrill:

  1. join the packetdrill e-mail list, so your e-mails to the list will be accepted by Google groups
  2. edit some files, compile, test
  3. verify that you can certify the origin of this code with a Signed-off-by footer, according to the standards of the Linux open source project
  4. git commit your change with a message like:
packetdrill: add amazing feature foo

This commit adds amazing feature foo, which ...

Tested on FooOS and BarOS by doing the following:
 ...

Signed-off-by: John Doe <[email protected]>
  1. Generate git patches using: git format-patch HEAD~1
  2. Check style for the patches by running checkpatch.pl from the Linux source tree, e.g.:
wget http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl
chmod u+x checkpatch.pl
./checkpatch.pl --no-tree --ignore FSF_MAILING_ADDRESS 00*.patch
  1. You can submit your patch as either a GitHub pull request or an e-mail patch series, with something like:
git send-email --to [email protected] 00*.patch

packetdrill's People

Contributors

ac000 avatar cheerfuldustin avatar dcaratti avatar ericsalo avatar jancd avatar jianfenw avatar ligurio avatar matttbe avatar mneilsen avatar murraystokely avatar nealcardwell avatar roxell avatar rscheff avatar soheilhy avatar tracywwnj avatar tuexen avatar wdebruij avatar yousukseung avatar yuchungcheng avatar zenczykowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packetdrill's Issues

No so_instance cleanup can be done if PacketDrill test fails

Hi,

I am working with using PacketDrill to test some network stacks using a shared object file.
I just noticed that when a test line in the PacketDrill script fails, the application exits without calling the free() function in the shared object file.

At the conclusion of each test, state_free (defined in run.c:122) is called and this frees the netdev and packet buffers and calls the free function in the so_instance where subsequent buffers in the shared object file can be freed.

	close_all_fds(state);

	netdev_free(state->netdev);
	packets_free(state->packets);
	code_free(state->code);

	if (state->wire_client)
		wire_client_free(state->wire_client);

	if (state->so_instance)
		so_instance_free(state->so_instance);

In run_system_call.c:3338, If an error occurs, the die function is called

die("%s:%d: runtime error in %s call: %s\n",
	  state->config->script_path, event->line_number,
	  syscall->name, error);
free(error);

And in the implementation of die in logging.c, no function is called to free the state

extern void __attribute__((noreturn)) die(char *format, ...)
{
	va_list ap;

	va_start(ap, format);
	vfprintf(stderr, format, ap);
	va_end(ap);

	run_cleanup_command();

	exit(EXIT_FAILURE);
}

As a result, when an error occurs during a test, the cleanup is not done completely.

Is this an expected behavior? If I want to call a function on my shared object file at the failure of each test, does the current PacketDrill implementation provide any support?

Execute testcase tcp/epoll/epoll_out_edge_notsent_lowat.pkt failed

I ran the singel testcase tcp/epoll/epoll_out_edge_notsent_lowat.pkt. but it failed
1632639348(1)

So I changed this line to be:
+0 > . 1:10001(10000) ack 1 win 256

Then I ran the testcase, it faileg again.
1632639458(1)

If I change the return value, it still cant execute pass.
1632639528(1)

Below is my environment:
1632639610(1)

packetdrill run script error!

[root@1-16-3-66 packetdrill]# ./packetdrill tests/linux/connect/http-get-nonblocking-ts.pkt
tests/linux/connect/http-get-nonblocking-ts.pkt:11: error handling packet: live packet field ipv4_total_length: expected: 60 (0x3c) vs actual: 44 (0x2c)
script packet: 0.100000 S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 6>
actual packet: 0.100239 S 0:0(0) win 7300 <mss 1460>

thanks

Some tests are unstable

Unstable tests mean they sometimes pass and some other times fail,and some tests may not be run all the time.

1 packetdrill/gtests/net/tcp/blocking_blocking-accept_ipv4. is unstable.
2 packetdrill/gtests/net/tcp/blocking_blocking-write_ipv4-mapped-v6. is unstable.
3 packetdrill/gtests/net/tcp/cwnd_moderation_cwnd-moderation-disorder-no-moderation_ipv4-mapped-v6. is unstable.
4 packetdrill/gtests/net/tcp/shutdown_shutdown-rd-wr-close_ipv6. is unstable.
5 packetdrill/gtests/net/tcp/blocking_blocking-accept_ipv4-mapped-v6. is unstable.
6 packetdrill/gtests/net/tcp/blocking_blocking-connect_ipv6. is unstable.
7 packetdrill/gtests/net/tcp/epoll_epoll_in_edge_ipv6. is unstable.
8 packetdrill/gtests/net/tcp/shutdown_shutdown-rdwr-write-queue-close_ipv4. is unstable.
9 packetdrill/gtests/net/tcp/blocking_blocking-connect_ipv4. is unstable.
10 packetdrill/gtests/net/tcp/tcp_info_tcp-info-sndbuf-limited_ipv4-mapped-v6. is unstable.
11 packetdrill/gtests/net/tcp/timestamping_partial_ipv4-mapped-v6. is unstable.
12 packetdrill/gtests/net/tcp/sack_sack-shift-sacked-7-5-6-8-9-fack_ipv4. is unstable.
13 packetdrill/gtests/net/tcp/ts_recent_reset_tsval_ipv4-mapped-v6. is unstable.
14 packetdrill/gtests/net/tcp/user_timeout_user-timeout-probe_ipv6. is unstable.
15 packetdrill/gtests/net/tcp/timestamping_server_ipv4-mapped-v6. is unstable.
16 packetdrill/gtests/net/tcp/zerocopy_basic_ipv6. is unstable.
17 packetdrill/gtests/net/tcp/zerocopy_closed_ipv6. is unstable.
18 packetdrill/gtests/net/tcp/zerocopy_epoll_oneshot_ipv6. is unstable.
19 packetdrill/gtests/net/tcp/zerocopy_fastopen-server_ipv6. is unstable.
20 packetdrill/gtests/net/tcp/zerocopy_maxfrags_ipv6. is unstable.
21 packetdrill/gtests/net/tcp/zerocopy_small_ipv6. is unstable.
22 packetdrill/gtests/net/tcp/zerocopy_batch_ipv6. is unstable.
23 packetdrill/gtests/net/tcp/zerocopy_epoll_edge_ipv6. is unstable.
24 packetdrill/gtests/net/tcp/zerocopy_fastopen-client_ipv6. is unstable.
25 packetdrill/gtests/net/tcp/zerocopy_epoll_exclusive_ipv6. is unstable.
26 packetdrill/gtests/net/tcp/blocking_blocking-connect_ipv4-mapped-v6. is unstable.
27 packetdrill/gtests/net/tcp/cwnd_moderation_cwnd-moderation-ecn-enter-cwr-no-moderation-700_ipv6. is unstable.
28 packetdrill/gtests/net/tcp/nagle_sockopt_cork_nodelay_ipv6. is unstable.
29 packetdrill/gtests/net/tcp/sendfile_sendfile-simple_ipv6. is unstable.
30 packetdrill/gtests/net/tcp/shutdown_shutdown-rdwr-write-queue-close_ipv4-mapped-v6. is unstable.
31 packetdrill/gtests/net/tcp/blocking_blocking-write_ipv4. is unstable.
32 packetdrill/gtests/net/tcp/shutdown_shutdown-rdwr-close_ipv6. is unstable.
33 packetdrill/gtests/net/tcp/sack_sack-shift-sacked-2-6-8-3-9-nofack_ipv6. is unstable.
34 packetdrill/gtests/net/tcp/shutdown_shutdown-rdwr-write-queue-close_ipv6. is unstable.
35 packetdrill/gtests/net/tcp/syscall_bad_arg_fastopen-invalid-buf-ptr_ipv6. is unstable.
36 packetdrill/gtests/net/tcp/syscall_bad_arg_syscall-invalid-buf-ptr_ipv6. is unstable.
37 packetdrill/gtests/net/tcp/tcp_info_tcp-info-sndbuf-limited_ipv4. is unstable.
38 packetdrill/gtests/net/tcp/timestamping_server_ipv6. is unstable.
39 packetdrill/gtests/net/tcp/ts_recent_reset_tsval_ipv6. is unstable.
40 packetdrill/gtests/net/tcp/shutdown_shutdown-rd-close_ipv6. is unstable.
41 packetdrill/gtests/net/tcp/shutdown_shutdown-wr-close_ipv6. is unstable.
42 packetdrill/gtests/net/tcp/splice_tcp_splice_loop_test_ipv6. sometimes may not run.
43 packetdrill/gtests/net/tcp/timestamping_server_ipv4. is unstable.
44 packetdrill/gtests/net/tcp/timestamping_partial_ipv6. is unstable.
45 packetdrill/gtests/net/tcp/validate_validate-established-no-flags_ipv6. is unstable.
46 packetdrill/gtests/net/tcp/user_timeout_user_timeout_ipv6. is unstable.
47 packetdrill/gtests/net/tcp/zerocopy_client_ipv6. is unstable.
48 packetdrill/gtests/net/tcp/user_timeout_user_timeout_ipv4-mapped-v6. is unstable.
49 packetdrill/gtests/net/tcp/blocking_blocking-read_ipv6. is unstable.
50 packetdrill/gtests/net/tcp/sack_sack-shift-sacked-7-3-4-8-9-fack_ipv6. is unstable.
51 packetdrill/gtests/net/tcp/sack_sack-shift-sacked-7-5-6-8-9-fack_ipv6. is unstable.
52 packetdrill/gtests/net/tcp/inq_server_ipv6. is unstable.
53 packetdrill/gtests/net/tcp/tcp_info_tcp-info-last_data_recv_ipv4-mapped-v6. is unstable.
54 packetdrill/gtests/net/tcp/blocking_blocking-read_ipv4-mapped-v6. is unstable.
55 packetdrill/gtests/net/tcp/md5_md5-only-on-client-ack_ipv6. is unstable.
56 packetdrill/gtests/net/tcp/tcp_info_tcp-info-rwnd-limited_ipv4. is unstable.
57 packetdrill/gtests/net/tcp/ts_recent_invalid_ack_ipv6. is unstable.
58 packetdrill/gtests/net/tcp/tcp_info_tcp-info-last_data_recv_ipv6. is unstable.
59 packetdrill/gtests/net/tcp/tcp_info_tcp-info-sndbuf-limited_ipv6. is unstable.
60 packetdrill/gtests/net/tcp/timestamping_partial_ipv4. is unstable.
61 packetdrill/gtests/net/tcp/mss_mss-getsockopt-tcp_maxseg-server_ipv6. is unstable.
62 packetdrill/gtests/net/tcp/syscall_bad_arg_sendmsg-empty-iov_ipv6. is unstable.
63 packetdrill/gtests/net/tcp/ts_recent_fin_tsval_ipv6. is unstable.
64 packetdrill/gtests/net/tcp/tcp_info_tcp-info-last_data_recv_ipv4. is unstable.
65 packetdrill/gtests/net/tcp/user_timeout_user_timeout_ipv4. is unstable.
66 packetdrill/gtests/net/tcp/blocking_blocking-read_ipv4. is unstable.
67 packetdrill/gtests/net/tcp/sack_sack-shift-sacked-7-3-4-8-9-fack_ipv4-mapped-v6. is unstable.
68 packetdrill/gtests/net/tcp/ts_recent_fin_tsval_ipv4-mapped-v6. is unstable.
69 packetdrill/gtests/net/tcp/nagle_sendmsg_msg_more_ipv4-mapped-v6. is unstable.
70 packetdrill/gtests/net/tcp/blocking_blocking-write_ipv6. is unstable.
71 packetdrill/gtests/net/tcp/close_close-remote-fin-then-close_ipv4-mapped-v6. is unstable.
72 packetdrill/gtests/net/tcp/blocking_blocking-accept_ipv6. is unstable.
73 packetdrill/gtests/net/tcp/gro_gro-mss-option_ipv6. is unstable.
74 packetdrill/gtests/net/tcp/user_timeout_user-timeout-probe_ipv4-mapped-v6. is unstable.
75 packetdrill/gtests/net/tcp/user_timeout_user-timeout-probe_ipv4. is unstable.
76 packetdrill/gtests/net/tcp/tcp_info_tcp-info-rwnd-limited_ipv6. is unstable.

ioctl fail after listen

Hi, ioctl fail with this script

0   socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.1 ioctl(3, SIOCINQ, [0]) = 0

+0  bind(3, ..., ...) = 0
+0.1 ioctl(3, SIOCINQ, [0]) = 0

+0  listen(3, 1) = 0

+0.1 ioctl(3, SIOCINQ, [0]) = 0

system: Ubuntu 18.04.1
kernel: 5.4.0-42-generic

No "install" target

What steps will reproduce the problem?
1. DESTDIR=/tmp/destdir bmake install

What is the expected output? What do you see instead?

bmake: don't know how to make install. Stop

What version of the product are you using? On what operating system?

There's no version, but that's another issue

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 28 Jul 2014 at 11:21

Remote mode test does not work in Ubuntu 18.04

Hi,

This might be a dump question, but I am trying to use packetdrill as a way to generate packet and verify expected output over network to test my customized tcp stack. My plan is to use the client side of the remote testing mode for tcp protocol checking. However, I keep getting the following error:

./packetdrill --wire_client --wire_server_ip=172.16.0.1 --local_ip 172.16.0.14 -v tests/linux/fast_retransmit/fr-4pkt-sack-linux.pkt
ioctl SIOCGIFINDEX: No such device

If I run the test in local mode (tun), it works. Can anyone provide some suggestions here? 172.16.0.14 is my IP address.

Thanks,
Jimmy

IPV6 tests always meet runtime error in bind call

Hi, all.
Recently i test packetdrill by "packetdrill/run_all.py -L -l -v tcp" on Debian 9. kernel v5.5
I always meet runtime error in bind call.
This error is unstable, run 10times, appear 7times.

liuyd@inn:/result/packetdrill/defaults/lkp-ivb-2ep1/debian-x86_64-20191114.cgz/x86_64-rhel-7.6/gcc-7/v5.5$ grep "bind call" */stderr | sort -n
0/stderr:no-coalesce-small.pkt:9: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
0/stderr:reset_tsval.pkt:10: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
0/stderr:small.pkt:11: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
1/stderr:user_timeout.pkt:6: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
3/stderr:ioctl-siocinq-fin.pkt:9: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
3/stderr:sack-shift-sacked-7-3-4-8-9-fack.pkt:10: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
3/stderr:syscall-invalid-buf-ptr.pkt:8: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
4/stderr:user_timeout.pkt:6: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
7/stderr:server.pkt:8: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
9/stderr:batch.pkt:10: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
9/stderr:sendfile-simple.pkt:14: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
9/stderr:shutdown-rdwr-write-queue-close.pkt:12: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
9/stderr:user-timeout-probe.pkt:6: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
10/stderr:epoll_edge.pkt:14: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
10/stderr:sack-shift-sacked-2-6-8-3-9-nofack.pkt:12: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)

Only IPV6 tests failed due to this error.
Take rt 0 as an example. no-coalesce-small reset_tsval small tests meet bind call error.

0/stderr:no-coalesce-small.pkt:9: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
0/stderr:reset_tsval.pkt:10: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
0/stderr:small.pkt:11: runtime error in bind call: Expected result 0 but got -1 with errno 99 (Cannot assign requested address)
liuyd@inn:/result/packetdrill/defaults/lkp-ivb-2ep1/debian-x86_64-20191114.cgz/x86_64-rhel-7.6/gcc-7/v5.5/0$ cat packetdrill | grep -E "reset_tsval|no-coalesce-small|small"
FAIL [/lkp/benchmarks/packetdrill/gtests/net/tcp/ts_recent/reset_tsval.pkt (ipv6)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/eor/no-coalesce-small.pkt (ipv4)]
FAIL [/lkp/benchmarks/packetdrill/gtests/net/tcp/eor/no-coalesce-small.pkt (ipv6)]
FAIL [/lkp/benchmarks/packetdrill/gtests/net/tcp/zerocopy/small.pkt (ipv6)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/eor/no-coalesce-small.pkt (ipv4-mapped-v6)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/ts_recent/reset_tsval.pkt (ipv4-mapped-v6)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/zerocopy/small.pkt (ipv4-mapped-v6)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/ts_recent/reset_tsval.pkt (ipv4)]
OK [/lkp/benchmarks/packetdrill/gtests/net/tcp/zerocopy/small.pkt (ipv4)]

when using remote mode, the client side needs to set --local_ip

Otherwise, the server and client sides will generate random local ip addresses independently, thus, the server side sends the packet will not match the IP address of the device of client side, and the packetdrill will hang for waiting the SYN-ACK packet for each connections.

I try this on my laptop with two VMs residing in a same LAN, e.g. both devices are under the same bridge.

Build failed on OpenBSD 6.5

packetdrill 296fb3f

uname -sr: OpenBSD 6.5

$ ./configure
$ make

cc -g -Wall -Werror  -c packetdrill.c
In file included from packetdrill.c:25:
In file included from ./types.h:43:
./platforms.h:49:9: error: unknown type name 'u8'
typedef u8 __u8;
        ^
./platforms.h:50:9: error: unknown type name 'u16'
typedef u16 __u16;
        ^
./platforms.h:51:9: error: unknown type name 'u32'
typedef u32 __u32;
        ^
./platforms.h:52:9: error: unknown type name 'u64'
typedef u64 __u64;
        ^
./platforms.h:55:9: error: unknown type name 'u16'
typedef u16 __le16;
        ^
./platforms.h:56:9: error: unknown type name 'u16'
typedef u16 __be16;
        ^
./platforms.h:57:9: error: unknown type name 'u32'
typedef u32 __le32;
        ^
./platforms.h:58:9: error: unknown type name 'u32'
typedef u32 __be32;
        ^
./platforms.h:59:9: error: unknown type name 'u64'
typedef u64 __le64;
        ^
./platforms.h:60:9: error: unknown type name 'u64'
typedef u64 __be64;
        ^
./platforms.h:62:9: error: unknown type name 'u16'
typedef u16 __sum16;
        ^
./platforms.h:63:9: error: unknown type name 'u32'
typedef u32 __wsum;
        ^
In file included from packetdrill.c:25:
In file included from ./types.h:43:
In file included from ./platforms.h:97:
./fmemopen.h:33:14: error: conflicting types for 'fmemopen'
extern FILE *fmemopen(char *buf, size_t size, const char *mode);
             ^
/usr/include/stdio.h:330:7: note: previous declaration is here
FILE    *fmemopen(void *, size_t, const char *);
         ^
In file included from packetdrill.c:35:
In file included from ./run.h:71:
In file included from ./so_testing.h:28:
./packetdrill.h:37:10: fatal error: 'sys/epoll.h' file not found
#include <sys/epoll.h>
         ^~~~~~~~~~~~~
14 errors generated.
*** Error 1 in /home/sergeyb/source/packetdrill/gtests/net/packetdrill (<sys.mk>:87 'packetdrill.o')

MacOS build

I copied the Makefile.FreeBSD to Makefile.Darwin then kicking make gives this issue --

make VERBOSE=1
Makefile:2: *** missing separator. Stop.

There must be more to kickoff the make processing ! Any help on this.

Thanks,
Prokash

run script has tcp_psh issue.

When I run script in tcp/epoll/epoll_out_edge.pkt, it has an issue for tcp_psh? How can I resolve this?

my os version: Ubuntu 18.04.4 LTS
4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

./packetdrill -v ../tcp/epoll/epoll_out_edge.pkt
socket syscall: 1605520417.515781
setsockopt syscall: 1605520417.515832
bind syscall: 1605520417.515856
listen syscall: 1605520417.515866
inbound injected packet: 0.000125 S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
outbound sniffed packet: 0.000213 S. 3303488705:3303488705(0) ack 1 win 29200 <mss 1460,nop,nop,sackOK,nop,wscale 8>
inbound injected packet: 0.000355 . 1:1(0) ack 3303488706 win 257
accept syscall: 1605520417.516149
setsockopt syscall: 1605520417.516164
getsockopt syscall: 1605520417.516176
fcntl syscall: 1605520417.516188
epoll_create syscall: 1605520417.516199
epoll_ctl syscall: 1605520417.516224
epoll_wait syscall: 1605520417.516237
epoll_wait syscall: 1605520417.516246
write syscall: 1605520417.516316
epoll_wait syscall: 1605520417.516326
outbound sniffed packet: 0.000530 . 3303488706:3303493706(5000) ack 1 win 115
outbound sniffed packet: 0.000549 . 3303493706:3303498706(5000) ack 1 win 115
../tcp/epoll/epoll_out_edge.pkt:38: error handling packet: live packet field tcp_psh: expected: 1 (0x1) vs actual: 0 (0x0)
script packet: 0.000574 P. 1:10001(10000) ack 1
actual packet: 0.000549 . 1:10001(10000) ack 1 win 115

Heap-buffer-overflow in ipv4_header_len.

Hi! I found heap-buffer-overflow ( occurs at net/packetdrill/ip.h:99 ) during testing with libFuzzer.
Perhaps to fix the error, you can try to change the code in net/packetdrill/packet_parser.c:211 to
struct ipv4 *ipv4 = (struct ipv4 *) malloc(sizeof(struct ipv4));
memcpy(ipv4, header_start, sizeof(struct ipv4));

Compilation failure on i386

make in gtests/net/packetdrill complains:

run_system_call.c: In function ‘cmsg_expect_eq’:
run_system_call.c:860:38: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]
"Bad len in cmsg %d: expected=%lu actual=%lu",
~~^
%u
i, ecm->cmsg_len, acm->cmsg_len);
~~~~~~~~~~~~~
run_system_call.c:860:49: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]
"Bad len in cmsg %d: expected=%lu actual=%lu",
~~^
%u
i, ecm->cmsg_len, acm->cmsg_len);
~~~~~~~~~~~~~
run_system_call.c: In function ‘get_epoll_event_from_expr’:
run_system_call.c:2924:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
event->data.ptr = (void *)epollev_expr->ptr->value.num;
^
run_system_call.c: In function ‘syscall_epoll_wait’:
run_system_call.c:3129:6: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
"epoll_event->data does not match script: "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3132:6:
event_script.data.u64,
~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3130:19: note: format string is defined here
"expected: %lu "
~~^
%llu
run_system_call.c:3129:6: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
"epoll_event->data does not match script: "
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3133:6:
event_live->data.u64);
~~~~~~~~~~~~~~~~~~~~
run_system_call.c:3131:17: note: format string is defined here
"actual: %lu\n",
~~^
%llu
run_system_call.c: In function ‘syscall_splice’:
run_system_call.c:3249:31: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
result = splice(fd_in_live, (loff_t *) off_in, fd_out_live,
^
run_system_call.c:3250:5: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(loff_t *) off_out, len, flags);
^
cc1: all warnings being treated as errors
make: *** [: run_system_call.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.