9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@9fans.net
Subject: Re: [9fans] telnet vs. godaddy whois
Date: Wed, 16 Apr 2008 09:31:13 -0400	[thread overview]
Message-ID: <20080416133300.E90521E8C3A@holo.morphisms.net> (raw)
In-Reply-To: <638b0c1689eb3e5fc5e1dcac5a1fdff5@quanstro.net>

> does anyone know why telnet has trouble with this?
>
>     ; echo godaddy.com|telnet -nr /net.alt/tcp!whois.godaddy.com!43
>     connected to /net.alt/tcp!whois.godaddy.com!43 on /net.alt/tcp/12
>     ;
>
> from a similarly-connected linux machine, linux telnet returns a
> lengthy answer.

It's not telnet's fault.  It's a TCP bug.

Here's a trace on Linux.  Notice that godaddy's SYN|ACK packet (34822ms)
advertises a zero-length receive window, so Linux has to wait
until it gets an ACK to its ACK to open the window (34899ms)
before it sends (34900ms).

    # /usr/local/plan9/bin/snoopy -f 'tcp(sd=43)' eth0
    after optimize: ether(ip(tcp(sd = 43)))
    034744 ms
        ether(s=000feafc0dbe d=00095bdb3254 pr=0800 ln=74)
        ip(s=192.168.0.99 d=68.178.211.43 id=9ca5 frag=4000 ttl= 64 pr=6 ln=60)
        tcp(s=42805 d=43 seq=1897121382 ack=0 fl=S win=5840 ck=d993 opt4=(mss 1460) opt2=(4 ) opt10=(8 45155AC300000000) opt=NOOP opt3=(wscale 7))
    034822 ms
        ether(s=00095bdb3254 d=000feafc0dbe pr=0800 ln=60)
        ip(s=68.178.211.43 d=192.168.0.99 id=9ca5 frag=0000 ttl= 31 pr=6 ln=40)
        tcp(s=43 d=42805 seq=3642134677 ack=1897121383 fl=AS win=0 ck=8e61)
    034822 ms
        ether(s=000feafc0dbe d=00095bdb3254 pr=0800 ln=54)
        ip(s=192.168.0.99 d=68.178.211.43 id=9ca6 frag=4000 ttl= 64 pr=6 ln=40)
        tcp(s=42805 d=43 seq=1897121383 ack=3642134678 fl=A win=5840 ck=7792)
    034899 ms
        ether(s=00095bdb3254 d=000feafc0dbe pr=0800 ln=60)
        ip(s=68.178.211.43 d=192.168.0.99 id=34a4 frag=0000 ttl=111 pr=6 ln=40)
        tcp(s=43 d=42805 seq=3642134678 ack=1897121383 fl=A win=16384 ck=4e62)
    034900 ms
        ether(s=000feafc0dbe d=00095bdb3254 pr=0800 ln=66)
        ip(s=192.168.0.99 d=68.178.211.43 id=9ca7 frag=4000 ttl= 64 pr=6 ln=52)
        tcp(s=42805 d=43 seq=1897121383 ack=3642134678 fl=AP win=5840 ck=d90f)
        dump(godaddy.com\n)
    035195 ms
        ether(s=00095bdb3254 d=000feafc0dbe pr=0800 ln=60)
        ip(s=68.178.211.43 d=192.168.0.99 id=34d7 frag=0000 ttl=111 pr=6 ln=40)
        tcp(s=43 d=42805 seq=3642134678 ack=1897121395 fl=A win=65523 ck=8e62)
    035265 ms
        ether(s=00095bdb3254 d=000feafc0dbe pr=0800 ln=1434)
        ip(s=68.178.211.43 d=192.168.0.99 id=3504 frag=0000 ttl=111 pr=6 ln=1420)
        tcp(s=43 d=42805 seq=3642134678 ack=1897121395 fl=A win=65523 ck=a8b6)
        dump(The data contained in GoDaddy.co)

