| plan 9 kernel history: overview | file list | diff list |
2000/0706/ip/tcp.c (diff list | history)
| 2000/0424/sys/src/9/ip/tcp.c:196,220 – 2000/0706/sys/src/9/ip/tcp.c:196,241 (short | long | prev | next) | ||
| 1997/0327 | int tcp_irtt = DEF_RTT; /* Initial guess at round trip time */ ushort tcp_mss = DEF_MSS; /* Maximum segment size to be sent */ | |
| 1998/0313 |
| |
| 2000/0706 | enum { /* MIB stats */ MaxConn, ActiveOpens, PassiveOpens, EstabResets, CurrEstab, InSegs, OutSegs, RetransSegs, RetransTimeouts, InErrs, OutRsts, /* non-MIB stats */ CsumErrs, HlenErrs, LenErrs, OutOfOrder, Nstats }; static char *statnames[] = | |
| 1997/0916 | { | |
| 1998/0313 |
| |
| 1999/0401 |
| |
| 1998/0313 |
| |
| 2000/0706 | [MaxConn] "MaxConn", [ActiveOpens] "ActiveOpens", [PassiveOpens] "PassiveOpens", [EstabResets] "EstabResets", [CurrEstab] "CurrEstab", [InSegs] "InSegs", [OutSegs] "OutSegs", [RetransSegs] "RetransSegs", [RetransTimeouts] "RetransTimeouts", [InErrs] "InErrs", [OutRsts] "OutRsts", [CsumErrs] "CsumErrs", [HlenErrs] "HlenErrs", [LenErrs] "LenErrs", [OutOfOrder] "OutOfOrder", | |
| 1998/0313 | }; | |
| 1997/0916 | ||
| 1998/0313 | typedef struct Tcppriv Tcppriv; | |
| 2000/0424/sys/src/9/ip/tcp.c:224,238 – 2000/0706/sys/src/9/ip/tcp.c:245,252 | ||
| 1998/0313 | QLock tl; /* Protect timer list */ Rendez tcpr; /* used by tcpackproc */ | |
| 2000/0706 | ulong stats[Nstats]; | |
| 1998/0313 |
| |
| 1998/0924 | /* for keeping track of tcpackproc */ int ackprocstarted; QLock apl; | |
| 2000/0424/sys/src/9/ip/tcp.c:270,278 – 2000/0706/sys/src/9/ip/tcp.c:284,292 | ||
| 1997/0327 | return; | |
| 1998/0313 | if(oldstate == Established) | |
| 2000/0706 | tpriv->stats[CurrEstab]--; | |
| 1998/0313 | if(newstate == Established) | |
| 2000/0706 | tpriv->stats[CurrEstab]++; | |
| 1998/0313 | ||
| 1998/0630 | /** print( "%d/%d %s->%s CurrEstab=%d\n", s->lport, s->rport, | |
| 2000/0424/sys/src/9/ip/tcp.c:691,703 – 2000/0706/sys/src/9/ip/tcp.c:705,717 | ||
| 1997/0327 | switch(mode) { case TCP_LISTEN: | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[PassiveOpens]++; | |
| 1997/0327 | tcb->flags |= CLONE; tcpsetstate(s, Listen); break; case TCP_CONNECT: | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[ActiveOpens]++; | |
| 1997/0327 | /* Send SYN, go into SYN_SENT state */ | |
| 1999/0302 | qlock(s); | |
| 2000/0102 | if(waserror()){ | |
| 2000/0424/sys/src/9/ip/tcp.c:895,901 – 2000/0706/sys/src/9/ip/tcp.c:909,915 | ||
| 1998/0306 | hnputs(ph.tcpsport, seg->dest); hnputs(ph.tcpdport, seg->source); | |
| 1997/0327 | ||
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[OutRsts]++; | |
| 1997/0327 | rflags = RST; /* convince the other end that this reset is in band */ | |
| 2000/0424/sys/src/9/ip/tcp.c:1207,1213 – 2000/0706/sys/src/9/ip/tcp.c:1221,1227 | ||
| 1998/0313 | f = tcp->f; tpriv = tcp->priv; | |
| 2000/0706 | tpriv->stats[InSegs]++; | |
| 1998/0313 | ||
| 1997/0327 | h = (Tcphdr*)(bp->rp); | |
| 2000/0424/sys/src/9/ip/tcp.c:1218,1224 – 2000/0706/sys/src/9/ip/tcp.c:1232,1239 | ||
| 1997/0327 | h->Unused = 0; hnputs(h->tcplen, length-TCP_PKT); if(ptclcsum(bp, TCP_IPLEN, length-TCP_IPLEN)) { | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[CsumErrs]++; tpriv->stats[InErrs]++; | |
| 1998/0313 | netlog(f, Logtcp, "bad tcp proto cksum\n"); | |
| 1997/0327 | freeblist(bp); return; | |
| 2000/0424/sys/src/9/ip/tcp.c:1226,1232 – 2000/0706/sys/src/9/ip/tcp.c:1241,1248 | ||
| 1997/0327 | hdrlen = ntohtcp(&seg, &bp); if(hdrlen < 0){ | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[HlenErrs]++; tpriv->stats[InErrs]++; | |
| 1998/0313 | netlog(f, Logtcp, "bad tcp hdr len\n"); | |
| 1997/0327 | return; } | |
| 2000/0424/sys/src/9/ip/tcp.c:1235,1241 – 2000/0706/sys/src/9/ip/tcp.c:1251,1258 | ||
| 1997/0327 | length -= hdrlen+TCP_PKT; bp = trimblock(bp, hdrlen+TCP_PKT, length); if(bp == nil){ | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[LenErrs]++; tpriv->stats[InErrs]++; | |
| 1998/0313 | netlog(f, Logtcp, "tcp len < 0 after trim\n"); | |
| 1997/0327 | return; } | |
| 2000/0424/sys/src/9/ip/tcp.c:1424,1430 – 2000/0706/sys/src/9/ip/tcp.c:1441,1447 | ||
| 1997/0327 | if(seg.seq != tcb->rcv.nxt) if(length != 0 || (seg.flags & (SYN|FIN))) { update(s, &seg); | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[OutOfOrder]++; | |
| 1999/1006 | if(addreseq(tcb, &seg, bp, length) < 0) print("reseq %I.%d -> %I.%d\n", s->raddr, s->rport, s->laddr, s->lport); | |
| 1997/0327 | tcb->flags |= FORCE; | |
| 2000/0424/sys/src/9/ip/tcp.c:1438,1444 – 2000/0706/sys/src/9/ip/tcp.c:1455,1461 | ||
| 1997/0327 | for(;;) { if(seg.flags & RST) { | |
| 1998/0313 | if(tcb->state == Established) | |
| 2000/0706 | tpriv->stats[EstabResets]++; | |
| 1997/0327 | localclose(s, Econrefused); goto raise; } | |
| 2000/0424/sys/src/9/ip/tcp.c:1771,1777 – 2000/0706/sys/src/9/ip/tcp.c:1788,1794 | ||
| 1997/0327 | if(ssize < n) n = ssize; tcb->resent += n; | |
| 1999/0401 |
| |
| 2000/0706 | tpriv->stats[RetransSegs]++; | |
| 1997/0327 | } tcb->snd.ptr += ssize; | |
| 2000/0424/sys/src/9/ip/tcp.c:1820,1826 – 2000/0706/sys/src/9/ip/tcp.c:1837,1843 | ||
| 1997/0327 | } } | |
| 1998/0313 |
| |
| 2000/0706 | tpriv->stats[OutSegs]++; | |
| 1998/1118 | if(tcb->kacounter > 0) tcpgo(tpriv, &tcb->katimer); | |
| 1999/0817 | ipoput(f, hbp, 0, s->ttl, s->tos); | |
| 2000/0424/sys/src/9/ip/tcp.c:1982,1988 – 2000/0706/sys/src/9/ip/tcp.c:1999,2005 | ||
| 1997/0327 | break; } | |
| 2000/0102 | tcprxmit(s); | |
| 1999/0401 |
| |
| 2000/0706 | tpriv->stats[RetransTimeouts]++; | |
| 1999/0401 | tcb->snd.dupacks = 0; | |
| 1997/0327 | break; case Time_wait: | |
| 2000/0424/sys/src/9/ip/tcp.c:2219,2246 – 2000/0706/sys/src/9/ip/tcp.c:2236,2251 | ||
| 1997/0916 | int | |
| 1998/0313 | tcpstats(Proto *tcp, char *buf, int len) | |
| 1997/0916 | { | |
| 1998/0630 |
| |
| 2000/0706 | Tcppriv *priv; char *p, *e; int i; | |
| 1998/0306 | ||
| 1998/0630 |
| |
| 1999/0401 |
| |
| 1998/0630 |
| |
| 1999/0401 |
| |
| 1998/0630 |
| |
| 2000/0706 | priv = tcp->priv; p = buf; e = p+len; for(i = 0; i < Nstats; i++) p = seprint(p, e, "%s: %lud\n", statnames[i], priv->stats[i]); return p - buf; | |
| 1997/0916 | } | |
| 2000/0424 | /* | |
| 2000/0424/sys/src/9/ip/tcp.c:2312,2318 – 2000/0706/sys/src/9/ip/tcp.c:2317,2323 | ||
| 1998/0313 | tcp->ipproto = IP_TCPPROTO; tcp->nc = Nchans; tcp->ptclsize = sizeof(Tcpctl); | |
| 2000/0706 | tpriv->stats[MaxConn] = Nchans; | |
| 1997/0327 | ||
| 1998/0313 | Fsproto(fs, tcp); } | |