Httping is an HTTP request client that simulates ping output. The Fastopen request is supported from 1.5 and the current version is 2.3.4.
I compiled the Nginx 1.5.13,yum on Fedora 20 (kernel version 3.13) and installed httping 2.3.3 version.
Open two terminals, one running tcpdump, and then another running httping as follows:
Httping-f-G http://www.google.com.hk/url-c 1
This is when you see the output of the previous terminal:
[chenlin.rao@com21-100 tfo]$ sudo tcpdump-i p5p1-vvnxxs 0 TCP port tcpdump:listening on P5P1, Link-type EN10MB (Ethe rnet), capture size 65535 bytes 20:40:15.034486 IP (Tos 0x0, TTL, id 52862, offset 0, flags [DF], Proto TCP (6), length 147) 10.2.5.100.40699 > 74.125.128.199.http:flags [S], cksum 0xbb34 (correct), Seq 3616187260:3616187335, Win 29200, Options [MSS 1460,sackok,ts val 31091970 ECR 0,nop,wscale 7,exp-tfo cookie 9a8e5a15f1deab96], length 0x0000:4500 0093 ce7e 4000 4006 913c 0a02 0564 e....~@.@. <...D 0x0010:4a7d 80c7 9efb 0050 d78a a37c 0000 J} ..... p...| .... 0x0020:d002 7210 bb34 0000 0204 05b4 0402 080a. R.. 4 ..... 0x0030:01da 6d02 0000 0000 0103 0307-fe0c f989. M............. 0x0040:9a8e 5a15 f1de ab96 4845 4144 202f 7572. Z..... Head./ur 0x0050:6c20 4854 5450 2f31 2e30 0d0a 486f 7374 l.http/1.0..host 0x0060:3a20 7777 772e 676f 6f67 6c65 2e63 6f6d :. www.google.com 0x0070:2e68 6b0d 0a55 7365 722d 4167 656e 743a. HK. user-agent:0x0080:2048 5454 5069 6e67 2076322e 332e 330d. httping.v2.3.3.0x0090:0a0d 0a ... 20:40:15.295644 IP (Tos 0x0, TTL, id 42640, offset 0, flags [None], Proto TCP (6), length 74.125.128.199.http > 10.2.5.100.40699:flags [S.], cksum 0x71c1 (correct), seq 1878126810, Ack 3616187261, Win 42900, options [MSS 1430,nop,nop , Sackok,nop,wscale 6], length 0 0x0000:4500 0034 a690 0000 1e06 1b8a 4a7d 80c7 E. 4. ... J}. 0x0010:0a02 0564 0050 9efb 6ff1 f0da d78a a37d ... d.p ... O. ...} 0x0020:8012 a794 71c1 0000 0204 0596 0101 0402 ... q.... 0x0030:0103 0306 .... 20:40:15.295694 IP (Tos 0x0, TTL, id 52863, offset 0, flags [DF], Proto TCP (6), length) 10.2.5.100.40699 > 74.1 25.128.199.http:flags [P.], cksum 0x5bf7 (correct), seq 1:76, ack 1, win 229, length 0x0000:4500 0073 ce7f 4000 4006 915b 0a02 0564 E.. S.. @.@.. [... d 0x0010:4a7d 80c7 9efb 0050 d78a a37d 6ff1 J} ..... P..} O... 0x0020:5018 00e5 5bf7 0000 4845 4144 202f 7572 P ... [... Head./ur 0x0030:6c20 4854 5450 2f31 2e30 0d0a 486f 7374 l.http/1.0..host 0x0040:3a20 7777 772e 676f 6f67 6c65 2e63 6f6d:. www.google.com 0x0050:2e68 6b0d 0a55 7365 722d 4167 656e 743a. HK. user-agent:0x0060:2048 5454 5069 6e67 2076 322e 332e 330d. httping.v2.3.3.0x0070:0a0d 0a ... 20:40:15.560807 IP (Tos 0x0, TTL, id 42641, offset 0, flags [None], Proto TCP (6), length 74.125.128.199.http > 10.2.5.100.40699:flags [.], cksum 0x5720 (correct), seq 1, ACK, win 670, length 0 0x0000:4500 0028 a691 0000 1e06 1b9 5 4a7d 80c7 E.. (........ J}. 0x0010:0a02 0564 0050 9efb 6ff1 f0db d78a a3c8 ... d.p ... O....... 0x0020:5010 029e 5720 0000 0000 0000 0000 P ... W......... 20:40:15.568068 IP (Tos 0x0, TTL, id 42642, offset 0, flags [None], Proto TCP (6), length 74.125.128.199.http > 10.2.5.100.40699:flags [P.], cksum 0x85ae (correct), seq 1:230, ACK, win 670, length 229 0x0000:4500 010d a692 0000 1e06 1aaf 4a7d 80c7 E ..... J}. 0x0010:0a02 0564 0050 9efb 6ff1 f0db d78a a3c8 ... d.p ... O....... 0x0020:5018 029e 85ae 0000 4854 5450 2f31 2e30 p.......http/1.0 0x0030:2034 3034 204e 6f74 2046 6f75 6e64 0d0a. 404.not.found. 0x0040:436f 6e74 656e 742d 5479 7065 3a20 7465 content-type:.te 0x0050:7874 2f68 746d 6c3b 2063 6861 7273 6574 xt/html;. CharSet 0x0060:3d55 5446 2d38 0d0a 4461 7465 3a20 5765 =utf-8. Date:. We 0x0070: 642c 2031 3620 4170 7220 3230 3134 2031 d,.16.Apr.2014.1 0x0080: 323a 3430 3a31 3520 474d 540d 0a53 6572 2:40:1 5.GMT.. Ser 0x0090:7665 723a 2067 7773 0d0a 436f 6e74 656e ver:.gws. Conten 0x00a0:742d 4c65 6e67 7468 3a20 3134 3238 0d0a t-length:.1428. 0x00b0:582d 5853 532d 5072 6f74 6563 7469 6f6e x-xss-protection 0x00c0:3a20 313b 206d 6f64 653d 626c 6f63 6b0d:. 1; Mode=block. 0x00d0:0a58 2d46 7261 6d65 2d4f 7074 696f 6e73. X-frame-options 0x00e0:3a20 5341 4d45 4f52 4947 494e 0d0a 416c:. Sameorigin.. Al 0x00f0:7465 726e 6174 652d 5072 6f74 6f63 6f6c ternate-protocol 0x0100:3a20 3830 3a71 7569 630d 0a0d 0a:. 80:quic
Yes, the head request was taken in the first SYN package.
But it is strange to find that many times the same command, the SYN packet does not carry data.
In my opinion, since it is still the first SYN package, the client side does not know the server side of the situation, it should be no matter how the server side of Syn all with head request AH?
In addition, the HTTPING-F command to test their own compiled Nginx, has not seen the correct grasp of the package results, head request has been three times after the handshake sent.
Try to track some problems with Systemtap.
The first step is to confirm that my nginx socket is really open fastopen:
A terminal runs the following command:
Stap-e ' Probe kernel.function ("do_tcp_setsockopt") {printf ("%dn", $optname)} '
Another terminal to start Nginx, see the previous terminal output of 23, check tcp.h can see 23 is tcp_fastopen right!
The second step is to confirm that Httping sent the Fastopen:
A terminal runs the following command:
Stap-e ' Probe kernel.function ("tcp_sendmsg") {printf ("%d%xn", $msg->msg_namelen, $msg->msg_flags)} '
Another terminal to run the Httping-f command mentioned at the beginning, see the previous terminal output of 16 20000040, check tcp.h can see Msg_fastopen is 0x20000000,msg_dontwait is 0x40, that is to say HTTPI Ng is fine, too.
Now the depressing point is that in Net/ipv4/tcp.c, the tcp_sendmsg () function judges if ((Flags & Msg_fastopen)) and calls the Tcp_sendmsg_fastopen () function to handle it. But when trying to use SYSTEMTAP to investigate this function, you will report a mistake:
Warning:probe kernel.function ("tcp_sendmsg_fastopen@net/ipv4/tcp.c:1005") (Address 0xffffffff815cca08) Registration Error (RC-22)
The reasons are unknown.
Keep in mind and continue to study.
Note 1: Discover that chrome even if the Fastopen is enabled in the About:flags, it does not seem to work, you must command line Google-chrome--enable-tcp-fastopen to open the line.
Note 2: Online to see someone write Server and client demo demo Fastopen, but in fact, the demo code in print data is normal three times after the handshake socket received. This will open tcpdump to confirm when the data was sent.