MacOS: TCP Fast Open
[exim.git] / test / scripts / 1990-TCP-Fast-Open / 1990
1 # TCP Fast Open
2 #
3 # Linux:
4 # Both server and client-side TFO support must be enabled in the
5 # kernel, 'sudo sh -c "echo 3 > /proc/sys/net/ipv4/tcp_fastopen"'.
6 #
7 # A packet capture on the loopback interface will show the TFO
8 # option on the SYN, but the fast-output SMTP banner will not
9 # be seen unless you also deliberately emulate a long path:
10 # 'sudo tc qdisc add dev lo root netem delay 50ms'
11 # You'll need iproute-tc installed, for the tc command.
12 # You'll need kernel-modules-extra installed, or you get
13 # an unhelpful error from RTNETLINK.
14 # To tidy up:  'sudo tc qdisc delete dev lo root'
15 #
16 # MacOS:
17 # The kernel seems to have TFO enabled both ways as default.
18 # There is a net.inet.tcp.clear_tfocache parameter
19 ## sysctl -w foo-val
20 #
21 # For network delays there is something called 'Network Link Conditioner'
22 # which might do the job.  But how to manipulate it?
23 #
24 #
25 sudo perl
26 system ("tc qdisc add dev lo root netem delay 50ms");
27 ****
28 #
29 # First time runs will see a TFO request option only; subsequent
30 # ones should see the TFO cookie and fast-output SMTP banner
31 # (currently on a separate packet after the server SYN,ACK but before
32 # the client ACK).
33 #
34 # The client log => line  should have a "TFO" element.
35 # The server log <= line for a@test.ex  should not.
36 #
37 # First clear any previously-obtained cookie:
38 sudo perl
39 system ("ip tcp_metrics delete 127.0.0.1");
40 ****
41 #
42 #
43 #
44 # FreeBSD: it looks like you have to compile a custom kernel, with
45 # 'options TCP_RFC7413' in the config.  Also set
46 # 'net.inet.tcp.fastopen.enabled=1' in /etc/sysctl.conf
47 # Untested.
48 #
49 exim -DSERVER=server -bd -oX PORT_D
50 ****
51 #
52 exim a@test.ex
53 Testing
54 ****
55 sleep 3
56 #
57 # The server log <= line for b@test.ex  should have a "TFO" element, but
58 # this will only be obtained when the above delay is inserted into the
59 # loopback net path.
60 #
61 exim b@test.ex
62 Testing
63 ****
64 sleep 3
65 #
66 #
67 sudo perl
68 system ("tc qdisc delete dev lo root");
69 ****
70 #
71 killdaemon
72 no_msglog_check