-
Notifications
You must be signed in to change notification settings - Fork 231
net-test: packetdrill: add support of tcp option wildcard "wscale *" #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary:
In current script, we can either specify every tcp option of a packet,
or use <...> for "any tcp options". This is not flexible enough, as
some script may have requirements for some tcp options; while be
flexible
with other options.
This patch tries to address this by adding wildcard for option wscale.
Specifically, "wscale *" in the tcp option list means any wscale value.
To mark a tcp option in the script as wildcard, we leverage the highest
bit of tcp_option->kind, as TCPOPT_WILDCARD (0x80). tcp_option->kind of
TCPOPT_WILDCARD | TCPOPT_WINDOW (0x83) means wscale option of any value.
verify_outbound_live_tcp_options() is updated to be able to understand
TCPOPT_WILDCARD when set on the script packet and with TCPOPT_WINDOW.
Testing:
Using a script that currently fail on my environment with wscale:
```
$ sudo ./packetdrill/run_all.py -S -v -L -l
tcp/zerocopy/fastopen-client.pkt
FAIL
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client.pkt
(ipv4)]
stdout:
stderr:
fastopen-client.pkt:17: error handling packet: bad value outbound TCP
option 3
script packet: 0.000105 S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr
0,nop,wscale 8,FO,nop,nop>
actual packet: 0.000095 S 0:0(0) win 65535 <mss 1460,sackOK,TS val 1000
ecr 0,nop,wscale 9,FO,nop,nop>
FAIL
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client.pkt
(ipv6)]
stdout:
stderr:
fastopen-client.pkt:17: error handling packet: bad value outbound TCP
option 3
script packet: 0.000157 S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr
0,nop,wscale 8,FO,nop,nop>
actual packet: 0.000145 S 0:0(0) win 65535 <mss 1460,sackOK,TS val 1000
ecr 0,nop,wscale 9,FO,nop,nop>
FAIL
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client.pkt
(ipv4-mapped-v6)]
stdout:
stderr:
fastopen-client.pkt:17: error handling packet: bad value outbound TCP
option 3
script packet: 0.000118 S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr
0,nop,wscale 8,FO,nop,nop>
actual packet: 0.000106 S 0:0(0) win 65535 <mss 1460,sackOK,TS val 1000
ecr 0,nop,wscale 9,FO,nop,nop>
Ran 3 tests: 0 passing, 3 failing, 0 timed out (2.69 sec):
tcp/zerocopy/fastopen-client.pkt
```
Changed the wscale to wildcard:
```
$ diff -ruN tcp/zerocopy/fastopen-client.pkt
tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
--- tcp/zerocopy/fastopen-client.pkt 2023-06-27 18:36:22.956369457
-0700
+++ tcp/zerocopy/fastopen-client-wscale-wildcard.pkt 2023-06-27
18:37:29.306312093 -0700
@@ -14,7 +14,7 @@
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
+0 sendto(3, ..., 500, MSG_FASTOPEN|MSG_ZEROCOPY, ..., ...) = -1
EINPROGRESS (Operation now in progress)
- +0 > S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr 0,nop,wscale
8,FO,nop,nop>
+ +0 > S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr 0,nop,wscale
*,FO,nop,nop>
+.01 < S. 123:123(0) ack 1 win 14600 <mss 940,TS val 2000 ecr
1000,sackOK,nop,wscale 6, FO abcd1234,nop,nop>
+0 > . 1:1(0) ack 1 <nop,nop,TS val 1001 ecr 2000>
@@ -35,7 +35,7 @@
+0 fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 setsockopt(5, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
+0 sendto(5, ..., 500, MSG_FASTOPEN|MSG_ZEROCOPY, ..., ...) = 500
- +0 > S 0:500(500) <mss 1460,nop,nop,sackOK,nop,wscale 8,FO
abcd1234,nop,nop>
+ +0 > S 0:500(500) <mss 1460,nop,nop,sackOK,nop,wscale *,FO
abcd1234,nop,nop>
+.05 < S. 5678:5678(0) ack 501 win 14600 <mss
1460,nop,nop,sackOK,nop,wscale 6>
+0 > . 501:501(0) ack 1
```
and confirmed the test now pass:
```
$ sudo ./packetdrill/run_all.py -S -v -L -l
tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
(ipv4)]
stdout:
stderr:
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
(ipv6)]
stdout:
stderr:
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
(ipv4-mapped-v6)]
stdout:
stderr:
Ran 3 tests: 3 passing, 0 failing, 0 timed out (7.91 sec):
tcp/zerocopy/fastopen-client-wscale-wildcard.pkt
```
and also still work properly when the wscale is matching expectations:
```
$ diff -ruN tcp/zerocopy/fastopen-client.pkt tcp/zerocopy/fastopen-client-correct-wscale.pkt
--- tcp/zerocopy/fastopen-client.pkt 2023-06-27 18:36:22.956369457
-0700
+++ tcp/zerocopy/fastopen-client-correct-wscale.pkt 2023-06-27
18:39:24.630212385 -0700
@@ -14,7 +14,7 @@
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
+0 sendto(3, ..., 500, MSG_FASTOPEN|MSG_ZEROCOPY, ..., ...) = -1
EINPROGRESS (Operation now in progress)
- +0 > S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr 0,nop,wscale
8,FO,nop,nop>
+ +0 > S 0:0(0) <mss 1460,sackOK,TS val 1000 ecr 0,nop,wscale
9,FO,nop,nop>
+.01 < S. 123:123(0) ack 1 win 14600 <mss 940,TS val 2000 ecr
1000,sackOK,nop,wscale 6, FO abcd1234,nop,nop>
+0 > . 1:1(0) ack 1 <nop,nop,TS val 1001 ecr 2000>
@@ -35,7 +35,7 @@
+0 fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 setsockopt(5, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
+0 sendto(5, ..., 500, MSG_FASTOPEN|MSG_ZEROCOPY, ..., ...) = 500
- +0 > S 0:500(500) <mss 1460,nop,nop,sackOK,nop,wscale 8,FO
abcd1234,nop,nop>
+ +0 > S 0:500(500) <mss 1460,nop,nop,sackOK,nop,wscale 9,FO
abcd1234,nop,nop>
+.05 < S. 5678:5678(0) ack 501 win 14600 <mss
1460,nop,nop,sackOK,nop,wscale 6>
+0 > . 501:501(0) ack 1
```
with
```
$ sudo ./packetdrill/run_all.py -S -v -L -l tcp/zerocopy/fastopen-client-correct-wscale.pkt
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-correct-wscale.pkt
(ipv4)]
stdout:
stderr:
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-correct-wscale.pkt
(ipv6)]
stdout:
stderr:
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/zerocopy/fastopen-client-correct-wscale.pkt
(ipv4-mapped-v6)]
stdout:
stderr:
Ran 3 tests: 3 passing, 0 failing, 0 timed out (8.16 sec):
tcp/zerocopy/fastopen-client-correct-wscale.pkt
```
Also comfirmed that wscale wildcard would not cause and option which has
0x80 set to pass.
For instance with:
```
$ diff -ruN tcp/fastopen/server/simple2.pkt
tcp/fastopen/server/simple2-wscale.pkt
--- tcp/fastopen/server/simple2.pkt 2023-06-27 17:28:58.547790456
-0700
+++ tcp/fastopen/server/simple2-wscale.pkt 2023-06-27
19:00:49.460036441 -0700
@@ -22,7 +22,7 @@
+0 < S 9873242:9873242(0) win 10000 <mss 1012,FOEXP,sackOK,TS val 1
ecr 0,nop,wscale 7>
// Test the cookie is as expected by encoding both IPs w/ key
- +0 > S. 0:0(0) ack 9873243 <mss 1460,sackOK,TS val 10000 ecr
1,nop,wscale 8, FOEXP 1313a2da994a0951>
+ +0 > S. 0:0(0) ack 9873243 <mss 1460,sackOK,TS val 10000 ecr
1,nop,wscale *, FOEXP f49b0ef989d9f624>
+.1 < . 1:1(0) ack 1 win 257 <nop,nop,TS val 2 ecr 10000>
+0 accept(3, ..., ...) = 4
+0 close(4) = 0
@@ -38,8 +38,8 @@
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
- +.05 < S 19124022:19125022(1000) win 10000 <mss 1012,FOEXP
1313a2da994a0951,sackOK,TS val 10 ecr 0,nop,wscale 7>
- +0 > S. 0:0(0) ack 19125023 <mss 1460,sackOK,TS val 100000 ecr
10,nop,wscale 8>
+ +.05 < S 19124022:19125022(1000) win 10000 <mss 1012,FOEXP
f49b0ef989d9f624,sackOK,TS val 10 ecr 0,nop,wscale 7>
+ +0 > S. 0:0(0) ack 19125023 <mss 1460,sackOK,TS val 100000 ecr
10,nop,wscale 9>
+0 accept(3, ..., ...) = 4
`/tmp/sysctl_restore_${PPID}.sh`
```
The test fails at handling Fast Open Experimental
```
simple2-wscale.pkt:25: error handling packet: bad value outbound TCP
option 254
script packet: 0.000163 S. 0:0(0) ack 9873243 <mss 1460,sackOK,TS val
10000 ecr 1,nop,wscale *,FOEXP f49b0ef989d9f624>
actual packet: 0.000159 S. 0:0(0) ack 9873243 win 65535 <mss
1460,sackOK,TS val 10000 ecr 1,nop,wscale 9,FOEXP 792f542eed8979b8>
OK
[/data/users/chantra/google-packetdrill/gtests/net/tcp/fastopen/server/simple2-wscale.pkt
(ipv4-mapped-v6)]
```
Signed-off-by: Manu Bretelle <chantra@meta.com>
|
@nealcardwell I forced pushed the change with my corp email address. CLA bot is now happy. |
Summary:
In current script, we can either specify every tcp option of a packet, or use <...> for "any tcp options". This is not flexible enough, as some script may have requirements for some tcp options; while be flexible
with other options.
This patch tries to address this by adding wildcard for option wscale. Specifically, "wscale *" in the tcp option list means any wscale value.
To mark a tcp option in the script as wildcard, we leverage the highest bit of tcp_option->kind, as TCPOPT_WILDCARD (0x80). tcp_option->kind of TCPOPT_WILDCARD | TCPOPT_WINDOW (0x83) means wscale option of any value.
verify_outbound_live_tcp_options() is updated to be able to understand TCPOPT_WILDCARD when set on the script packet and with TCPOPT_WINDOW.
Testing:
Using a script that currently fail on my environment with wscale:
Changed the wscale to wildcard:
and confirmed the test now pass:
and also still work properly when the wscale is matching expectations:
with
Also comfirmed that wscale wildcard would not cause and option which has 0x80 set to pass.
For instance with:
The test fails at handling Fast Open Experimental