Plan 9 ignores the zero length window and sends a single byte (2456ms),
causing godaddy to hang up (2493ms).

    cpu% snoopy -N 1500 -f 'tcp(sd=43)' /net/ether1
    after optimize: ether(ip(tcp(sd = 43)))
    002343 ms
        ether(s=0004238ecb1a d=0007b3f12c00 pr=0800 ln=62)
        ip(s=18.26.4.98 d=68.178.211.43 id=9330 frag=0000 ttl=255 pr=6 ln=48)
        tcp(s=32619 d=43 seq=1578393267 ack=0 fl=S win=65535 ck=1767 opt4=(mss 1460) opt3=(wscale 3) opt=NOOP)
    002418 ms
        ether(s=0007b3f12c00 d=0004238ecb1a pr=0800 ln=64)
        ip(s=68.178.211.43 d=18.26.4.98 id=9330 frag=0000 ttl=223 pr=6 ln=40)
        tcp(s=43 d=32619 seq=2734158449 ack=1578393268 fl=AS win=0 ck=afb0)
    002437 ms
        ether(s=0004238ecb1a d=0007b3f12c00 pr=0800 ln=60)
        ip(s=18.26.4.98 d=68.178.211.43 id=9339 frag=0000 ttl=255 pr=6 ln=40)
        tcp(s=32619 d=43 seq=1578393268 ack=2734158450 fl=AP win=65535 ck=afa9)
    002456 ms
        ether(s=0004238ecb1a d=0007b3f12c00 pr=0800 ln=60)
        ip(s=18.26.4.98 d=68.178.211.43 id=933a frag=0000 ttl=255 pr=6 ln=41)
        tcp(s=32619 d=43 seq=1578393268 ack=2734158450 fl=A win=65535 ck=48b0)
        dump(g)
    002493 ms
        ether(s=0007b3f12c00 d=0004238ecb1a pr=0800 ln=64)
        ip(s=68.178.211.43 d=18.26.4.98 id=9339 frag=0000 ttl=223 pr=6 ln=40)
        tcp(s=43 d=32619 seq=2734158450 ack=1578393268 fl=AR win=65535 ck=afad)

The source is in /sys/src/9/ip/tcp.c.  Have fun.

Russ



  reply	other threads:[~2008-04-16 13:31 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-15 17:16 erik quanstrom
2008-04-16 13:31 ` Russ Cox [this message]
2008-04-16 13:46   ` Charles Forsyth
2008-04-16 16:52     ` Michaelian Ennis
2008-04-16 18:36     ` erik quanstrom
2008-04-16 19:04       ` ron minnich
2008-04-16 19:48         ` Bakul Shah
2008-04-16 20:25           ` Tim Wiess
2008-04-16 20:49           ` Charles Forsyth
2008-04-16 21:43             ` Taj Khattra
2008-04-16 22:00               ` John Barham
2008-04-16 22:20               ` C H Forsyth
2008-04-16 23:26             ` Bakul Shah
2008-04-17  0:04               ` Charles Forsyth
2008-04-17  8:18                 ` Charles Forsyth
2008-04-17 18:41                   ` Bakul Shah
2008-04-17 19:29                     ` erik quanstrom
2008-04-17 20:59                       ` Tim Wiess
2008-04-17 21:19                         ` Charles Forsyth
2008-04-17 21:23                           ` Tim Wiess
2008-04-17 21:56                             ` Charles Forsyth
2008-04-17 22:06                               ` Charles Forsyth
2008-04-17 22:43                               ` Tim Wiess
2008-04-17 23:02                                 ` Charles Forsyth
2008-04-17 23:09                                   ` Charles Forsyth
2008-04-21 14:56                                     ` erik quanstrom
2008-04-21 15:24                                       ` Charles Forsyth
2008-04-21 19:37                                         ` erik quanstrom
2008-04-21 20:20                                           ` Charles Forsyth
2008-04-21 19:28                                       ` Bakul Shah
2008-04-21 20:19                                         ` Charles Forsyth
2008-04-21 20:19                                         ` Charles Forsyth
2008-04-21 21:06                                           ` Bakul Shah
2008-04-21 21:24                                             ` Charles Forsyth
2008-04-21 21:40                                               ` Wes Kussmaul
2008-04-21 21:45                                                 ` erik quanstrom
2008-04-21 22:04                                                   ` Wes Kussmaul
2008-04-21 21:57                                                 ` Charles Forsyth
2008-04-21 22:07                                               ` Bakul Shah
2008-04-21 23:12                                                 ` Charles Forsyth
2008-04-21 21:49                                         ` erik quanstrom
2008-04-21 22:42                                           ` Bakul Shah
2008-04-17 21:42                       ` Bakul Shah
2008-04-17 21:49                         ` Charles Forsyth
2008-04-17 21:49                           ` erik quanstrom
2008-04-17 22:15                             ` Charles Forsyth
2008-04-17 22:19                               ` erik quanstrom
2008-04-17 22:48                                 ` Charles Forsyth
2008-04-17 22:55                                   ` Tim Wiess
2008-04-17 23:08                                     ` Charles Forsyth
2008-04-17 22:14                           ` Bakul Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080416133300.E90521E8C3A@holo.morphisms.net \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).