Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/packetdrill
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 74e1dedfc72f408778b5ddfd8ae1d36b7e8bde82
Choose a base ref
..
head repository: google/packetdrill
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80335f97d9e294a2bbbc0e601853b4bd2dbef3a5
Choose a head ref
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ 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
sudo apt install git gcc make bison flex python3 net-tools
```

To check out and build packetdrill:
2 changes: 2 additions & 0 deletions gtests/net/packetdrill/config.c
Original file line number Diff line number Diff line change
@@ -244,6 +244,8 @@ static void set_wire_client_defaults(struct config *config)
if (!config->is_wire_client)
return;

DEBUGP("setting wire client defaults\n");

if (config->wire_server_ip_string == NULL)
die("when using --wire_client, must specify "
"--wire_server_at or --wire_server_ip");
26 changes: 20 additions & 6 deletions gtests/net/packetdrill/wire_client.c
Original file line number Diff line number Diff line change
@@ -139,16 +139,28 @@ static void wire_client_send_hw_address(struct wire_client *wire_client,
"error sending WIRE_HARDWARE_ADDR");
}

/* Send the IP address to which the server should send packets. */
static void wire_client_send_ip_address(struct wire_client *wire_client,
const struct config *config)
/* Send the IP live_local address to which the server should send packets. */
static void wire_client_send_live_local_ip(struct wire_client *wire_client,
const struct config *config)
{
if (wire_conn_write(wire_client->wire_conn,
WIRE_IP_ADDR,
WIRE_LIVE_LOCAL_IP,
config->live_local_ip_string,
strlen(config->live_local_ip_string)))
wire_client_die(wire_client,
"error sending WIRE_IP_ADDR");
"error sending WIRE_LIVE_LOCAL_IP");
}

/* Send the IP live_remote address from which the server should send packets. */
static void wire_client_send_live_remote_ip(struct wire_client *wire_client,
const struct config *config)
{
if (wire_conn_write(wire_client->wire_conn,
WIRE_LIVE_REMOTE_IP,
config->live_remote_ip_string,
strlen(config->live_remote_ip_string)))
wire_client_die(wire_client,
"error sending WIRE_LIVE_REMOTE_IP");
}

/* Receive server's message that the server is ready to execute the script. */
@@ -277,7 +289,9 @@ int wire_client_init(struct wire_client *wire_client,

wire_client_send_hw_address(wire_client, config);

wire_client_send_ip_address(wire_client, config);
wire_client_send_live_local_ip(wire_client, config);

wire_client_send_live_remote_ip(wire_client, config);

wire_client_receive_server_ready(wire_client);

3 changes: 2 additions & 1 deletion gtests/net/packetdrill/wire_protocol.c
Original file line number Diff line number Diff line change
@@ -36,7 +36,8 @@ const char *wire_op_to_string(enum wire_op_t op)
case WIRE_SCRIPT_PATH: return "WIRE_SCRIPT_PATH";
case WIRE_SCRIPT: return "WIRE_SCRIPT";
case WIRE_HARDWARE_ADDR: return "WIRE_HARDWARE_ADDR";
case WIRE_IP_ADDR: return "WIRE_IP_ADDR";
case WIRE_LIVE_LOCAL_IP: return "WIRE_LIVE_LOCAL_IP";
case WIRE_LIVE_REMOTE_IP: return "WIRE_LIVE_REMOTE_IP";
case WIRE_SERVER_READY: return "WIRE_SERVER_READY";
case WIRE_CLIENT_STARTING: return "WIRE_CLIENT_STARTING";
case WIRE_PACKETS_START: return "WIRE_PACKETS_START";
3 changes: 2 additions & 1 deletion gtests/net/packetdrill/wire_protocol.h
Original file line number Diff line number Diff line change
@@ -34,7 +34,8 @@ enum wire_op_t {
WIRE_SCRIPT_PATH, /* "here's the path of the script" */
WIRE_SCRIPT, /* "here's the script we're going to start" */
WIRE_HARDWARE_ADDR, /* "here's my ethernet MAC address" */
WIRE_IP_ADDR, /* "here's the client live_local_ip_string */
WIRE_LIVE_LOCAL_IP, /* "here's the client live_local_ip_string */
WIRE_LIVE_REMOTE_IP, /* "here's the live_remote_ip_string to use */
WIRE_SERVER_READY, /* "server ready to start script execution" */
WIRE_CLIENT_STARTING, /* "i'm starting script execution... now!" */
WIRE_PACKETS_START, /* "please start handling packet events" */
45 changes: 39 additions & 6 deletions gtests/net/packetdrill/wire_server.c
Original file line number Diff line number Diff line change
@@ -207,8 +207,8 @@ static int wire_server_receive_hw_address(struct wire_server *wire_server)
return STATUS_OK;
}

/* Receive the IP address to which the server should send packets. */
static int wire_server_receive_ip_address(struct wire_server *wire_server)
/* Receive the live_local IP address to which the server should send packets. */
static int wire_server_receive_live_local_ip(struct wire_server *wire_server)
{
enum wire_op_t op = WIRE_INVALID;
void *buf = NULL;
@@ -217,9 +217,9 @@ static int wire_server_receive_ip_address(struct wire_server *wire_server)

if (wire_conn_read(wire_server->wire_conn, &op, &buf, &buf_len))
return STATUS_ERR;
if (op != WIRE_IP_ADDR) {
if (op != WIRE_LIVE_LOCAL_IP) {
fprintf(stderr,
"bad wire client: expected WIRE_IP_ADDR\n");
"bad wire client: expected WIRE_LIVE_LOCAL_IP\n");
return STATUS_ERR;
}
if (buf_len + 1 > sizeof(config->live_local_ip_string)) {
@@ -230,7 +230,37 @@ static int wire_server_receive_ip_address(struct wire_server *wire_server)

memcpy(config->live_local_ip_string, buf, buf_len);
config->live_local_ip_string[buf_len] = '\0'; /* NULL-terminate str */
DEBUGP("got WIRE_IP_ADDR: [%s]\n", config->live_local_ip_string);
DEBUGP("got WIRE_LIVE_LOCAL_IP: [%s]\n",
config->live_local_ip_string);

return STATUS_OK;
}

/* Receive the live_remote IP from which the server should send packets. */
static int wire_server_receive_live_remote_ip(struct wire_server *wire_server)
{
enum wire_op_t op = WIRE_INVALID;
void *buf = NULL;
int buf_len = -1;
struct config *config = &wire_server->config;

if (wire_conn_read(wire_server->wire_conn, &op, &buf, &buf_len))
return STATUS_ERR;
if (op != WIRE_LIVE_REMOTE_IP) {
fprintf(stderr,
"bad wire client: expected WIRE_LIVE_REMOTE_IP\n");
return STATUS_ERR;
}
if (buf_len + 1 > sizeof(config->live_remote_ip_string)) {
fprintf(stderr,
"bad wire client: ip address too long\n");
return STATUS_ERR;
}

memcpy(config->live_remote_ip_string, buf, buf_len);
config->live_remote_ip_string[buf_len] = '\0'; /* NULL-terminate str */
DEBUGP("got WIRE_LIVE_REMOTE_IP: [%s]\n",
config->live_remote_ip_string);

return STATUS_OK;
}
@@ -484,7 +514,10 @@ static void *wire_server_thread(void *arg)
if (wire_server_receive_hw_address(wire_server))
goto error_done;

if (wire_server_receive_ip_address(wire_server))
if (wire_server_receive_live_local_ip(wire_server))
goto error_done;

if (wire_server_receive_live_remote_ip(wire_server))
goto error_done;

if (parse_script_and_set_config(wire_server->argc,
111 changes: 111 additions & 0 deletions gtests/net/tcp/cubic/cubic-bulk-166k-idle-restart.pkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Test bulk CUBIC flow at 166 kbit/sec (2 1000-byte payloads each 100ms
// means 2 * 1040 * 8 / .1 = 166400 bits/sec).
// This variant checks to see if CUBIC grows its cwnd unreasonably
// due to crediting itself for time accumulated in an idle state.

// For this test We mostly just care about cwnd values, not exact timing.
// So to reduce flakes allow ~20ms of timing variation:
--tolerance_usecs=20000

`../../common/defaults.sh
tc qdisc replace dev tun0 root fq
sysctl -q net.ipv4.tcp_congestion_control=cubic
sysctl -q net.ipv4.tcp_min_tso_segs=4
# Disable TLP to avoid flakes from spurious retransmits:
sysctl -q net.ipv4.tcp_early_retrans=0`

// Initialize connection
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0

+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+.1 < . 1:1(0) ack 1 win 514

+0 accept(3, ..., ...) = 4

+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [2000000], 4) = 0
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
+0 write(4, ..., 40000) = 40000

+.1 < . 1:1(0) ack 2001 win 514
+.1 < . 1:1(0) ack 4001 win 514
+.1 < . 1:1(0) ack 6001 win 514
+.1 < . 1:1(0) ack 8001 win 514
+.1 < . 1:1(0) ack 10001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
+.1 < . 1:1(0) ack 12001 win 514
+.1 < . 1:1(0) ack 14001 win 514
+.1 < . 1:1(0) ack 16001 win 514
+.1 < . 1:1(0) ack 18001 win 514
+.1 < . 1:1(0) ack 20001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 30, tcpi_snd_cwnd }%

+.1 < . 1:1(0) ack 22001 win 514
+.1 < . 1:1(0) ack 24001 win 514
+.1 < . 1:1(0) ack 26001 win 514
+.1 < . 1:1(0) ack 28001 win 514
+.1 < . 1:1(0) ack 30001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 40, tcpi_snd_cwnd }%
+.1 < . 1:1(0) ack 32001 win 514
+.1 < . 1:1(0) ack 34001 win 514
+.1 < . 1:1(0) ack 36001 win 514
+.1 < . 1:1(0) ack 38001 win 514
// Hystart exits slow start here at a cwnd of 48:
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 48, tcpi_snd_cwnd }%
+.1 < . 1:1(0) ack 40001 win 514

// Go idle for a while in order to verify that this doesn't let us
// accumulate "credit" toward increasing cwnd quickly when we go
// cwnd-limited again.
+4 write(4, ..., 160000) = 160000

+.1 < . 1:1(0) ack 42001 win 514
+.1 < . 1:1(0) ack 44001 win 514
+.1 < . 1:1(0) ack 46001 win 514
+.1 < . 1:1(0) ack 48001 win 514
+.1 < . 1:1(0) ack 50001 win 514
+.1 < . 1:1(0) ack 52001 win 514
+.1 < . 1:1(0) ack 54001 win 514
+.1 < . 1:1(0) ack 56001 win 514
+.1 < . 1:1(0) ack 58001 win 514
+.1 < . 1:1(0) ack 60001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 48, tcpi_snd_cwnd }%

+.1 < . 1:1(0) ack 62001 win 514
+.1 < . 1:1(0) ack 64001 win 514
+.1 < . 1:1(0) ack 66001 win 514
+.1 < . 1:1(0) ack 68001 win 514
+.1 < . 1:1(0) ack 70001 win 514
+.1 < . 1:1(0) ack 72001 win 514
+.1 < . 1:1(0) ack 74001 win 514
+.1 < . 1:1(0) ack 76001 win 514
+.1 < . 1:1(0) ack 78001 win 514
+.1 < . 1:1(0) ack 80001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 49, tcpi_snd_cwnd }%

+.1 < . 1:1(0) ack 82001 win 514
+.1 < . 1:1(0) ack 84001 win 514
+.1 < . 1:1(0) ack 86001 win 514
+.1 < . 1:1(0) ack 88001 win 514
+.1 < . 1:1(0) ack 90001 win 514
+.1 < . 1:1(0) ack 92001 win 514
+.1 < . 1:1(0) ack 94001 win 514
+.1 < . 1:1(0) ack 96001 win 514
+.1 < . 1:1(0) ack 98001 win 514
+.1 < . 1:1(0) ack 100001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 52, tcpi_snd_cwnd }%

+.1 < . 1:1(0) ack 102001 win 514
+.1 < . 1:1(0) ack 104001 win 514
+.1 < . 1:1(0) ack 106001 win 514
+.1 < . 1:1(0) ack 108001 win 514
+.1 < . 1:1(0) ack 110001 win 514
+.1 < . 1:1(0) ack 112001 win 514
+.1 < . 1:1(0) ack 114001 win 514
+.1 < . 1:1(0) ack 116001 win 514
+.1 < . 1:1(0) ack 118001 win 514
+.1 < . 1:1(0) ack 120001 win 514
+0 %{ print(tcpi_snd_cwnd); assert tcpi_snd_cwnd == 58, tcpi_snd_cwnd }%
Loading