| plan 9 kernel history: overview | file list | diff list |
port/stil.c (diff list | history)
| 1991/1012/sys/src/9/port/stil.c:12,19 – 1991/1013/sys/src/9/port/stil.c:12,22 (short | long) | ||
| 1991/1012 | #include "ipdat.h" #define DPRINT if(pip)print | |
| 1991/1013 | int ilcksum = 1; Queue *Iloutput; /* Il to lance output channel */ | |
| 1991/1012 |
| |
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) | |
| 1991/1012/sys/src/9/port/stil.c:20,25 – 1991/1013/sys/src/9/port/stil.c:23,37 | ||
| 1991/1012 | { Ipconv *ipc; | |
| 1991/1013 | /* Start il service processes */ if(!Iloutput) { Iloutput = WR(q); /* This never goes away - we use this queue to send acks/rejects */ s->opens++; s->inuse++; kproc("ilack", ilackproc, 0); } | |
| 1991/1012 | ipc = &ipconv[s->dev][s->id]; ipc->ipinterface = newipifc(IP_ILPROTO, ilrcvmsg, ipconv[s->dev], 1500, 512, ETHER_HDR, "IL"); | |
| 1991/1012/sys/src/9/port/stil.c:43,49 – 1991/1013/sys/src/9/port/stil.c:55,63 | ||
| 1991/1012 | { Ipconv *ipc; Ilhdr *ih; | |
| 1991/1013 | Ilcb *ic; | |
| 1991/1012 | int dlen; | |
| 1991/1013 | Block *np; | |
| 1991/1012 | /* Prepend udp header to packet and pass on to ip layer */ ipc = (Ipconv *)(q->ptr); | |
| 1991/1012/sys/src/9/port/stil.c:71,76 – 1991/1013/sys/src/9/port/stil.c:85,91 | ||
| 1991/1012 | bp = padb(bp, IL_EHSIZE+IL_HDRSIZE); ih = (Ilhdr *)(bp->rptr); | |
| 1991/1013 | ic = &ipc->ilctl; | |
| 1991/1012 | hnputs(ih->illen, dlen+IL_EHSIZE+IL_HDRSIZE); hnputs(ih->ilsrc, ipc->psrc); | |
| 1991/1012/sys/src/9/port/stil.c:77,92 – 1991/1013/sys/src/9/port/stil.c:92,199 | ||
| 1991/1012 | hnputs(ih->ildst, ipc->pdst); ih->iltype = Ildata; ih->ilspec = 0; | |
| 1991/1013 | hnputl(ih->ilid, ic->sent++); hnputl(ih->ilack, ic->recvd); | |
| 1991/1012 | ih->ilsum[0] = 0; ih->ilsum[1] = 0; | |
| 1991/1013 | /* Checksum of ilheader plus data (not ip & no pseudo header) */ if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); if(ic->unacked) { ic->unackedtail->next = np; ic->unackedtail = np; } else { ic->unacked = np; ic->unackedtail = np; } np->next = 0; | |
| 1991/1012 | PUTNEXT(q, bp); } | |
| 1991/1013 | { PUTNEXT(q, bp); } void ilrcvmsg(Ipconv *ipc, Block *bp) { Ilhdr *ih; ih = (Ilhdr *)bp; plen = blen(bp); if(plen < IL_EHSIZE+IL_HDRSIZE) goto drop; if(ilcksum && ptcl_csum(bp, IL_EHSIZE, plen) != 0) { print("il: cksum error\n"); goto drop; } s = ip_conn(ipc, hngets(ih->ildst), hngets(ih->ilsrc), hngetl(), IP_ILPROTO); if(s == 0) { ilsentctl(0, ih, Ilreset); goto drop; } switch(s->state) { case Closed: ilsentctl(0, ih, Ilreset); goto drop; case Syncee: case Syncer: case Established: case Closing: } drop: freeb(bp); } void ilsendctl(Ipconv *ipc, Ilhdr *inih, int type) { Ilhdr *ih; Ilcb *ic; Block *bp; bp = allocb(IL_EHSIZE+IL_HDRSIZE); ih = (Ilhdr *)(bp->rptr); ic = &ipc->ilctl; hnputs(ih->illen, IL_EHSIZE+IL_HDRSIZE); if(inih) { hnputs(ih->ilsrc, inih->ildst); hnputs(ih->ildst, inih->ilsrc); hnputl(ih->ilid, inih->recvd); hnputl(ih->ilack, inih->sent); } else { hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); hnputl(ih->ilid, ic->sent); hnputl(ih->ilack, ic->recvd); } ih->iltype = type; ih->ilspec = 0; ih->ilsum[0] = 0; ih->ilsum[1] = 0; if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); PUTNEXT(Iloutput, bp); } void ilackproc(void *junk) | |
| 1991/1012 | { } | |
| 1991/1013/sys/src/9/port/stil.c:14,22 – 1991/1014/sys/src/9/port/stil.c:14,24 (short | long) | ||
| 1991/1012 | #define DPRINT if(pip)print | |
| 1991/1013 | int ilcksum = 1; Queue *Iloutput; /* Il to lance output channel */ | |
| 1991/1014 | static int initseq = 25000; | |
| 1991/1012 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1014 | void ilsendctl(Ipconv *, Ilhdr *, int); | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) | |
| 1991/1013/sys/src/9/port/stil.c:126,131 – 1991/1014/sys/src/9/port/stil.c:128,135 | ||
| 1991/1013 | ilrcvmsg(Ipconv *ipc, Block *bp) { Ilhdr *ih; | |
| 1991/1014 | int plen; Ipconv *s; | |
| 1991/1013 | ih = (Ilhdr *)bp; | |
| 1991/1013/sys/src/9/port/stil.c:138,158 – 1991/1014/sys/src/9/port/stil.c:142,153 | ||
| 1991/1013 | goto drop; } | |
| 1991/1014 | s = ip_conn(ipc, nhgets(ih->ildst), nhgets(ih->ilsrc), nhgetl(ih->src), IP_ILPROTO); | |
| 1991/1013 | if(s == 0) { | |
| 1991/1014 | ilsendctl(0, ih, Ilreset); | |
| 1991/1013 | goto drop; } | |
| 1991/1013/sys/src/9/port/stil.c:171,180 – 1991/1014/sys/src/9/port/stil.c:166,175 | ||
| 1991/1013 | hnputs(ih->illen, IL_EHSIZE+IL_HDRSIZE); if(inih) { | |
| 1991/1014 | hnputs(ih->ilsrc, nhgets(inih->ildst)); hnputs(ih->ildst, nhgets(inih->ilsrc)); hnputl(ih->ilid, nhgetl(inih->ilack)); hnputl(ih->ilack, nhgetl(inih->ilid)); | |
| 1991/1013 | } else { hnputs(ih->ilsrc, ipc->psrc); | |
| 1991/1013/sys/src/9/port/stil.c:196,199 – 1991/1014/sys/src/9/port/stil.c:191,222 | ||
| 1991/1013 | void ilackproc(void *junk) | |
| 1991/1012 | { | |
| 1991/1014 | } void ilstart(Ipconv *ipc, int type, int window) { Ilcb *ic = &ipc->ilctl; if(ic->state != Ilclosed) return; ic->unacked = 0; ic->outoforder = 0; initseq += TK2MS(MACHP(0)->ticks); ic->sent = initseq; ic->recvd = ic->sent; ic->lastack = ic->sent; ic->window = window; switch(type) { case IL_PASSIVE: ic->state = Illistening; break; case IL_ACTIVE: ic->state = Ilsyncer; ilsendctl(ipc, 0, Ilsync); break; } | |
| 1991/1012 | } | |
| 1991/1014/sys/src/9/port/stil.c:15,20 – 1991/1015/sys/src/9/port/stil.c:15,21 (short | long) | ||
| 1991/1013 | int ilcksum = 1; Queue *Iloutput; /* Il to lance output channel */ | |
| 1991/1014 | static int initseq = 25000; | |
| 1991/1015 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1012 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1015/sys/src/9/port/stil.c:13,19 – 1991/1019/sys/src/9/port/stil.c:13,19 (short | long) | ||
| 1991/1012 | #define DPRINT if(pip)print | |
| 1991/1013 | int ilcksum = 1; | |
| 1991/1019 | ||
| 1991/1014 | static int initseq = 25000; | |
| 1991/1015 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1012 | ||
| 1991/1015/sys/src/9/port/stil.c:25,37 – 1991/1019/sys/src/9/port/stil.c:25,42 | ||
| 1991/1012 | ilopen(Queue *q, Stream *s) { Ipconv *ipc; | |
| 1991/1019 | static int ilkproc; | |
| 1991/1012 | ||
| 1991/1013 | /* Start il service processes */ | |
| 1991/1019 | if(!Ipoutput) { Ipoutput = WR(q); | |
| 1991/1013 | /* This never goes away - we use this queue to send acks/rejects */ s->opens++; s->inuse++; | |
| 1991/1019 | } if(ilkproc == 0) { ilkproc = 1; | |
| 1991/1013 | kproc("ilack", ilackproc, 0); } | |
| 1991/1015/sys/src/9/port/stil.c:62,72 – 1991/1019/sys/src/9/port/stil.c:67,84 | ||
| 1991/1012 | int dlen; | |
| 1991/1013 | Block *np; | |
| 1991/1012 |
| |
| 1991/1019 | switch(ipc->ilctl.state) { case Ilclosed: case Ilsyncee: case Illistening: case Ilclosing: error(Ehungup); } | |
| 1991/1012 | if(bp->type != M_DATA) { freeb(bp); error(Ebadctl); | |
| 1991/1015/sys/src/9/port/stil.c:90,96 – 1991/1019/sys/src/9/port/stil.c:102,113 | ||
| 1991/1012 | ih = (Ilhdr *)(bp->rptr); | |
| 1991/1013 | ic = &ipc->ilctl; | |
| 1991/1012 |
| |
| 1991/1019 | /* Ip fields */ hnputl(ih->src, Myip); hnputl(ih->dst, ipc->dst); ih->proto = IP_ILPROTO; /* Il fields */ hnputs(ih->illen, dlen+IL_HDRSIZE); | |
| 1991/1012 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); ih->iltype = Ildata; | |
| 1991/1015/sys/src/9/port/stil.c:104,111 – 1991/1019/sys/src/9/port/stil.c:121,140 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1019 | ilackq(ic, bp); PUTNEXT(q, bp); } void ilackq(Ilctl *ic, Block *bp) { Block *np; | |
| 1991/1013 | /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); | |
| 1991/1019 | lock(ic); | |
| 1991/1013 | if(ic->unacked) { ic->unackedtail->next = np; ic->unackedtail = np; | |
| 1991/1015/sys/src/9/port/stil.c:115,122 – 1991/1019/sys/src/9/port/stil.c:144,176 | ||
| 1991/1013 | ic->unackedtail = np; } np->next = 0; | |
| 1991/1019 | unlock(ic); } | |
| 1991/1013 | ||
| 1991/1012 |
| |
| 1991/1019 | void ilackto(Ilctl *ic, ulong ackto) { Ilhdr *h; Block *bp; for(;;) { lock(ic); if(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; if(ackto < hngetl(h->ilack)) { unlock(ic); break; } bp = ic->unacked; ic->unacked = bp->next; unlock(ic); freeb(bp); } else { unlock(ic); break; } } | |
| 1991/1012 | } void | |
| 1991/1015/sys/src/9/port/stil.c:143,171 – 1991/1019/sys/src/9/port/stil.c:197,275 | ||
| 1991/1013 | goto drop; } | |
| 1991/1014 |
| |
| 1991/1013 |
| |
| 1991/1014 |
| |
| 1991/1013 |
| |
| 1991/1019 | etab = &ipc[conf.ip]; for(s = ipc; s < etab; s++) { if(s->sport == ih->ildst && s->dport == ih->ilsrc) { ilprocess(s, ih, bp); return; } | |
| 1991/1013 | } | |
| 1991/1019 | for(s = ipc; s < etab; s++) { if(s->state == Illistening && s->sport == 0) { /* Do the listener stuff */ ilprocess(s, ih, bp); return; } } ilsendctl(0, ih, Ilreset); | |
| 1991/1013 | freeb(bp); } void | |
| 1991/1019 | ilprocess(Ipconv *s, Ihdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1019 | switch(s->ilctl.state) { case Ilclosed: case Ilclosing: case Illistener: error(Ehungup); } switch(h->type) { case Ilsync: if(s->ilctl.state == Ilsync) s->ilctl.state = Ilestablished; freeb(bp); break; case Ilack: ilackto(&s->ilctl, hngetl(g->ilack)); freeb(bp); break; case Ilquerey: ilsendctl(s, 0, Ilack, 1); freeb(bp); break; case Ildataquery: case Ildata: ilackto(&s->ilctl, hngetl(h->ilack)); bp->rptr += IL_EHSIZE+IL_HDRSIZE; PUTNEXT(s->readq, bp); break; case Ilreset: s->ilctl.state = Closed; freeb(bp); } } void ilsendctl(Ipconv *ipc, Ilhdr *inih, int type, int ack) { | |
| 1991/1013 | Ilhdr *ih; Ilcb *ic; Block *bp; bp = allocb(IL_EHSIZE+IL_HDRSIZE); | |
| 1991/1019 | bp->wptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1013 | ih = (Ilhdr *)(bp->rptr); ic = &ipc->ilctl; | |
| 1991/1019 | /* Ip fields */ hnputl(ih->src, Myip); hnputl(ih->dst, ipc->dst); ih->proto = IP_ILPROTO; hnputs(ih->illen, IL_HDRSIZE); | |
| 1991/1013 | if(inih) { | |
| 1991/1014 | hnputs(ih->ilsrc, nhgets(inih->ildst)); hnputs(ih->ildst, nhgets(inih->ilsrc)); | |
| 1991/1015/sys/src/9/port/stil.c:186,192 – 1991/1019/sys/src/9/port/stil.c:290,300 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1019 | if(!ack) { ic->sent++; /* Maybe needs locking */ ilackq(&ipc->ilctl, bp); } PUTNEXT(Ipoutput, bp); | |
| 1991/1013 | } void | |
| 1991/1019/sys/src/9/port/stil.c:19,25 – 1991/1022/sys/src/9/port/stil.c:19,27 (short | long) | ||
| 1991/1012 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1014 |
| |
| 1991/1022 | void ilsendctl(Ipconv*, Ilhdr*, int, int); void ilackq(Ilcb*, Block*); void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) | |
| 1991/1019/sys/src/9/port/stil.c:127,133 – 1991/1022/sys/src/9/port/stil.c:129,135 | ||
| 1991/1019 | } void | |
| 1991/1022 | ilackq(Ilcb *ic, Block *bp) | |
| 1991/1019 | { Block *np; | |
| 1991/1019/sys/src/9/port/stil.c:148,154 – 1991/1022/sys/src/9/port/stil.c:150,156 | ||
| 1991/1019 | } | |
| 1991/1013 | ||
| 1991/1019 | void | |
| 1991/1022 | ilackto(Ilcb *ic, ulong ackto) | |
| 1991/1019 | { Ilhdr *h; Block *bp; | |
| 1991/1019/sys/src/9/port/stil.c:157,163 – 1991/1022/sys/src/9/port/stil.c:159,165 | ||
| 1991/1019 | lock(ic); if(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; | |
| 1991/1022 | if(ackto < nhgetl(h->ilack)) { | |
| 1991/1019 | unlock(ic); break; } | |
| 1991/1019/sys/src/9/port/stil.c:184,190 – 1991/1022/sys/src/9/port/stil.c:186,193 | ||
| 1991/1013 | { Ilhdr *ih; | |
| 1991/1014 | int plen; | |
| 1991/1022 | Ipconv *s, *etab; short sp, dp; | |
| 1991/1013 | ih = (Ilhdr *)bp; | |
| 1991/1019/sys/src/9/port/stil.c:197,205 – 1991/1022/sys/src/9/port/stil.c:200,210 | ||
| 1991/1013 | goto drop; } | |
| 1991/1022 | sp = nhgets(ih->ildst); dp = nhgets(ih->ilsrc); | |
| 1991/1019 | etab = &ipc[conf.ip]; for(s = ipc; s < etab; s++) { | |
| 1991/1022 | if(s->psrc == sp && s->pdst == dp) { | |
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1019/sys/src/9/port/stil.c:206,232 – 1991/1022/sys/src/9/port/stil.c:211,238 | ||
| 1991/1019 | ||
| 1991/1013 | } | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1022 | if(s->ilctl.state == Illistening && s->psrc == 0) { | |
| 1991/1019 | /* Do the listener stuff */ ilprocess(s, ih, bp); return; } } | |
| 1991/1022 | ilsendctl(0, ih, Ilreset, 0); drop: | |
| 1991/1013 | freeb(bp); } void | |
| 1991/1019 |
| |
| 1991/1022 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1019 | switch(s->ilctl.state) { case Ilclosed: case Ilclosing: | |
| 1991/1022 | case Illistening: | |
| 1991/1019 | error(Ehungup); } | |
| 1991/1022 | switch(h->iltype) { | |
| 1991/1019 | case Ilsync: if(s->ilctl.state == Ilsync) s->ilctl.state = Ilestablished; | |
| 1991/1019/sys/src/9/port/stil.c:233,239 – 1991/1022/sys/src/9/port/stil.c:239,245 | ||
| 1991/1019 | freeb(bp); break; case Ilack: | |
| 1991/1022 | ilackto(&s->ilctl, nhgetl(h->ilack)); | |
| 1991/1019 | freeb(bp); break; case Ilquerey: | |
| 1991/1019/sys/src/9/port/stil.c:242,253 – 1991/1022/sys/src/9/port/stil.c:248,259 | ||
| 1991/1019 | break; case Ildataquery: case Ildata: | |
| 1991/1022 | ilackto(&s->ilctl, nhgetl(h->ilack)); | |
| 1991/1019 | bp->rptr += IL_EHSIZE+IL_HDRSIZE; PUTNEXT(s->readq, bp); break; case Ilreset: | |
| 1991/1022 | s->ilctl.state = Ilclosed; | |
| 1991/1019 | freeb(bp); } } | |
| 1991/1019/sys/src/9/port/stil.c:324,330 – 1991/1022/sys/src/9/port/stil.c:330,336 | ||
| 1991/1014 | break; case IL_ACTIVE: ic->state = Ilsyncer; | |
| 1991/1022 | ilsendctl(ipc, 0, Ilsync, 1); | |
| 1991/1014 | break; } | |
| 1991/1022/sys/src/9/port/stil.c:12,22 – 1991/1023/sys/src/9/port/stil.c:12,21 (short | long) | ||
| 1991/1012 | #include "ipdat.h" #define DPRINT if(pip)print | |
| 1991/1013 |
| |
| 1991/1023 | int ilcksum = 1; static int initseq = 25000; char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1019 | ||
| 1991/1014 |
| |
| 1991/1015 |
| |
| 1991/1012 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1022 | void ilsendctl(Ipconv*, Ilhdr*, int, int); | |
| 1991/1022/sys/src/9/port/stil.c:186,192 – 1991/1023/sys/src/9/port/stil.c:185,191 | ||
| 1991/1013 | { Ilhdr *ih; | |
| 1991/1014 | int plen; | |
| 1991/1022 |
| |
| 1991/1023 | Ipconv *s, *etab, *new; | |
| 1991/1022 | short sp, dp; | |
| 1991/1013 | ih = (Ilhdr *)bp; | |
| 1991/1022/sys/src/9/port/stil.c:210,222 – 1991/1023/sys/src/9/port/stil.c:209,237 | ||
| 1991/1019 | } | |
| 1991/1013 | } | |
| 1991/1023 | ||
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1022 | if(s->ilctl.state == Illistening && s->psrc == 0) { | |
| 1991/1019 | /* Do the listener stuff */ | |
| 1991/1023 | new = ipincoming(ipc); if(new == 0) goto reset; if(ih->type != Ilsync) goto reset; new->newcon = 1; new->ipinterface = s->ipinterface; s->ipinterface->ref++; new->psrc = sp; new->pdst = dp; new->dst = nhgetl(ih->src); ilprocess(new, ih, bp); wakeup(&s->listenr); | |
| 1991/1019 | return; } } | |
| 1991/1023 | reset: | |
| 1991/1022 | ilsendctl(0, ih, Ilreset, 0); drop: | |
| 1991/1013 | freeb(bp); | |
| 1991/1022/sys/src/9/port/stil.c:333,337 – 1991/1023/sys/src/9/port/stil.c:348,351 | ||
| 1991/1022 | ilsendctl(ipc, 0, Ilsync, 1); | |
| 1991/1014 | break; } | |
| 1991/1012 | } | |
| 1991/1023/sys/src/9/port/stil.c:187,194 – 1991/1024/sys/src/9/port/stil.c:187,195 (short | long) | ||
| 1991/1014 | int plen; | |
| 1991/1023 | Ipconv *s, *etab, *new; | |
| 1991/1022 | short sp, dp; | |
| 1991/1024 | Ipaddr dst; | |
| 1991/1013 |
| |
| 1991/1024 | ih = (Ilhdr *)bp->rptr; | |
| 1991/1013 | plen = blen(bp); if(plen < IL_EHSIZE+IL_HDRSIZE) | |
| 1991/1023/sys/src/9/port/stil.c:201,209 – 1991/1024/sys/src/9/port/stil.c:202,214 | ||
| 1991/1013 | ||
| 1991/1022 | sp = nhgets(ih->ildst); dp = nhgets(ih->ilsrc); | |
| 1991/1024 | dst = nhgetl(ih->src); print("got packet from %d.%d.%d.%d %d %d\n", fmtaddr(dst), sp, dp); | |
| 1991/1019 | etab = &ipc[conf.ip]; for(s = ipc; s < etab; s++) { | |
| 1991/1022 |
| |
| 1991/1024 | if(s->psrc == sp && s->pdst == dp && s->dst == dst) { | |
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1023/sys/src/9/port/stil.c:210,217 – 1991/1024/sys/src/9/port/stil.c:215,227 | ||
| 1991/1019 | ||
| 1991/1013 | } | |
| 1991/1023 | ||
| 1991/1024 | if(s->curlog > s->backlog) { print("Backlog\n"); goto reset; } | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1022 |
| |
| 1991/1024 | if(s->ilctl.state == Illistening && s->pdst == 0) { | |
| 1991/1019 | /* Do the listener stuff */ | |
| 1991/1023 | new = ipincoming(ipc); if(new == 0) | |
| 1991/1023/sys/src/9/port/stil.c:222,227 – 1991/1024/sys/src/9/port/stil.c:232,238 | ||
| 1991/1023 | new->newcon = 1; new->ipinterface = s->ipinterface; s->ipinterface->ref++; | |
| 1991/1024 | s->curlog++; | |
| 1991/1023 | new->psrc = sp; new->pdst = dp; new->dst = nhgetl(ih->src); | |
| 1991/1023/sys/src/9/port/stil.c:240,245 – 1991/1024/sys/src/9/port/stil.c:251,258 | ||
| 1991/1013 | void | |
| 1991/1022 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1024 | Block *nb; | |
| 1991/1019 | switch(s->ilctl.state) { case Ilclosed: case Ilclosing: | |
| 1991/1023/sys/src/9/port/stil.c:265,274 – 1991/1024/sys/src/9/port/stil.c:278,291 | ||
| 1991/1019 | case Ildata: | |
| 1991/1022 | ilackto(&s->ilctl, nhgetl(h->ilack)); | |
| 1991/1019 | bp->rptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1024 | /* Check and trim to length */ | |
| 1991/1019 | PUTNEXT(s->readq, bp); break; case Ilreset: | |
| 1991/1022 | s->ilctl.state = Ilclosed; | |
| 1991/1024 | nb = allocb(0); nb->type = M_HANGUP; PUTNEXT(s->readq, nb); | |
| 1991/1019 | freeb(bp); } } | |
| 1991/1023/sys/src/9/port/stil.c:287,297 – 1991/1024/sys/src/9/port/stil.c:304,314 | ||
| 1991/1013 | ic = &ipc->ilctl; | |
| 1991/1019 | /* Ip fields */ | |
| 1991/1024 | hnputl(ih->src, Myip); | |
| 1991/1019 | hnputs(ih->illen, IL_HDRSIZE); | |
| 1991/1013 | if(inih) { | |
| 1991/1024 | hnputl(ih->dst, nhgetl(inih->src)); | |
| 1991/1014 | hnputs(ih->ilsrc, nhgets(inih->ildst)); hnputs(ih->ildst, nhgets(inih->ilsrc)); hnputl(ih->ilid, nhgetl(inih->ilack)); | |
| 1991/1023/sys/src/9/port/stil.c:298,303 – 1991/1024/sys/src/9/port/stil.c:315,321 | ||
| 1991/1014 | hnputl(ih->ilack, nhgetl(inih->ilid)); | |
| 1991/1013 | } else { | |
| 1991/1024 | hnputl(ih->dst, ipc->dst); | |
| 1991/1013 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); hnputl(ih->ilid, ic->sent); | |
| 1991/1023/sys/src/9/port/stil.c:311,317 – 1991/1024/sys/src/9/port/stil.c:329,335 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1019 |
| |
| 1991/1024 | if(!ack && ipc) { | |
| 1991/1019 | ic->sent++; /* Maybe needs locking */ ilackq(&ipc->ilctl, bp); } | |
| 1991/1024/sys/src/9/port/stil.c:135,141 – 1991/1025/sys/src/9/port/stil.c:135,140 (short | long) | ||
| 1991/1013 | /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); | |
| 1991/1019 |
| |
| 1991/1013 | if(ic->unacked) { ic->unackedtail->next = np; ic->unackedtail = np; | |
| 1991/1024/sys/src/9/port/stil.c:145,151 – 1991/1025/sys/src/9/port/stil.c:144,149 | ||
| 1991/1013 | ic->unackedtail = np; } np->next = 0; | |
| 1991/1019 |
| |
| 1991/1013 | ||
| 1991/1019 | void | |
| 1991/1024/sys/src/9/port/stil.c:154,176 – 1991/1025/sys/src/9/port/stil.c:152,164 | ||
| 1991/1019 | Ilhdr *h; Block *bp; | |
| 1991/1022 |
| |
| 1991/1019 |
| |
| 1991/1025 | while(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; if(ackto < nhgetl(h->ilack)) break; bp = ic->unacked; ic->unacked = bp->next; freeb(bp); | |
| 1991/1019 | } | |
| 1991/1012 | } | |
| 1991/1024/sys/src/9/port/stil.c:215,243 – 1991/1025/sys/src/9/port/stil.c:203,230 | ||
| 1991/1019 | ||
| 1991/1013 | } | |
| 1991/1023 | ||
| 1991/1024 |
| |
| 1991/1025 | if(s->curlog > s->backlog) | |
| 1991/1024 | goto reset; | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1024 |
| |
| 1991/1025 | if(s->ilctl.state == Illistening && s->pdst == 0 && s->dst == 0) { | |
| 1991/1019 | /* Do the listener stuff */ | |
| 1991/1023 | new = ipincoming(ipc); | |
| 1991/1025 | if(new == 0) | |
| 1991/1023 | goto reset; | |
| 1991/1025 | if(ih->iltype != Ilsync) | |
| 1991/1023 | goto reset; new->newcon = 1; new->ipinterface = s->ipinterface; | |
| 1991/1024 |
| |
| 1991/1023 | new->psrc = sp; new->pdst = dp; | |
| 1991/1025 | new->ilctl.state = Ilsyncee; | |
| 1991/1023 | new->dst = nhgetl(ih->src); ilprocess(new, ih, bp); | |
| 1991/1025 | s->ipinterface->ref++; s->curlog++; | |
| 1991/1023 | wakeup(&s->listenr); | |
| 1991/1019 | return; } | |
| 1991/1024/sys/src/9/port/stil.c:252,273 – 1991/1025/sys/src/9/port/stil.c:239,270 | ||
| 1991/1022 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1024 | Block *nb; | |
| 1991/1025 | ulong id, ack; | |
| 1991/1024 | ||
| 1991/1025 | /* Active transition machine - this tracks connection state */ | |
| 1991/1019 | switch(s->ilctl.state) { | |
| 1991/1025 | case Ilsyncee: switch(h->iltype) { case Ilsync: ilsendctl(s, 0, Ilsync, 0); break; case Ilack: s->ilctl.state = Ilestablished; break; } break; | |
| 1991/1019 | case Ilclosed: case Ilclosing: | |
| 1991/1022 |
| |
| 1991/1019 |
| |
| 1991/1025 | goto hungup; | |
| 1991/1019 | } | |
| 1991/1025 | /* Passive actions based on packet type */ | |
| 1991/1022 | switch(h->iltype) { | |
| 1991/1019 |
| |
| 1991/1022 |
| |
| 1991/1025 | ack = nhgetl(h->ilack); if(s->ilctl.recvd+1 == ack) s->ilctl.recvd = ack; ilackto(&s->ilctl, ack); | |
| 1991/1019 | freeb(bp); break; case Ilquerey: | |
| 1991/1024/sys/src/9/port/stil.c:277,293 – 1991/1025/sys/src/9/port/stil.c:274,333 | ||
| 1991/1019 | case Ildataquery: case Ildata: | |
| 1991/1022 | ilackto(&s->ilctl, nhgetl(h->ilack)); | |
| 1991/1019 |
| |
| 1991/1024 |
| |
| 1991/1019 |
| |
| 1991/1025 | switch(s->ilctl.state) { default: iloutoforder(s, h, bp); break; case Ilestablished: id = nhgetl(h->ilid); if(id < s->ilctl.recvd) freeb(bp); else if(id > s->ilctl.recvd) iloutoforder(s, h, bp); else { bp->rptr += IL_EHSIZE+IL_HDRSIZE; PUTNEXT(s->readq, bp); } } | |
| 1991/1019 | break; case Ilreset: | |
| 1991/1022 | s->ilctl.state = Ilclosed; | |
| 1991/1024 |
| |
| 1991/1025 | hungup: if(s->readq) { nb = allocb(0); nb->type = M_HANGUP; PUTNEXT(s->readq, nb); } | |
| 1991/1019 | freeb(bp); } | |
| 1991/1025 | } void iloutoforder(Ipconv *s, Ilhdr *h, Block *bp) { Block *f, **l; Ilcb *ic; ulong id; uchar *lid; ic = &s->ilctl; if(ic->outoforder == 0) { ic->outoforder = bp; bp->next = 0; return; } id = nhgetl(h->id); l = &ic->outoforder; for(f = *l; f; f = f->next) { lid = ((Ilhdr*)(bp->rptr))->ilid; if(id < nhgetl(lid)) break; l = &f->next; } bp->next = *l; *l = bp; | |
| 1991/1019 | } void | |
| 1991/1025/sys/src/9/port/stil.c:220,225 – 1991/1026/sys/src/9/port/stil.c:220,227 (short | long) | ||
| 1991/1023 | new->psrc = sp; new->pdst = dp; | |
| 1991/1025 | new->ilctl.state = Ilsyncee; | |
| 1991/1026 | initseq += TK2MS(MACHP(0)->ticks); new->ilctl.sent = initseq; | |
| 1991/1023 | new->dst = nhgetl(ih->src); ilprocess(new, ih, bp); | |
| 1991/1025/sys/src/9/port/stil.c:239,258 – 1991/1026/sys/src/9/port/stil.c:241,274 | ||
| 1991/1022 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1024 | Block *nb; | |
| 1991/1025 |
| |
| 1991/1026 | Ilcb *ic; Ilhdr *oh; ulong id, ack, oid; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); ack = nhgetl(h->ilack); ic = &s->ilctl; | |
| 1991/1025 | /* Active transition machine - this tracks connection state */ | |
| 1991/1019 |
| |
| 1991/1026 | switch(ic->state) { | |
| 1991/1025 | case Ilsyncee: switch(h->iltype) { case Ilsync: | |
| 1991/1026 | ic->recvd = id; | |
| 1991/1025 | ilsendctl(s, 0, Ilsync, 0); break; case Ilack: | |
| 1991/1026 | ic->state = Ilestablished; | |
| 1991/1025 | break; } break; | |
| 1991/1026 | case Ilsyncer: if(h->iltype == Ilsync && ic->start == ack) { ic->recvd = id; ilsendctl(s, 0, Ilack, 0); ic->state = Ilestablished; } break; | |
| 1991/1019 | case Ilclosed: case Ilclosing: | |
| 1991/1025 | goto hungup; | |
| 1991/1025/sys/src/9/port/stil.c:260,269 – 1991/1026/sys/src/9/port/stil.c:276,285 | ||
| 1991/1019 | ||
| 1991/1025 | /* Passive actions based on packet type */ | |
| 1991/1022 | switch(h->iltype) { | |
| 1991/1026 | default: freeb(bp); break; | |
| 1991/1019 | case Ilack: | |
| 1991/1025 |
| |
| 1991/1019 | freeb(bp); break; | |
| 1991/1025/sys/src/9/port/stil.c:273,290 – 1991/1026/sys/src/9/port/stil.c:289,306 | ||
| 1991/1019 | break; case Ildataquery: case Ildata: | |
| 1991/1022 |
| |
| 1991/1026 | ilackto(&s->ilctl, ack); | |
| 1991/1025 | switch(s->ilctl.state) { default: iloutoforder(s, h, bp); break; case Ilestablished: | |
| 1991/1026 | s->ilctl.recvd++; | |
| 1991/1025 | bp->rptr += IL_EHSIZE+IL_HDRSIZE; PUTNEXT(s->readq, bp); } | |
| 1991/1025/sys/src/9/port/stil.c:296,307 – 1991/1026/sys/src/9/port/stil.c:312,346 | ||
| 1991/1025 | if(s->readq) { nb = allocb(0); nb->type = M_HANGUP; | |
| 1991/1026 | nb->flags |= S_DELIM; | |
| 1991/1025 | PUTNEXT(s->readq, nb); } | |
| 1991/1019 | freeb(bp); } | |
| 1991/1026 | /* Process out of order packets */ if(ic->state == Ilestablished) { while(ic->outoforder) { bp = ic->outoforder; oh = (Ilhdr*)bp->rptr; oid = nhgetl(oh->ilid); print("recvd = %d outoforder = %d\n", ic->recvd, oid); if(oid < ic->recvd) { ic->outoforder = bp->next; freeb(bp); } if(oid == ic->recvd) { print("outoforder %d\n", oid); ic->recvd++; ic->outoforder = bp->next; bp->rptr += IL_EHSIZE+IL_HDRSIZE; PUTNEXT(s->readq, bp); } } } | |
| 1991/1025 | } | |
| 1991/1026 | ||
| 1991/1025 | void iloutoforder(Ipconv *s, Ilhdr *h, Block *bp) { | |
| 1991/1025/sys/src/9/port/stil.c:339,344 – 1991/1026/sys/src/9/port/stil.c:378,384 | ||
| 1991/1013 | bp = allocb(IL_EHSIZE+IL_HDRSIZE); | |
| 1991/1019 | bp->wptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1026 | bp->flags |= S_DELIM; | |
| 1991/1019 | ||
| 1991/1013 | ih = (Ilhdr *)(bp->rptr); ic = &ipc->ilctl; | |
| 1991/1025/sys/src/9/port/stil.c:360,365 – 1991/1026/sys/src/9/port/stil.c:400,406 | ||
| 1991/1013 | hnputs(ih->ildst, ipc->pdst); hnputl(ih->ilid, ic->sent); hnputl(ih->ilack, ic->recvd); | |
| 1991/1026 | print("sendctl: id %d ack %d\n", ic->sent, ic->recvd); | |
| 1991/1013 | } ih->iltype = type; ih->ilspec = 0; | |
| 1991/1025/sys/src/9/port/stil.c:393,399 – 1991/1026/sys/src/9/port/stil.c:434,441 | ||
| 1991/1014 | ic->outoforder = 0; initseq += TK2MS(MACHP(0)->ticks); ic->sent = initseq; | |
| 1991/1026 | ic->start = ic->sent; ic->recvd = 0; | |
| 1991/1014 | ic->lastack = ic->sent; ic->window = window; | |
| 1991/1026/sys/src/9/port/stil.c:325,330 – 1991/1028/sys/src/9/port/stil.c:325,332 (short | long) | ||
| 1991/1026 | oh = (Ilhdr*)bp->rptr; oid = nhgetl(oh->ilid); print("recvd = %d outoforder = %d\n", ic->recvd, oid); | |
| 1991/1028 | if(oid > ic->recvd) break; | |
| 1991/1026 | if(oid < ic->recvd) { ic->outoforder = bp->next; freeb(bp); | |
| 1991/1028/sys/src/9/port/stil.c:28,37 – 1991/1030/sys/src/9/port/stil.c:28,35 (short | long) | ||
| 1991/1012 | Ipconv *ipc; | |
| 1991/1019 | static int ilkproc; | |
| 1991/1012 | ||
| 1991/1013 |
| |
| 1991/1019 | if(!Ipoutput) { Ipoutput = WR(q); | |
| 1991/1013 |
| |
| 1991/1019 | } | |
| 1991/1028/sys/src/9/port/stil.c:57,62 – 1991/1030/sys/src/9/port/stil.c:55,67 | ||
| 1991/1012 | void ilclose(Queue *q) { | |
| 1991/1030 | Ipconv *s; s = (Ipconv *)(q->ptr); qlock(s); s->ref--; qunlock(s); s->readq = 0; | |
| 1991/1012 | } void | |
| 1991/1028/sys/src/9/port/stil.c:74,80 – 1991/1030/sys/src/9/port/stil.c:79,84 | ||
| 1991/1012 | ||
| 1991/1019 | switch(ipc->ilctl.state) { case Ilclosed: | |
| 1991/1028/sys/src/9/port/stil.c:123,129 – 1991/1030/sys/src/9/port/stil.c:127,132 | ||
| 1991/1013 | hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1028/sys/src/9/port/stil.c:135,148 – 1991/1030/sys/src/9/port/stil.c:138,148 | ||
| 1991/1013 | /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); | |
| 1991/1019 | ||
| 1991/1013 |
| |
| 1991/1030 | if(ic->unacked) | |
| 1991/1013 | ic->unackedtail->next = np; | |
| 1991/1030 | else | |
| 1991/1013 | ic->unacked = np; | |
| 1991/1030 | ic->unackedtail = np; | |
| 1991/1013 | np->next = 0; | |
| 1991/1019 | } | |
| 1991/1013 | ||
| 1991/1028/sys/src/9/port/stil.c:158,163 – 1991/1030/sys/src/9/port/stil.c:158,164 | ||
| 1991/1025 | break; bp = ic->unacked; ic->unacked = bp->next; | |
| 1991/1030 | bp->next = 0; | |
| 1991/1025 | freeb(bp); | |
| 1991/1019 | } | |
| 1991/1012 | } | |
| 1991/1028/sys/src/9/port/stil.c:172,178 – 1991/1030/sys/src/9/port/stil.c:173,179 | ||
| 1991/1013 | ilrcvmsg(Ipconv *ipc, Block *bp) { Ilhdr *ih; | |
| 1991/1014 |
| |
| 1991/1030 | int plen, illen; | |
| 1991/1023 | Ipconv *s, *etab, *new; | |
| 1991/1022 | short sp, dp; | |
| 1991/1024 | Ipaddr dst; | |
| 1991/1028/sys/src/9/port/stil.c:183,189 – 1991/1030/sys/src/9/port/stil.c:184,194 | ||
| 1991/1013 | if(plen < IL_EHSIZE+IL_HDRSIZE) goto drop; | |
| 1991/1030 | illen = nhgets(ih->illen); if(illen+IL_EHSIZE > plen) goto drop; if(ilcksum && ptcl_csum(bp, IL_EHSIZE, illen) != 0) { | |
| 1991/1013 | print("il: cksum error\n"); goto drop; } | |
| 1991/1028/sys/src/9/port/stil.c:192,199 – 1991/1030/sys/src/9/port/stil.c:197,202 | ||
| 1991/1022 | dp = nhgets(ih->ilsrc); | |
| 1991/1024 | dst = nhgetl(ih->src); | |
| 1991/1019 | etab = &ipc[conf.ip]; for(s = ipc; s < etab; s++) { | |
| 1991/1024 | if(s->psrc == sp && s->pdst == dp && s->dst == dst) { | |
| 1991/1028/sys/src/9/port/stil.c:200,219 – 1991/1030/sys/src/9/port/stil.c:203,222 | ||
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1013 | } | |
| 1991/1023 | ||
| 1991/1030 | if(ih->iltype != Ilsync) goto drop; | |
| 1991/1025 | if(s->curlog > s->backlog) | |
| 1991/1024 | goto reset; | |
| 1991/1030 | /* Look for a listener */ | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1025 | if(s->ilctl.state == Illistening && s->pdst == 0 && s->dst == 0) { | |
| 1991/1019 |
| |
| 1991/1023 | new = ipincoming(ipc); | |
| 1991/1025 | if(new == 0) | |
| 1991/1023 | goto reset; | |
| 1991/1025 |
| |
| 1991/1023 |
| |
| 1991/1028/sys/src/9/port/stil.c:243,249 – 1991/1030/sys/src/9/port/stil.c:246,253 | ||
| 1991/1024 | Block *nb; | |
| 1991/1026 | Ilcb *ic; Ilhdr *oh; | |
| 1991/1030 | ulong id, ack, oid, dlen; int sendack = 0; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); ack = nhgetl(h->ilack); | |
| 1991/1028/sys/src/9/port/stil.c:264,271 – 1991/1030/sys/src/9/port/stil.c:268,275 | ||
| 1991/1025 | break; | |
| 1991/1026 | case Ilsyncer: if(h->iltype == Ilsync && ic->start == ack) { | |
| 1991/1030 | ic->recvd = id+1; sendack = 1; | |
| 1991/1026 | ic->state = Ilestablished; } break; | |
| 1991/1028/sys/src/9/port/stil.c:288,293 – 1991/1030/sys/src/9/port/stil.c:292,298 | ||
| 1991/1019 | freeb(bp); break; case Ildataquery: | |
| 1991/1030 | sendack = 1; | |
| 1991/1019 | case Ildata: | |
| 1991/1026 | ilackto(&s->ilctl, ack); | |
| 1991/1025 | switch(s->ilctl.state) { | |
| 1991/1028/sys/src/9/port/stil.c:301,307 – 1991/1030/sys/src/9/port/stil.c:306,313 | ||
| 1991/1025 | iloutoforder(s, h, bp); else { | |
| 1991/1026 | s->ilctl.recvd++; | |
| 1991/1025 |
| |
| 1991/1030 | dlen = nhgets(h->illen)-IL_HDRSIZE; bp = btrim(bp, IL_EHSIZE+IL_HDRSIZE, dlen); | |
| 1991/1025 | PUTNEXT(s->readq, bp); } } | |
| 1991/1028/sys/src/9/port/stil.c:319,325 – 1991/1030/sys/src/9/port/stil.c:325,331 | ||
| 1991/1019 | } | |
| 1991/1026 | /* Process out of order packets */ | |
| 1991/1030 | if(ic->state == Ilestablished && s->readq) { | |
| 1991/1026 | while(ic->outoforder) { bp = ic->outoforder; oh = (Ilhdr*)bp->rptr; | |
| 1991/1028/sys/src/9/port/stil.c:335,345 – 1991/1030/sys/src/9/port/stil.c:341,358 | ||
| 1991/1026 | print("outoforder %d\n", oid); ic->recvd++; ic->outoforder = bp->next; | |
| 1991/1030 | bp->next = 0; dlen = nhgets(oh->illen)-IL_HDRSIZE; bp = btrim(bp, IL_EHSIZE+IL_HDRSIZE, dlen); | |
| 1991/1026 | PUTNEXT(s->readq, bp); } } } | |
| 1991/1030 | if(sendack) ilsendctl(s, 0, Ilack, 1); print("revd = %d sent = %d\n", ic->recvd, ic->sent); | |
| 1991/1025 | } | |
| 1991/1026 | ||
| 1991/1028/sys/src/9/port/stil.c:352,374 – 1991/1030/sys/src/9/port/stil.c:365,386 | ||
| 1991/1025 | uchar *lid; ic = &s->ilctl; | |
| 1991/1030 | else { id = nhgetl(h->id); l = &ic->outoforder; for(f = *l; f; f = f->next) { lid = ((Ilhdr*)(bp->rptr))->ilid; if(id > nhgetl(lid)) break; l = &f->next; } bp->next = *l; *l = bp; | |
| 1991/1025 | } | |
| 1991/1019 | } void | |
| 1991/1030/sys/src/9/port/stil.c:36,42 – 1991/10302/sys/src/9/port/stil.c:36,42 (short | long) | ||
| 1991/1019 | if(ilkproc == 0) { ilkproc = 1; | |
| 1991/1013 |
| |
| 1991/10302 | kproc("ilack", ilackproc, ipconv[s->dev]); | |
| 1991/1013 | } | |
| 1991/1012 | ipc = &ipconv[s->dev][s->id]; | |
| 1991/1030/sys/src/9/port/stil.c:71,77 – 1991/10302/sys/src/9/port/stil.c:71,77 | ||
| 1991/1012 | Ilhdr *ih; | |
| 1991/1013 | Ilcb *ic; | |
| 1991/1012 | int dlen; | |
| 1991/1013 |
| |
| 1991/10302 | Block *np, *f; | |
| 1991/1012 | ipc = (Ipconv *)(q->ptr); if(ipc->psrc == 0) | |
| 1991/1030/sys/src/9/port/stil.c:90,96 – 1991/10302/sys/src/9/port/stil.c:90,98 | ||
| 1991/1012 | } /* Only allow atomic Il writes to form datagrams */ | |
| 1991/10302 | for(f = bp; f && (f->flags&S_DELIM) == 0; f = f->next) ; if(f ==0 || (f->flags & S_DELIM) == 0) { | |
| 1991/1012 | freeb(bp); error(Emsgsize); } | |
| 1991/1030/sys/src/9/port/stil.c:139,149 – 1991/10302/sys/src/9/port/stil.c:141,151 | ||
| 1991/1013 | np = copyb(bp, blen(bp)); | |
| 1991/1019 | ||
| 1991/1030 | if(ic->unacked) | |
| 1991/1013 |
| |
| 1991/10302 | ic->unackedtail->list = np; | |
| 1991/1030 | else | |
| 1991/1013 | ic->unacked = np; | |
| 1991/1030 | ic->unackedtail = np; | |
| 1991/1013 |
| |
| 1991/10302 | np->list = 0; | |
| 1991/1019 | } | |
| 1991/1013 | ||
| 1991/1019 | void | |
| 1991/1030/sys/src/9/port/stil.c:157,166 – 1991/10302/sys/src/9/port/stil.c:159,169 | ||
| 1991/1025 | if(ackto < nhgetl(h->ilack)) break; bp = ic->unacked; | |
| 1991/1030 |
| |
| 1991/10302 | ic->unacked = bp->list; bp->list = 0; | |
| 1991/1025 | freeb(bp); | |
| 1991/1019 | } | |
| 1991/10302 | if(ic->unacked == 0) print("ack empty: %d\n", ackto); | |
| 1991/1012 | } void | |
| 1991/1030/sys/src/9/port/stil.c:284,290 – 1991/10302/sys/src/9/port/stil.c:287,293 | ||
| 1991/1026 | freeb(bp); break; | |
| 1991/1019 | case Ilack: | |
| 1991/1025 |
| |
| 1991/10302 | ilackto(ic, ack); | |
| 1991/1019 | freeb(bp); break; case Ilquerey: | |
| 1991/1030/sys/src/9/port/stil.c:294,301 – 1991/10302/sys/src/9/port/stil.c:297,304 | ||
| 1991/1019 | case Ildataquery: | |
| 1991/1030 | sendack = 1; | |
| 1991/1019 | case Ildata: | |
| 1991/1026 |
| |
| 1991/1025 |
| |
| 1991/10302 | ilackto(ic, ack); switch(ic->state) { | |
| 1991/1025 | default: iloutoforder(s, h, bp); break; | |
| 1991/1030/sys/src/9/port/stil.c:302,308 – 1991/10302/sys/src/9/port/stil.c:305,311 | ||
| 1991/1025 | case Ilestablished: if(id < s->ilctl.recvd) freeb(bp); | |
| 1991/10302 | else if(s->readq == 0 || id > ic->recvd) | |
| 1991/1025 | iloutoforder(s, h, bp); else { | |
| 1991/1026 | s->ilctl.recvd++; | |
| 1991/1030/sys/src/9/port/stil.c:313,319 – 1991/10302/sys/src/9/port/stil.c:316,322 | ||
| 1991/1025 | } | |
| 1991/1019 | break; case Ilreset: | |
| 1991/1022 |
| |
| 1991/10302 | ic->state = Ilclosed; | |
| 1991/1025 | hungup: if(s->readq) { nb = allocb(0); | |
| 1991/1030/sys/src/9/port/stil.c:334,347 – 1991/10302/sys/src/9/port/stil.c:337,350 | ||
| 1991/1028 | if(oid > ic->recvd) break; | |
| 1991/1026 | if(oid < ic->recvd) { | |
| 1991/10302 | ic->outoforder = bp->list; | |
| 1991/1026 | freeb(bp); } if(oid == ic->recvd) { print("outoforder %d\n", oid); ic->recvd++; | |
| 1991/1030 |
| |
| 1991/10302 | ic->outoforder = bp->list; bp->list = 0; | |
| 1991/1030 | dlen = nhgets(oh->illen)-IL_HDRSIZE; bp = btrim(bp, IL_EHSIZE+IL_HDRSIZE, dlen); | |
| 1991/1026 | PUTNEXT(s->readq, bp); | |
| 1991/1030/sys/src/9/port/stil.c:367,384 – 1991/10302/sys/src/9/port/stil.c:370,387 | ||
| 1991/1025 | ic = &s->ilctl; if(ic->outoforder == 0) { ic->outoforder = bp; | |
| 1991/10302 | bp->list = 0; | |
| 1991/1025 | } | |
| 1991/1030 | else { id = nhgetl(h->id); l = &ic->outoforder; | |
| 1991/10302 | for(f = *l; f; f = f->list) { | |
| 1991/1030 | lid = ((Ilhdr*)(bp->rptr))->ilid; if(id > nhgetl(lid)) break; | |
| 1991/10302 | l = &f->list; | |
| 1991/1030 | } | |
| 1991/10302 | bp->list = *l; | |
| 1991/1030 | *l = bp; | |
| 1991/1025 | } | |
| 1991/1019 | } | |
| 1991/1030/sys/src/9/port/stil.c:432,439 – 1991/10302/sys/src/9/port/stil.c:435,455 | ||
| 1991/1013 | } void | |
| 1991/10302 | ilackproc(void *a) | |
| 1991/1012 | { | |
| 1991/10302 | Rendez wait; Ipconv *base, *end, *s; base = (Ipconv*)a; end = &base[conf.ip]; for(;;) { tsleep(&wait, return0, 0, 250); for(s = base; s < end; s++) { if(s->ilctl.state == Ilclosed) continue; } } | |
| 1991/1014 | } void | |
| 1991/10302/sys/src/9/port/stil.c:12,19 – 1991/1101/sys/src/9/port/stil.c:12,20 (short | long) | ||
| 1991/1012 | #include "ipdat.h" #define DPRINT if(pip)print | |
| 1991/1023 |
| |
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1023 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1019 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); | |
| 1991/10302/sys/src/9/port/stil.c:56,67 – 1991/1101/sys/src/9/port/stil.c:57,93 | ||
| 1991/1012 | ilclose(Queue *q) { | |
| 1991/1030 | Ipconv *s; | |
| 1991/1101 | Ilcb *ic; Block *bp, *next; | |
| 1991/1030 | s = (Ipconv *)(q->ptr); | |
| 1991/1101 | ic = &s->ilctl; | |
| 1991/1030 | qlock(s); s->ref--; | |
| 1991/1101 | qunlock(s); switch(ic->state) { case Ilclosed: break; case Ilsyncer: case Ilsyncee: case Ilestablished: for(bp = ic->outoforder; bp; bp = next) { next = bp->list; freeb(bp); } ic->outoforder = 0; ic->state = Ilclosing; ilsendctl(s, 0, Ilclose, 0); break; Illistening: ic->state = Ilclosed; break; Ilclosing: /* ?? */ break; } | |
| 1991/1012 | } void | |
| 1991/10302/sys/src/9/port/stil.c:90,98 – 1991/1101/sys/src/9/port/stil.c:116,124 | ||
| 1991/1012 | } /* Only allow atomic Il writes to form datagrams */ | |
| 1991/10302 |
| |
| 1991/1101 | for(f = bp; f->next; f = f->next) | |
| 1991/10302 | ; | |
| 1991/1101 | if((f->flags & S_DELIM) == 0) { | |
| 1991/1012 | freeb(bp); error(Emsgsize); } | |
| 1991/10302/sys/src/9/port/stil.c:117,126 – 1991/1101/sys/src/9/port/stil.c:143,152 | ||
| 1991/1019 | hnputs(ih->illen, dlen+IL_HDRSIZE); | |
| 1991/1012 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); | |
| 1991/1013 | hnputl(ih->ilid, ic->sent++); hnputl(ih->ilack, ic->recvd); | |
| 1991/1101 | ih->iltype = Ildata; ih->ilspec = 0; | |
| 1991/1012 | ih->ilsum[0] = 0; ih->ilsum[1] = 0; | |
| 1991/10302/sys/src/9/port/stil.c:163,169 – 1991/1101/sys/src/9/port/stil.c:189,194 | ||
| 1991/10302 | bp->list = 0; | |
| 1991/1025 | freeb(bp); | |
| 1991/1019 | } | |
| 1991/10302 |
| |
| 1991/1012 | } void | |
| 1991/10302/sys/src/9/port/stil.c:201,212 – 1991/1101/sys/src/9/port/stil.c:226,238 | ||
| 1991/1024 | dst = nhgetl(ih->src); | |
| 1991/1019 | etab = &ipc[conf.ip]; | |
| 1991/1024 |
| |
| 1991/1101 | for(s = ipc; s < etab; s++) if(s->psrc == sp) if(s->pdst == dp) if(s->dst == dst) { | |
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1013 |
| |
| 1991/1023 | ||
| 1991/1030 | if(ih->iltype != Ilsync) goto drop; | |
| 1991/10302/sys/src/9/port/stil.c:216,222 – 1991/1101/sys/src/9/port/stil.c:242,250 | ||
| 1991/1024 | ||
| 1991/1030 | /* Look for a listener */ | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1025 |
| |
| 1991/1101 | if(s->ilctl.state == Illistening) if(s->pdst == 0) if(s->dst == 0) { | |
| 1991/1023 | new = ipincoming(ipc); | |
| 1991/1025 | if(new == 0) | |
| 1991/1023 | goto reset; | |
| 1991/10302/sys/src/9/port/stil.c:238,244 – 1991/1101/sys/src/9/port/stil.c:266,272 | ||
| 1991/1019 | } } | |
| 1991/1023 | reset: | |
| 1991/1022 |
| |
| 1991/1101 | ilsendctl(0, ih, Ilclose, 0); | |
| 1991/1022 | drop: | |
| 1991/1013 | freeb(bp); } | |
| 1991/10302/sys/src/9/port/stil.c:250,256 – 1991/1101/sys/src/9/port/stil.c:278,283 | ||
| 1991/1026 | Ilcb *ic; Ilhdr *oh; | |
| 1991/1030 | ulong id, ack, oid, dlen; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); ack = nhgetl(h->ilack); | |
| 1991/10302/sys/src/9/port/stil.c:272,278 – 1991/1101/sys/src/9/port/stil.c:299,305 | ||
| 1991/1026 | case Ilsyncer: if(h->iltype == Ilsync && ic->start == ack) { | |
| 1991/1030 | ic->recvd = id+1; | |
| 1991/1101 | ilsendctl(s, 0, Ilack, 1); | |
| 1991/1026 | ic->state = Ilestablished; } break; | |
| 1991/10302/sys/src/9/port/stil.c:295,304 – 1991/1101/sys/src/9/port/stil.c:322,332 | ||
| 1991/1019 | freeb(bp); break; case Ildataquery: | |
| 1991/1030 |
| |
| 1991/1101 | ilsendctl(s, 0, Ilack, 1); /* NO break */ | |
| 1991/1019 | case Ildata: | |
| 1991/10302 |
| |
| 1991/1101 | ilackto(&s->ilctl, ack); switch(s->ilctl.state) { | |
| 1991/1025 | default: iloutoforder(s, h, bp); break; | |
| 1991/10302/sys/src/9/port/stil.c:305,321 – 1991/1101/sys/src/9/port/stil.c:333,348 | ||
| 1991/1025 | case Ilestablished: if(id < s->ilctl.recvd) freeb(bp); | |
| 1991/10302 |
| |
| 1991/1101 | else if(id > s->ilctl.recvd) | |
| 1991/1025 | iloutoforder(s, h, bp); | |
| 1991/1101 | else if(s->readq) { | |
| 1991/1026 | s->ilctl.recvd++; | |
| 1991/1030 |
| |
| 1991/1101 | bp->rptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1025 | PUTNEXT(s->readq, bp); } } | |
| 1991/1019 | break; | |
| 1991/1101 | case Ilclose: | |
| 1991/10302 | ic->state = Ilclosed; | |
| 1991/1025 | hungup: if(s->readq) { | |
| 1991/10302/sys/src/9/port/stil.c:327,339 – 1991/1101/sys/src/9/port/stil.c:354,365 | ||
| 1991/1019 | freeb(bp); } | |
| 1991/1026 |
| |
| 1991/1101 | /* Since recvd may have changed we can process out of order packets */ | |
| 1991/1030 | if(ic->state == Ilestablished && s->readq) { | |
| 1991/1026 | while(ic->outoforder) { bp = ic->outoforder; oh = (Ilhdr*)bp->rptr; oid = nhgetl(oh->ilid); | |
| 1991/1028 | if(oid > ic->recvd) break; | |
| 1991/1026 | if(oid < ic->recvd) { | |
| 1991/10302/sys/src/9/port/stil.c:341,347 – 1991/1101/sys/src/9/port/stil.c:367,372 | ||
| 1991/1026 | freeb(bp); } if(oid == ic->recvd) { | |
| 1991/10302 | ic->outoforder = bp->list; bp->list = 0; | |
| 1991/10302/sys/src/9/port/stil.c:351,361 – 1991/1101/sys/src/9/port/stil.c:376,381 | ||
| 1991/1026 | } } } | |
| 1991/1030 |
| |
| 1991/1025 | } | |
| 1991/1026 | ||
| 1991/10302/sys/src/9/port/stil.c:417,423 – 1991/1101/sys/src/9/port/stil.c:437,442 | ||
| 1991/1013 | hnputs(ih->ildst, ipc->pdst); hnputl(ih->ilid, ic->sent); hnputl(ih->ilack, ic->recvd); | |
| 1991/1026 |
| |
| 1991/1013 | } ih->iltype = type; ih->ilspec = 0; | |
| 1991/10302/sys/src/9/port/stil.c:427,433 – 1991/1101/sys/src/9/port/stil.c:446,452 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1024 |
| |
| 1991/1101 | if(ack == 0 && ipc) { | |
| 1991/1019 | ic->sent++; /* Maybe needs locking */ ilackq(&ipc->ilctl, bp); } | |
| 1991/10302/sys/src/9/port/stil.c:437,453 – 1991/1101/sys/src/9/port/stil.c:456,487 | ||
| 1991/1013 | void | |
| 1991/10302 | ilackproc(void *a) | |
| 1991/1012 | { | |
| 1991/10302 |
| |
| 1991/1101 | Block *bp, *np; | |
| 1991/10302 | base = (Ipconv*)a; end = &base[conf.ip]; for(;;) { | |
| 1991/1101 | tsleep(&ilackr, return0, 0, 100); | |
| 1991/10302 | for(s = base; s < end; s++) { | |
| 1991/1101 | /* Decide if we have to do the action !! */ switch(s->ilctl.state) { case Ilclosed: case Illistening: break; case Ilclosing: bp = s->ilctl.unacked; if(bp) { np = copyb(bp, blen(bp)); PUTNEXT(Ipoutput, np); } break; case Ilsyncer: case Ilsyncee: case Ilestablished: break; } | |
| 1991/10302 | } } | |
| 1991/1014 | } | |
| 1991/1101/sys/src/9/port/stil.c:68,73 – 1991/1102/sys/src/9/port/stil.c:68,74 (short | long) | ||
| 1991/1101 | qunlock(s); switch(ic->state) { | |
| 1991/1102 | case Ilclosing: | |
| 1991/1101 | case Ilclosed: break; case Ilsyncer: | |
| 1991/1101/sys/src/9/port/stil.c:84,92 – 1991/1102/sys/src/9/port/stil.c:85,90 | ||
| 1991/1101 | Illistening: ic->state = Ilclosed; break; | |
| 1991/1012 | } | |
| 1991/1101/sys/src/9/port/stil.c:265,273 – 1991/1102/sys/src/9/port/stil.c:263,273 | ||
| 1991/1019 | return; } } | |
| 1991/1102 | drop: freeb(bp); return; | |
| 1991/1023 | reset: | |
| 1991/1101 | ilsendctl(0, ih, Ilclose, 0); | |
| 1991/1022 |
| |
| 1991/1013 | freeb(bp); } | |
| 1991/1101/sys/src/9/port/stil.c:277,282 – 1991/1102/sys/src/9/port/stil.c:277,283 | ||
| 1991/1024 | Block *nb; | |
| 1991/1026 | Ilcb *ic; Ilhdr *oh; | |
| 1991/1102 | int sendack = 0; | |
| 1991/1030 | ulong id, ack, oid, dlen; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); | |
| 1991/1101/sys/src/9/port/stil.c:303,310 – 1991/1102/sys/src/9/port/stil.c:304,314 | ||
| 1991/1026 | ic->state = Ilestablished; } break; | |
| 1991/1019 |
| |
| 1991/1102 | ilsendctl(s, 0, Ilclose, 0); ic->state = Ilclosed; /* No break */ case Ilclosed: | |
| 1991/1025 | goto hungup; | |
| 1991/1019 | } | |
| 1991/1101/sys/src/9/port/stil.c:323,329 – 1991/1102/sys/src/9/port/stil.c:327,333 | ||
| 1991/1019 | break; case Ildataquery: | |
| 1991/1101 | ilsendctl(s, 0, Ilack, 1); | |
| 1991/1102 | /* No break */ | |
| 1991/1019 | case Ildata: | |
| 1991/1101 | ilackto(&s->ilctl, ack); switch(s->ilctl.state) { | |
| 1991/1101/sys/src/9/port/stil.c:343,349 – 1991/1102/sys/src/9/port/stil.c:347,353 | ||
| 1991/1025 | } | |
| 1991/1019 | break; | |
| 1991/1101 | case Ilclose: | |
| 1991/10302 |
| |
| 1991/1102 | ic->state = Ilclosing; | |
| 1991/1025 | hungup: if(s->readq) { nb = allocb(0); | |
| 1991/1101/sys/src/9/port/stil.c:469,482 – 1991/1102/sys/src/9/port/stil.c:473,479 | ||
| 1991/1101 | switch(s->ilctl.state) { case Ilclosed: case Illistening: | |
| 1991/1102/sys/src/9/port/stil.c:277,283 – 1991/1104/sys/src/9/port/stil.c:277,282 (short | long) | ||
| 1991/1024 | Block *nb; | |
| 1991/1026 | Ilcb *ic; Ilhdr *oh; | |
| 1991/1102 |
| |
| 1991/1030 | ulong id, ack, oid, dlen; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); | |
| 1991/1104/sys/src/9/port/stil.c:17,27 – 1991/1105/sys/src/9/port/stil.c:17,35 (short | long) | ||
| 1991/1101 | static Rendez ilackr; | |
| 1991/1023 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1019 | ||
| 1991/1105 | enum { Slowtime = 20, Fasttime = 1, }; | |
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1022 | void ilsendctl(Ipconv*, Ilhdr*, int, int); void ilackq(Ilcb*, Block*); void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1105 | void ilpullup(Ipconv*); void ilhangup(Ipconv*); | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) | |
| 1991/1104/sys/src/9/port/stil.c:181,187 – 1991/1105/sys/src/9/port/stil.c:189,195 | ||
| 1991/1025 | while(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; if(ackto < nhgetl(h->ilack)) | |
| 1991/1105 | break; | |
| 1991/1025 | bp = ic->unacked; | |
| 1991/10302 | ic->unacked = bp->list; bp->list = 0; | |
| 1991/1104/sys/src/9/port/stil.c:276,288 – 1991/1105/sys/src/9/port/stil.c:284,296 | ||
| 1991/1013 | { | |
| 1991/1024 | Block *nb; | |
| 1991/1026 | Ilcb *ic; | |
| 1991/1030 |
| |
| 1991/1105 | ulong id, ack, dlen; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); ack = nhgetl(h->ilack); ic = &s->ilctl; | |
| 1991/1105 | ic->timeout = 0; | |
| 1991/1025 | /* Active transition machine - this tracks connection state */ | |
| 1991/1026 | switch(ic->state) { | |
| 1991/1025 | case Ilsyncee: | |
| 1991/1104/sys/src/9/port/stil.c:301,306 – 1991/1105/sys/src/9/port/stil.c:309,315 | ||
| 1991/1030 | ic->recvd = id+1; | |
| 1991/1101 | ilsendctl(s, 0, Ilack, 1); | |
| 1991/1026 | ic->state = Ilestablished; | |
| 1991/1105 | ilpullup(s); | |
| 1991/1026 | } break; | |
| 1991/1019 | case Ilclosing: | |
| 1991/1104/sys/src/9/port/stil.c:308,319 – 1991/1105/sys/src/9/port/stil.c:317,336 | ||
| 1991/1102 | ic->state = Ilclosed; /* No break */ case Ilclosed: | |
| 1991/1025 |
| |
| 1991/1105 | ilhangup(s); freeb(bp); return; | |
| 1991/1019 | } | |
| 1991/1025 | /* Passive actions based on packet type */ | |
| 1991/1022 | switch(h->iltype) { | |
| 1991/1026 |
| |
| 1991/1105 | case Ilstate: if(ic->unacked) { nb = copyb(ic->unacked, blen(ic->unacked)); PUTNEXT(Ipoutput, nb); } else ilsendctl(s, 0, Ilack, 1); | |
| 1991/1026 | freeb(bp); break; | |
| 1991/1019 | case Ilack: | |
| 1991/1104/sys/src/9/port/stil.c:342,387 – 1991/1105/sys/src/9/port/stil.c:359,427 | ||
| 1991/1026 | s->ilctl.recvd++; | |
| 1991/1101 | bp->rptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1025 | PUTNEXT(s->readq, bp); | |
| 1991/1105 | ilpullup(s); | |
| 1991/1025 | } } | |
| 1991/1019 | break; | |
| 1991/1101 | case Ilclose: | |
| 1991/1102 | ic->state = Ilclosing; | |
| 1991/1025 |
| |
| 1991/1026 |
| |
| 1991/1025 |
| |
| 1991/1105 | ilhangup(s); /* No break */ default: | |
| 1991/1019 | freeb(bp); | |
| 1991/1105 | break; | |
| 1991/1019 | } | |
| 1991/1105 | } | |
| 1991/1026 | ||
| 1991/1101 |
| |
| 1991/1030 |
| |
| 1991/1026 |
| |
| 1991/1028 |
| |
| 1991/1026 |
| |
| 1991/10302 |
| |
| 1991/1026 |
| |
| 1991/10302 |
| |
| 1991/1030 |
| |
| 1991/1026 |
| |
| 1991/1105 | void ilhangup(Ipconv *s) { Block *nb; if(s->readq) { nb = allocb(0); nb->type = M_HANGUP; nb->flags |= S_DELIM; PUTNEXT(s->readq, nb); | |
| 1991/1026 | } | |
| 1991/1025 | } | |
| 1991/1105 | void ilpullup(Ipconv *s) { Ilcb *ic; Ilhdr *oh; ulong oid, dlen; Block *bp; | |
| 1991/1026 | ||
| 1991/1105 | if(s->readq == 0) return; ic = &s->ilctl; if(ic->state != Ilestablished) return; while(ic->outoforder) { bp = ic->outoforder; oh = (Ilhdr*)bp->rptr; oid = nhgetl(oh->ilid); if(oid > ic->recvd) break; if(oid < ic->recvd) { ic->outoforder = bp->list; freeb(bp); } if(oid == ic->recvd) { ic->recvd++; ic->outoforder = bp->list; bp->list = 0; dlen = nhgets(oh->illen)-IL_HDRSIZE; bp = btrim(bp, IL_EHSIZE+IL_HDRSIZE, dlen); PUTNEXT(s->readq, bp); } } } | |
| 1991/1025 | void iloutoforder(Ipconv *s, Ilhdr *h, Block *bp) { | |
| 1991/1104/sys/src/9/port/stil.c:391,412 – 1991/1105/sys/src/9/port/stil.c:431,452 | ||
| 1991/1025 | uchar *lid; ic = &s->ilctl; | |
| 1991/1105 | bp->list = 0; | |
| 1991/1025 | if(ic->outoforder == 0) { ic->outoforder = bp; | |
| 1991/10302 |
| |
| 1991/1105 | return; | |
| 1991/1025 | } | |
| 1991/1030 |
| |
| 1991/10302 |
| |
| 1991/1030 |
| |
| 1991/10302 |
| |
| 1991/1030 |
| |
| 1991/10302 |
| |
| 1991/1030 |
| |
| 1991/1105 | id = nhgetl(h->id); l = &ic->outoforder; for(f = *l; f; f = f->list) { lid = ((Ilhdr*)(bp->rptr))->ilid; if(id > nhgetl(lid)) break; l = &f->list; | |
| 1991/1025 | } | |
| 1991/1105 | bp->list = *l; *l = bp; | |
| 1991/1019 | } void | |
| 1991/1104/sys/src/9/port/stil.c:460,465 – 1991/1105/sys/src/9/port/stil.c:500,506 | ||
| 1991/10302 | ilackproc(void *a) | |
| 1991/1012 | { | |
| 1991/10302 | Ipconv *base, *end, *s; | |
| 1991/1105 | Ilcb *ic; | |
| 1991/1101 | Block *bp, *np; | |
| 1991/10302 | base = (Ipconv*)a; | |
| 1991/1104/sys/src/9/port/stil.c:468,481 – 1991/1105/sys/src/9/port/stil.c:509,538 | ||
| 1991/10302 | for(;;) { | |
| 1991/1101 | tsleep(&ilackr, return0, 0, 100); | |
| 1991/10302 | for(s = base; s < end; s++) { | |
| 1991/1101 |
| |
| 1991/1105 | ic = &s->ilctl; switch(ic->state) { | |
| 1991/1101 | case Ilclosed: case Illistening: | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilclosing: | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilsyncee: | |
| 1991/1105 | case Ilsyncer: ilsendctl(s, 0, Ilsync, 1); if(++ic->timeout == Slowtime) { ilhangup(s); ic->state = Ilclosed; s->dst = 0; s->pdst = 0; ic->timeout = 0; } break; | |
| 1991/1101 | case Ilestablished: | |
| 1991/1105 | if(++ic->timeout == Fasttime) { if(ic->lastack < ic->recvd) ilsendctl(s, 0, Ilstate, 1); ic->timeout = 0; } | |
| 1991/1101 | break; } | |
| 1991/10302 | } | |
| 1991/1104/sys/src/9/port/stil.c:490,495 – 1991/1105/sys/src/9/port/stil.c:547,553 | ||
| 1991/1014 | if(ic->state != Ilclosed) return; | |
| 1991/1105 | ic->timeout = 0; | |
| 1991/1014 | ic->unacked = 0; ic->outoforder = 0; initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1105/sys/src/9/port/stil.c:11,21 – 1991/1106/sys/src/9/port/stil.c:11,22 (short | long) | ||
| 1991/1012 | #include "arp.h" #include "ipdat.h" | |
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1106 | Rendez poor; /* DEBUG */ | |
| 1991/1023 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1106 | char *iltype[] = { "sync", "data", "dataquerey", "ack", "querey", "state", "close" }; | |
| 1991/1019 | ||
| 1991/1105 | enum { | |
| 1991/1105/sys/src/9/port/stil.c:25,31 – 1991/1106/sys/src/9/port/stil.c:26,32 | ||
| 1991/1105 | ||
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1022 |
| |
| 1991/1106 | void ilsendctl(Ipconv*, Ilhdr*, int); | |
| 1991/1022 | void ilackq(Ilcb*, Block*); void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1105 | void ilpullup(Ipconv*); | |
| 1991/1105/sys/src/9/port/stil.c:82,94 – 1991/1106/sys/src/9/port/stil.c:83,101 | ||
| 1991/1101 | case Ilsyncer: case Ilsyncee: case Ilestablished: | |
| 1991/1106 | for(bp = ic->unacked; bp; bp = next) { next = bp->list; freeb(bp); } | |
| 1991/1101 | for(bp = ic->outoforder; bp; bp = next) { next = bp->list; freeb(bp); } | |
| 1991/1106 | ic->unacked = 0; | |
| 1991/1101 | ic->outoforder = 0; ic->state = Ilclosing; | |
| 1991/1106 | ic->sent++; ilsendctl(s, 0, Ilclose); | |
| 1991/1101 | break; Illistening: ic->state = Ilclosed; | |
| 1991/1105/sys/src/9/port/stil.c:161,166 – 1991/1106/sys/src/9/port/stil.c:168,174 | ||
| 1991/1013 | hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1106 | delay(100); | |
| 1991/1019 | PUTNEXT(q, bp); } | |
| 1991/1105/sys/src/9/port/stil.c:171,177 – 1991/1106/sys/src/9/port/stil.c:179,184 | ||
| 1991/1019 | ||
| 1991/1013 | /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); | |
| 1991/1019 | ||
| 1991/1030 | if(ic->unacked) | |
| 1991/10302 | ic->unackedtail->list = np; | |
| 1991/1030 | else | |
| 1991/1105/sys/src/9/port/stil.c:185,195 – 1991/1106/sys/src/9/port/stil.c:192,205 | ||
| 1991/1019 | { Ilhdr *h; Block *bp; | |
| 1991/1106 | ulong ack; | |
| 1991/1019 | ||
| 1991/1025 | while(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; | |
| 1991/1106 | ack = nhgetl(h->ilack); if(ackto < ack) | |
| 1991/1105 | break; | |
| 1991/1106 | ic->lastack = ackto; | |
| 1991/1025 | bp = ic->unacked; | |
| 1991/10302 | ic->unacked = bp->list; bp->list = 0; | |
| 1991/1105/sys/src/9/port/stil.c:207,212 – 1991/1106/sys/src/9/port/stil.c:217,223 | ||
| 1991/1013 | ilrcvmsg(Ipconv *ipc, Block *bp) { Ilhdr *ih; | |
| 1991/1106 | Ilcb *ic; | |
| 1991/1030 | int plen, illen; | |
| 1991/1023 | Ipconv *s, *etab, *new; | |
| 1991/1022 | short sp, dp; | |
| 1991/1105/sys/src/9/port/stil.c:259,268 – 1991/1106/sys/src/9/port/stil.c:270,284 | ||
| 1991/1023 | new->ipinterface = s->ipinterface; new->psrc = sp; new->pdst = dp; | |
| 1991/1025 |
| |
| 1991/1026 |
| |
| 1991/1023 | new->dst = nhgetl(ih->src); | |
| 1991/1106 | ic = &new->ilctl; ic->state = Ilsyncee; initseq += TK2MS(MACHP(0)->ticks); ic->sent = initseq; ic->start = ic->sent; ic->recvd = 0; ic->rstart = nhgetl(ih->ilid); | |
| 1991/1023 | ilprocess(new, ih, bp); | |
| 1991/1025 | s->ipinterface->ref++; | |
| 1991/1105/sys/src/9/port/stil.c:272,289 – 1991/1106/sys/src/9/port/stil.c:288,307 | ||
| 1991/1019 | } } | |
| 1991/1102 | drop: | |
| 1991/1106 | print("drop\n"); | |
| 1991/1102 | freeb(bp); return; | |
| 1991/1023 | reset: | |
| 1991/1101 |
| |
| 1991/1106 | print("reset\n"); ilsendctl(0, ih, Ilclose); | |
| 1991/1013 | freeb(bp); } void | |
| 1991/1022 |
| |
| 1991/1106 | _ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1013 | { | |
| 1991/1024 |
| |
| 1991/1026 | Ilcb *ic; | |
| 1991/1106 | Block *nb, *next; | |
| 1991/1105 | ulong id, ack, dlen; | |
| 1991/1024 | ||
| 1991/1026 | id = nhgetl(h->ilid); | |
| 1991/1105/sys/src/9/port/stil.c:290,379 – 1991/1106/sys/src/9/port/stil.c:308,478 | ||
| 1991/1026 | ack = nhgetl(h->ilack); ic = &s->ilctl; | |
| 1991/1105 |
| |
| 1991/1025 |
| |
| 1991/1026 | switch(ic->state) { | |
| 1991/1025 |
| |
| 1991/1106 | default: panic("il unknown state"); case Ilclosed: freeb(bp); break; case Ilsyncer: | |
| 1991/1025 | switch(h->iltype) { | |
| 1991/1106 | default: break; | |
| 1991/1025 | case Ilsync: | |
| 1991/1026 |
| |
| 1991/1025 |
| |
| 1991/1106 | if(ack != ic->start) { ilhangup(s); ic->state = Ilclosed; } else { ic->recvd = id; ic->rstart = id; ilsendctl(s, 0, Ilack); ic->state = Ilestablished; ilpullup(s); } | |
| 1991/1025 | break; | |
| 1991/1106 | case Ilclose: if(ack == ic->start) { ic->state = Ilclosed; ilhangup(s); } break; } freeb(bp); break; case Ilsyncee: switch(h->iltype) { default: break; case Ilsync: if(id != ic->rstart || ack != 0) ic->state = Ilclosed; else { ic->recvd = id; ilsendctl(s, 0, Ilsync); } break; | |
| 1991/1025 | case Ilack: | |
| 1991/1026 |
| |
| 1991/1106 | if(ack == ic->start) { ic->state = Ilestablished; ilpullup(s); } | |
| 1991/1025 | break; | |
| 1991/1106 | case Ilclose: if(ack == ic->start) { ic->state = Ilclosed; ilhangup(s); } break; | |
| 1991/1025 | } | |
| 1991/1106 | freeb(bp); | |
| 1991/1025 | break; | |
| 1991/1026 |
| |
| 1991/1030 |
| |
| 1991/1101 |
| |
| 1991/1026 |
| |
| 1991/1106 | case Ilestablished: switch(h->iltype) { case Ilsync: if(id != ic->start) { ic->state = Ilclosed; ilhangup(s); } else ilsendctl(s, 0, Ilack); freeb(bp); break; case Ildata: case Ildataquery: if(id < ic->recvd) { freeb(bp); break; } if(ack >= ic->recvd) ilackto(ic, ack); iloutoforder(s, h, bp); | |
| 1991/1105 | ilpullup(s); | |
| 1991/1106 | if(h->iltype == Ildataquery) ilsendctl(s, 0, Ilstate); break; case Ilack: ilackto(ic, ack); freeb(bp); break; case Ilquerey: ilackto(ic, ack); ilsendctl(s, 0, Ilstate); freeb(bp); break; case Ilstate: ilackto(ic, ack); if(ic->unacked) { nb = copyb(ic->unacked, blen(ic->unacked)); h = (Ilhdr*)nb; h->iltype = Ildataquery; hnputl(h->ilack, ic->recvd); PUTNEXT(Ipoutput, nb); } freeb(bp); break; case Ilclose: freeb(bp); if(ic->start >= ack || ack < ic->sent) break; ic->sent++; ic->recvd = ack; ilsendctl(s, 0, Ilclose); ic->state = Ilclosing; for(nb = ic->unacked; nb; nb = next) { next = nb->list; freeb(nb); } for(nb = ic->outoforder; nb; nb = next) { next = nb->list; freeb(nb); } ic->unacked = 0; ic->outoforder = 0; break; | |
| 1991/1026 | } break; | |
| 1991/1019 |
| |
| 1991/1102 |
| |
| 1991/1105 |
| |
| 1991/1106 | case Illistening: | |
| 1991/1105 | freeb(bp); | |
| 1991/1019 |
| |
| 1991/1025 |
| |
| 1991/1022 |
| |
| 1991/1105 |
| |
| 1991/1026 |
| |
| 1991/1019 |
| |
| 1991/10302 |
| |
| 1991/1019 |
| |
| 1991/1101 |
| |
| 1991/1102 |
| |
| 1991/1019 |
| |
| 1991/1101 |
| |
| 1991/1106 | case Ilclosing: switch(h->iltype) { case Ilclose: if(ack == ic->sent) { ic->state = Ilclosed; ilhangup(s); } ic->recvd = id; ilsendctl(s, 0, Ilclose); break; | |
| 1991/1025 | default: | |
| 1991/1106 | ic->state = Ilclosed; ilsendctl(s, 0, Ilclose); ilhangup(s); | |
| 1991/1025 | break; | |
| 1991/1101 |
| |
| 1991/1025 |
| |
| 1991/1101 |
| |
| 1991/1026 |
| |
| 1991/1101 |
| |
| 1991/1025 |
| |
| 1991/1105 |
| |
| 1991/1025 |
| |
| 1991/1019 |
| |
| 1991/1101 |
| |
| 1991/1102 |
| |
| 1991/1105 |
| |
| 1991/1019 | freeb(bp); | |
| 1991/1105 | break; | |
| 1991/1019 | } | |
| 1991/1105 | } | |
| 1991/1026 | ||
| 1991/1106 | /* DEBUG */ | |
| 1991/1105 | void | |
| 1991/1106 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) { Ilcb *ic = &s->ilctl; print("%s start %d rstart %d recvd %d sent %d\n", ilstate[ic->state], ic->start, ic->rstart, ic->recvd, ic->sent); print("pkt(%s id %d ack %d)\n", iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack)); _ilprocess(s, h, bp); print("%s start %d rstart %d recvd %d sent %d\n", ilstate[ic->state], ic->start, ic->rstart, ic->recvd, ic->sent); } void | |
| 1991/1105 | ilhangup(Ipconv *s) { Block *nb; | |
| 1991/1105/sys/src/9/port/stil.c:450,460 – 1991/1106/sys/src/9/port/stil.c:549,560 | ||
| 1991/1019 | } void | |
| 1991/1106 | ilsendctl(Ipconv *ipc, Ilhdr *inih, int type) | |
| 1991/1019 | { | |
| 1991/1013 | Ilhdr *ih; Ilcb *ic; Block *bp; | |
| 1991/1106 | ulong id; | |
| 1991/1013 | bp = allocb(IL_EHSIZE+IL_HDRSIZE); | |
| 1991/1019 | bp->wptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1105/sys/src/9/port/stil.c:478,484 – 1991/1106/sys/src/9/port/stil.c:578,587 | ||
| 1991/1024 | hnputl(ih->dst, ipc->dst); | |
| 1991/1013 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); | |
| 1991/1106 | id = ic->sent; if(type == Ilsync) id = ic->start; hnputl(ih->ilid, id); | |
| 1991/1013 | hnputl(ih->ilack, ic->recvd); } ih->iltype = type; | |
| 1991/1105/sys/src/9/port/stil.c:489,498 – 1991/1106/sys/src/9/port/stil.c:592,597 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1101 |
| |
| 1991/1019 |
| |
| 1991/1013 | } | |
| 1991/1105/sys/src/9/port/stil.c:507,513 – 1991/1106/sys/src/9/port/stil.c:606,612 | ||
| 1991/10302 | end = &base[conf.ip]; for(;;) { | |
| 1991/1101 |
| |
| 1991/1106 | tsleep(&ilackr, return0, 0, 250); | |
| 1991/10302 | for(s = base; s < end; s++) { | |
| 1991/1105 | ic = &s->ilctl; switch(ic->state) { | |
| 1991/1105/sys/src/9/port/stil.c:517,538 – 1991/1106/sys/src/9/port/stil.c:616,625 | ||
| 1991/1101 | case Ilclosing: | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilsyncee: | |
| 1991/1106 | break; | |
| 1991/1105 | case Ilsyncer: | |
| 1991/1101 | case Ilestablished: | |
| 1991/1105 |
| |
| 1991/1101 | break; } | |
| 1991/10302 | } | |
| 1991/1105/sys/src/9/port/stil.c:563,569 – 1991/1106/sys/src/9/port/stil.c:650,656 | ||
| 1991/1014 | break; case IL_ACTIVE: ic->state = Ilsyncer; | |
| 1991/1022 |
| |
| 1991/1106 | ilsendctl(ipc, 0, Ilsync); | |
| 1991/1014 | break; } | |
| 1991/1012 | } | |
| 1991/1106/sys/src/9/port/stil.c:31,36 – 1991/1107/sys/src/9/port/stil.c:31,37 (short | long) | ||
| 1991/1022 | void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1105 | void ilpullup(Ipconv*); void ilhangup(Ipconv*); | |
| 1991/1107 | void ilfreeq(Ilcb*); | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) | |
| 1991/1106/sys/src/9/port/stil.c:83,100 – 1991/1107/sys/src/9/port/stil.c:84,91 | ||
| 1991/1101 | case Ilsyncer: case Ilsyncee: case Ilestablished: | |
| 1991/1106 |
| |
| 1991/1101 |
| |
| 1991/1106 |
| |
| 1991/1101 |
| |
| 1991/1107 | ilfreeq(ic); | |
| 1991/1101 | ic->state = Ilclosing; | |
| 1991/1106 |
| |
| 1991/1101 | break; Illistening: | |
| 1991/1106/sys/src/9/port/stil.c:156,162 – 1991/1107/sys/src/9/port/stil.c:147,153 | ||
| 1991/1019 | hnputs(ih->illen, dlen+IL_HDRSIZE); | |
| 1991/1012 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); | |
| 1991/1013 |
| |
| 1991/1107 | hnputl(ih->ilid, ic->next++); | |
| 1991/1013 | hnputl(ih->ilack, ic->recvd); | |
| 1991/1101 | ih->iltype = Ildata; ih->ilspec = 0; | |
| 1991/1106/sys/src/9/port/stil.c:275,282 – 1991/1107/sys/src/9/port/stil.c:266,273 | ||
| 1991/1106 | ic = &new->ilctl; ic->state = Ilsyncee; initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1107 | ic->next = initseq; ic->start = ic->next; | |
| 1991/1106 | ic->recvd = 0; ic->rstart = nhgetl(ih->ilid); | |
| 1991/1023 | ilprocess(new, ih, bp); | |
| 1991/1106/sys/src/9/port/stil.c:413,434 – 1991/1107/sys/src/9/port/stil.c:404,414 | ||
| 1991/1106 | break; case Ilclose: freeb(bp); | |
| 1991/1107 | if(id != ic->recvd) | |
| 1991/1106 | break; | |
| 1991/1107 | ilfreeq(ic); | |
| 1991/1106 | break; | |
| 1991/1026 | } break; | |
| 1991/1106/sys/src/9/port/stil.c:438,452 – 1991/1107/sys/src/9/port/stil.c:418,433 | ||
| 1991/1106 | case Ilclosing: switch(h->iltype) { case Ilclose: | |
| 1991/1107 | if(ack == ic->next) { | |
| 1991/1106 | ic->state = Ilclosed; ilhangup(s); } | |
| 1991/1107 | else { ic->recvd = id; ilsendctl(s, 0, Ilclose); } | |
| 1991/1106 | break; | |
| 1991/1025 | default: | |
| 1991/1106 |
| |
| 1991/1025 | break; | |
| 1991/1106/sys/src/9/port/stil.c:462,475 – 1991/1107/sys/src/9/port/stil.c:443,456 | ||
| 1991/1106 | { Ilcb *ic = &s->ilctl; | |
| 1991/1107 | print("%s rcv %d/%d snt %d/%d pkt(%s id %d ack %d %d->%d) ", ilstate[ic->state], ic->rstart, ic->recvd, ic->start, ic->next, iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack), nhgets(h->ilsrc), nhgets(h->ildst)); | |
| 1991/1106 | _ilprocess(s, h, bp); | |
| 1991/1107 | print("%s rcv %d snt %d\n", ilstate[ic->state], ic->recvd, ic->next); | |
| 1991/1106 | } void | |
| 1991/1106/sys/src/9/port/stil.c:578,584 – 1991/1107/sys/src/9/port/stil.c:559,565 | ||
| 1991/1024 | hnputl(ih->dst, ipc->dst); | |
| 1991/1013 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); | |
| 1991/1106 |
| |
| 1991/1107 | id = ic->next; | |
| 1991/1106 | if(type == Ilsync) id = ic->start; hnputl(ih->ilid, id); | |
| 1991/1106/sys/src/9/port/stil.c:592,597 – 1991/1107/sys/src/9/port/stil.c:573,582 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1107 | print("ctl(%s id %d ack %d %d->%d) ", iltype[ih->iltype], nhgetl(ih->ilid), nhgetl(ih->ilack), nhgets(ih->ilsrc), nhgets(ih->ildst)); | |
| 1991/1019 | PUTNEXT(Ipoutput, bp); | |
| 1991/1013 | } | |
| 1991/1106/sys/src/9/port/stil.c:638,647 – 1991/1107/sys/src/9/port/stil.c:623,632 | ||
| 1991/1014 | ic->unacked = 0; ic->outoforder = 0; initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1026 |
| |
| 1991/1107 | ic->next = initseq; ic->start = ic->next; | |
| 1991/1026 | ic->recvd = 0; | |
| 1991/1014 |
| |
| 1991/1107 | ic->lastack = ic->next; | |
| 1991/1014 | ic->window = window; switch(type) { | |
| 1991/1106/sys/src/9/port/stil.c:653,656 – 1991/1107/sys/src/9/port/stil.c:638,658 | ||
| 1991/1106 | ilsendctl(ipc, 0, Ilsync); | |
| 1991/1014 | break; } | |
| 1991/1107 | } void ilfreeq(Ilcb *ic) { Block *bp, *next; for(bp = ic->unacked; bp; bp = next) { next = bp->list; freeb(bp); } for(bp = ic->outoforder; bp; bp = next) { next = bp->list; freeb(bp); } ic->unacked = 0; ic->outoforder = 0; | |
| 1991/1012 | } | |
| 1991/1107/sys/src/9/port/stil.c:11,16 – 1991/1108/sys/src/9/port/stil.c:11,17 (short | long) | ||
| 1991/1012 | #include "arp.h" #include "ipdat.h" | |
| 1991/1108 | #define DBG if(0)print | |
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1107/sys/src/9/port/stil.c:107,113 – 1991/1108/sys/src/9/port/stil.c:108,115 | ||
| 1991/1012 | if(ipc->psrc == 0) error(Enoport); | |
| 1991/1019 |
| |
| 1991/1108 | ic = &ipc->ilctl; switch(ic->state) { | |
| 1991/1019 | case Ilclosed: case Illistening: case Ilclosing: | |
| 1991/1107/sys/src/9/port/stil.c:135,143 – 1991/1108/sys/src/9/port/stil.c:137,143 | ||
| 1991/1012 | /* Make space to fit il & ip & ethernet header */ bp = padb(bp, IL_EHSIZE+IL_HDRSIZE); | |
| 1991/1013 |
| |
| 1991/1012 | ||
| 1991/1019 | /* Ip fields */ hnputl(ih->src, Myip); | |
| 1991/1107/sys/src/9/port/stil.c:213,218 – 1991/1108/sys/src/9/port/stil.c:213,219 | ||
| 1991/1023 | Ipconv *s, *etab, *new; | |
| 1991/1022 | short sp, dp; | |
| 1991/1024 | Ipaddr dst; | |
| 1991/1108 | char *st; | |
| 1991/1013 | ||
| 1991/1024 | ih = (Ilhdr *)bp->rptr; | |
| 1991/1013 | ||
| 1991/1107/sys/src/9/port/stil.c:224,238 – 1991/1108/sys/src/9/port/stil.c:225,241 | ||
| 1991/1030 | if(illen+IL_EHSIZE > plen) goto drop; | |
| 1991/1013 |
| |
| 1991/1022 | sp = nhgets(ih->ildst); dp = nhgets(ih->ilsrc); | |
| 1991/1024 | dst = nhgetl(ih->src); | |
| 1991/1108 | if(ilcksum && ptcl_csum(bp, IL_EHSIZE, illen) != 0) { st = (ih->iltype < 0 || ih->iltype > Ilclose) ? "?" : iltype[ih->iltype]; print("il: cksum error, pkt(%s id %d ack %d %d.%d.%d.%d/%d->%d)\n", st, nhgetl(ih->ilid), nhgetl(ih->ilack), fmtaddr(dst), sp, dp); goto drop; } | |
| 1991/1019 | etab = &ipc[conf.ip]; | |
| 1991/1101 | for(s = ipc; s < etab; s++) if(s->psrc == sp) | |
| 1991/1107/sys/src/9/port/stil.c:398,403 – 1991/1108/sys/src/9/port/stil.c:401,410 | ||
| 1991/1106 | h = (Ilhdr*)nb; h->iltype = Ildataquery; hnputl(h->ilack, ic->recvd); | |
| 1991/1108 | h->ilsum[0] = 0; h->ilsum[1] = 0; if(ilcksum) hnputs(h->ilsum, ptcl_csum(nb, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1106 | PUTNEXT(Ipoutput, nb); } freeb(bp); | |
| 1991/1107/sys/src/9/port/stil.c:404,410 – 1991/1108/sys/src/9/port/stil.c:411,417 | ||
| 1991/1106 | break; case Ilclose: freeb(bp); | |
| 1991/1107 |
| |
| 1991/1108 | if(id != ic->recvd) | |
| 1991/1106 | break; ilsendctl(s, 0, Ilclose); ic->state = Ilclosing; | |
| 1991/1107/sys/src/9/port/stil.c:418,435 – 1991/1108/sys/src/9/port/stil.c:425,438 | ||
| 1991/1106 | case Ilclosing: switch(h->iltype) { case Ilclose: | |
| 1991/1108 | ic->recvd = id; | |
| 1991/1107 | if(ack == ic->next) { | |
| 1991/1106 | ic->state = Ilclosed; ilhangup(s); } | |
| 1991/1107 |
| |
| 1991/1108 | ilsendctl(s, 0, Ilclose); | |
| 1991/1106 | break; | |
| 1991/1025 | default: | |
| 1991/1106 |
| |
| 1991/1025 | break; } | |
| 1991/1019 | freeb(bp); | |
| 1991/1107/sys/src/9/port/stil.c:443,449 – 1991/1108/sys/src/9/port/stil.c:446,453 | ||
| 1991/1106 | { Ilcb *ic = &s->ilctl; | |
| 1991/1107 |
| |
| 1991/1108 | USED(ic); DBG("%s rcv %d/%d snt %d/%d pkt(%s id %d ack %d %d->%d) ", | |
| 1991/1107 | ilstate[ic->state], ic->rstart, ic->recvd, ic->start, ic->next, iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack), nhgets(h->ilsrc), nhgets(h->ildst)); | |
| 1991/1107/sys/src/9/port/stil.c:450,456 – 1991/1108/sys/src/9/port/stil.c:454,460 | ||
| 1991/1106 | _ilprocess(s, h, bp); | |
| 1991/1107 |
| |
| 1991/1108 | DBG("%s rcv %d snt %d\n", ilstate[ic->state], ic->recvd, ic->next); | |
| 1991/1106 | } void | |
| 1991/1107/sys/src/9/port/stil.c:573,579 – 1991/1108/sys/src/9/port/stil.c:577,583 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1107 |
| |
| 1991/1108 | DBG("\nctl(%s id %d ack %d %d->%d)\n", | |
| 1991/1107 | iltype[ih->iltype], nhgetl(ih->ilid), nhgetl(ih->ilack), nhgets(ih->ilsrc), nhgets(ih->ildst)); | |
| 1991/1108/sys/src/9/port/stil.c:1,4 – 1991/1115/sys/src/9/port/stil.c:1,4 (short | long) | ||
| 1991/1012 |
| |
| 1991/1115 | /* | |
| 1991/1012 | * stil - Internet link protocol */ #include "u.h" | |
| 1991/1108/sys/src/9/port/stil.c:93,98 – 1991/1115/sys/src/9/port/stil.c:93,99 | ||
| 1991/1101 | ic->state = Ilclosed; break; } | |
| 1991/1115 | netdisown(&s->ipinterface->net, s->index); | |
| 1991/1012 | } void | |
| 1991/1108/sys/src/9/port/stil.c:256,262 – 1991/1115/sys/src/9/port/stil.c:257,263 | ||
| 1991/1101 | if(s->ilctl.state == Illistening) if(s->pdst == 0) if(s->dst == 0) { | |
| 1991/1023 |
| |
| 1991/1115 | new = ipincoming(ipc, s); | |
| 1991/1025 | if(new == 0) | |
| 1991/1023 | goto reset; | |
| 1991/1115/sys/src/9/port/stil.c:1,4 – 1991/1119/sys/src/9/port/stil.c:1,4 (short | long) | ||
| 1991/1115 |
| |
| 1991/1119 | /* | |
| 1991/1012 | * stil - Internet link protocol */ #include "u.h" | |
| 1991/1115/sys/src/9/port/stil.c:15,21 – 1991/1119/sys/src/9/port/stil.c:15,21 | ||
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1106 |
| |
| 1991/1119 | ||
| 1991/1023 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1106 | char *iltype[] = { "sync", "data", "dataquerey", "ack", "querey", "state", "close" }; | |
| 1991/1019 | ||
| 1991/1119/sys/src/9/port/stil.c:11,17 – 1991/1120/sys/src/9/port/stil.c:11,17 (short | long) | ||
| 1991/1012 | #include "arp.h" #include "ipdat.h" | |
| 1991/1108 |
| |
| 1991/1120 | #define DBG if(1)print | |
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1119/sys/src/9/port/stil.c:55,63 – 1991/1120/sys/src/9/port/stil.c:55,60 | ||
| 1991/1012 | ipc->ipinterface = newipifc(IP_ILPROTO, ilrcvmsg, ipconv[s->dev], 1500, 512, ETHER_HDR, "IL"); | |
| 1991/1119/sys/src/9/port/stil.c:74,80 – 1991/1120/sys/src/9/port/stil.c:71,76 | ||
| 1991/1030 | s = (Ipconv *)(q->ptr); | |
| 1991/1101 | ic = &s->ilctl; | |
| 1991/1030 | qlock(s); | |
| 1991/1101 | qunlock(s); | |
| 1991/1119/sys/src/9/port/stil.c:161,166 – 1991/1120/sys/src/9/port/stil.c:157,163 | ||
| 1991/1013 | ||
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1106 | delay(100); | |
| 1991/1120 | print("TX len = %d BLEN = %d IL %d\n", blen(bp), BLEN(bp), dlen+IL_HDRSIZE); | |
| 1991/1019 | PUTNEXT(q, bp); } | |
| 1991/1119/sys/src/9/port/stil.c:231,236 – 1991/1120/sys/src/9/port/stil.c:228,234 | ||
| 1991/1024 | dst = nhgetl(ih->src); | |
| 1991/1108 | if(ilcksum && ptcl_csum(bp, IL_EHSIZE, illen) != 0) { | |
| 1991/1120 | print("len = %d BLEN = %d IL %d\n", blen(bp), BLEN(bp), illen); | |
| 1991/1108 | st = (ih->iltype < 0 || ih->iltype > Ilclose) ? "?" : iltype[ih->iltype]; print("il: cksum error, pkt(%s id %d ack %d %d.%d.%d.%d/%d->%d)\n", st, nhgetl(ih->ilid), nhgetl(ih->ilack), fmtaddr(dst), sp, dp); | |
| 1991/1119/sys/src/9/port/stil.c:269,276 – 1991/1120/sys/src/9/port/stil.c:267,276 | ||
| 1991/1106 | ic = &new->ilctl; ic->state = Ilsyncee; | |
| 1991/1120 | /* | |
| 1991/1106 | initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1107 |
| |
| 1991/1120 | */ initseq =1; ic->next = initseq; | |
| 1991/1107 | ic->start = ic->next; | |
| 1991/1106 | ic->recvd = 0; ic->rstart = nhgetl(ih->ilid); | |
| 1991/1119/sys/src/9/port/stil.c:627,633 – 1991/1120/sys/src/9/port/stil.c:627,636 | ||
| 1991/1105 | ic->timeout = 0; | |
| 1991/1014 | ic->unacked = 0; ic->outoforder = 0; | |
| 1991/1120 | /* | |
| 1991/1014 | initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1120 | */ initseq = 1; | |
| 1991/1107 | ic->next = initseq; ic->start = ic->next; | |
| 1991/1026 | ic->recvd = 0; | |
| 1991/1120/sys/src/9/port/stil.c:154,163 – 1991/1121/sys/src/9/port/stil.c:154,161 (short | long) | ||
| 1991/1013 | /* Checksum of ilheader plus data (not ip & no pseudo header) */ if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1106 | delay(100); | |
| 1991/1120 |
| |
| 1991/1019 | PUTNEXT(q, bp); } | |
| 1991/1120/sys/src/9/port/stil.c:214,220 – 1991/1121/sys/src/9/port/stil.c:212,217 | ||
| 1991/1108 | char *st; | |
| 1991/1013 | ||
| 1991/1024 | ih = (Ilhdr *)bp->rptr; | |
| 1991/1013 |
| |
| 1991/1120/sys/src/9/port/stil.c:228,234 – 1991/1121/sys/src/9/port/stil.c:225,230 | ||
| 1991/1024 | dst = nhgetl(ih->src); | |
| 1991/1108 | if(ilcksum && ptcl_csum(bp, IL_EHSIZE, illen) != 0) { | |
| 1991/1120 |
| |
| 1991/1108 | st = (ih->iltype < 0 || ih->iltype > Ilclose) ? "?" : iltype[ih->iltype]; print("il: cksum error, pkt(%s id %d ack %d %d.%d.%d.%d/%d->%d)\n", st, nhgetl(ih->ilid), nhgetl(ih->ilack), fmtaddr(dst), sp, dp); | |
| 1991/1120/sys/src/9/port/stil.c:237,245 – 1991/1121/sys/src/9/port/stil.c:233,239 | ||
| 1991/1108 | ||
| 1991/1019 | etab = &ipc[conf.ip]; | |
| 1991/1101 | for(s = ipc; s < etab; s++) | |
| 1991/1121 | if(s->psrc == sp && s->pdst == dp && s->dst == dst) { | |
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1120/sys/src/9/port/stil.c:315,322 – 1991/1121/sys/src/9/port/stil.c:309,316 | ||
| 1991/1106 | break; | |
| 1991/1025 | case Ilsync: | |
| 1991/1106 | if(ack != ic->start) { | |
| 1991/1121 | ilhangup(s); | |
| 1991/1106 | } else { ic->recvd = id; | |
| 1991/1120/sys/src/9/port/stil.c:405,411 – 1991/1121/sys/src/9/port/stil.c:399,405 | ||
| 1991/1108 | h->ilsum[0] = 0; h->ilsum[1] = 0; if(ilcksum) | |
| 1991/1121 | hnputs(h->ilsum, ptcl_csum(nb, IL_EHSIZE, nhgets(h->illen))); | |
| 1991/1106 | PUTNEXT(Ipoutput, nb); } freeb(bp); | |
| 1991/1120/sys/src/9/port/stil.c:448,454 – 1991/1121/sys/src/9/port/stil.c:442,448 | ||
| 1991/1106 | Ilcb *ic = &s->ilctl; | |
| 1991/1108 | USED(ic); | |
| 1991/1121 | DBG("%11s rcv %d/%d snt %d/%d pkt(%s id %d ack %d %d->%d) ", | |
| 1991/1107 | ilstate[ic->state], ic->rstart, ic->recvd, ic->start, ic->next, iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack), nhgets(h->ilsrc), nhgets(h->ildst)); | |
| 1991/1120/sys/src/9/port/stil.c:455,461 – 1991/1121/sys/src/9/port/stil.c:449,455 | ||
| 1991/1106 | _ilprocess(s, h, bp); | |
| 1991/1108 |
| |
| 1991/1121 | DBG("%11s rcv %d snt %d\n", ilstate[ic->state], ic->recvd, ic->next); | |
| 1991/1106 | } void | |
| 1991/1120/sys/src/9/port/stil.c:578,587 – 1991/1121/sys/src/9/port/stil.c:572,581 | ||
| 1991/1013 | if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, IL_HDRSIZE)); | |
| 1991/1108 |
| |
| 1991/1121 | /* DBG("\nctl(%s id %d ack %d %d->%d)\n", | |
| 1991/1107 | iltype[ih->iltype], nhgetl(ih->ilid), nhgetl(ih->ilack), nhgets(ih->ilsrc), nhgets(ih->ildst)); | |
| 1991/1121 | */ | |
| 1991/1019 | PUTNEXT(Ipoutput, bp); | |
| 1991/1013 | } | |
| 1991/1121/sys/src/9/port/stil.c:11,17 – 1991/1122/sys/src/9/port/stil.c:11,17 (short | long) | ||
| 1991/1012 | #include "arp.h" #include "ipdat.h" | |
| 1991/1120 |
| |
| 1991/1122 | #define DBG if(0)print | |
| 1991/1101 | int ilcksum = 1; static int initseq = 25000; static Rendez ilackr; | |
| 1991/1121/sys/src/9/port/stil.c:21,28 – 1991/1122/sys/src/9/port/stil.c:21,29 | ||
| 1991/1019 | ||
| 1991/1105 | enum { | |
| 1991/1122 | Mstime = 200, Slowtime = Mstime*20, Fasttime = Mstime, | |
| 1991/1105 | }; | |
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); | |
| 1991/1121/sys/src/9/port/stil.c:31,39 – 1991/1122/sys/src/9/port/stil.c:32,44 | ||
| 1991/1022 | void ilackq(Ilcb*, Block*); void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1105 | void ilpullup(Ipconv*); | |
| 1991/1122 | void ilhangup(Ipconv*, char*); | |
| 1991/1107 | void ilfreeq(Ilcb*); | |
| 1991/1012 | ||
| 1991/1122 | char Crefused[] = "connection refused"; char Ctimedout[] = "connection timed out"; char Creset[] = "connection reset by peer"; | |
| 1991/1012 | void ilopen(Queue *q, Stream *s) { | |
| 1991/1121/sys/src/9/port/stil.c:85,92 – 1991/1122/sys/src/9/port/stil.c:90,98 | ||
| 1991/1101 | ic->state = Ilclosing; | |
| 1991/1106 | ilsendctl(s, 0, Ilclose); | |
| 1991/1101 | break; | |
| 1991/1122 | case Illistening: | |
| 1991/1101 | ic->state = Ilclosed; | |
| 1991/1122 | s->psrc = 0; | |
| 1991/1101 | break; } | |
| 1991/1115 | netdisown(&s->ipinterface->net, s->index); | |
| 1991/1121/sys/src/9/port/stil.c:154,161 – 1991/1122/sys/src/9/port/stil.c:160,167 | ||
| 1991/1013 | /* Checksum of ilheader plus data (not ip & no pseudo header) */ if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1122 | ||
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1106 |
| |
| 1991/1019 | PUTNEXT(q, bp); } | |
| 1991/1121/sys/src/9/port/stil.c:233,239 – 1991/1122/sys/src/9/port/stil.c:239,248 | ||
| 1991/1108 | ||
| 1991/1019 | etab = &ipc[conf.ip]; | |
| 1991/1101 | for(s = ipc; s < etab; s++) | |
| 1991/1121 |
| |
| 1991/1122 | if(s->ilctl.state != Ilclosed) if(s->psrc == sp) if(s->pdst == dp) if(s->dst == dst) { | |
| 1991/1019 | ilprocess(s, ih, bp); return; } | |
| 1991/1121/sys/src/9/port/stil.c:241,257 – 1991/1122/sys/src/9/port/stil.c:250,267 | ||
| 1991/1030 | if(ih->iltype != Ilsync) goto drop; | |
| 1991/1025 |
| |
| 1991/1024 |
| |
| 1991/1030 | /* Look for a listener */ | |
| 1991/1019 | for(s = ipc; s < etab; s++) { | |
| 1991/1101 | if(s->ilctl.state == Illistening) if(s->pdst == 0) if(s->dst == 0) { | |
| 1991/1122 | if(s->curlog > s->backlog) goto reset; | |
| 1991/1115 | new = ipincoming(ipc, s); | |
| 1991/1025 |
| |
| 1991/1122 | if(new == 0) { print("incoming\n"); | |
| 1991/1023 | goto reset; | |
| 1991/1122 | } | |
| 1991/1023 | new->newcon = 1; new->ipinterface = s->ipinterface; | |
| 1991/1121/sys/src/9/port/stil.c:297,302 – 1991/1122/sys/src/9/port/stil.c:307,313 | ||
| 1991/1026 | ack = nhgetl(h->ilack); ic = &s->ilctl; | |
| 1991/1122 | ic->timeout = 0; | |
| 1991/1026 | switch(ic->state) { | |
| 1991/1106 | default: panic("il unknown state"); | |
| 1991/1121/sys/src/9/port/stil.c:310,316 – 1991/1122/sys/src/9/port/stil.c:321,327 | ||
| 1991/1025 | case Ilsync: | |
| 1991/1106 | if(ack != ic->start) { ic->state = Ilclosed; | |
| 1991/1121 |
| |
| 1991/1122 | ilhangup(s, Crefused); | |
| 1991/1106 | } else { ic->recvd = id; | |
| 1991/1121/sys/src/9/port/stil.c:323,329 – 1991/1122/sys/src/9/port/stil.c:334,340 | ||
| 1991/1106 | case Ilclose: if(ack == ic->start) { ic->state = Ilclosed; | |
| 1991/1122 | ilhangup(s, Crefused); | |
| 1991/1106 | } break; } | |
| 1991/1121/sys/src/9/port/stil.c:350,356 – 1991/1122/sys/src/9/port/stil.c:361,367 | ||
| 1991/1106 | case Ilclose: if(ack == ic->start) { ic->state = Ilclosed; | |
| 1991/1122 | ilhangup(s, Crefused); | |
| 1991/1106 | } break; | |
| 1991/1025 | } | |
| 1991/1121/sys/src/9/port/stil.c:361,367 – 1991/1122/sys/src/9/port/stil.c:372,378 | ||
| 1991/1106 | case Ilsync: if(id != ic->start) { ic->state = Ilclosed; | |
| 1991/1122 | ilhangup(s, Creset); | |
| 1991/1106 | } else ilsendctl(s, 0, Ilack); | |
| 1991/1121/sys/src/9/port/stil.c:423,429 – 1991/1122/sys/src/9/port/stil.c:434,440 | ||
| 1991/1108 | ic->recvd = id; | |
| 1991/1107 | if(ack == ic->next) { | |
| 1991/1106 | ic->state = Ilclosed; | |
| 1991/1122 | ilhangup(s, 0); | |
| 1991/1106 | } | |
| 1991/1108 | ilsendctl(s, 0, Ilclose); | |
| 1991/1106 | break; | |
| 1991/1121/sys/src/9/port/stil.c:442,448 – 1991/1122/sys/src/9/port/stil.c:453,459 | ||
| 1991/1106 | Ilcb *ic = &s->ilctl; | |
| 1991/1108 | USED(ic); | |
| 1991/1121 |
| |
| 1991/1122 | DBG("%-11s rcv %d/%d snt %d/%d pkt(%-6s id %d ack %d %d->%d) ", | |
| 1991/1107 | ilstate[ic->state], ic->rstart, ic->recvd, ic->start, ic->next, iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack), nhgets(h->ilsrc), nhgets(h->ildst)); | |
| 1991/1121/sys/src/9/port/stil.c:449,464 – 1991/1122/sys/src/9/port/stil.c:460,483 | ||
| 1991/1106 | _ilprocess(s, h, bp); | |
| 1991/1121 |
| |
| 1991/1122 | DBG("%-11s rcv %d snt %d\n", ilstate[ic->state], ic->recvd, ic->next); | |
| 1991/1106 | } void | |
| 1991/1105 |
| |
| 1991/1122 | ilhangup(Ipconv *s, char *msg) | |
| 1991/1105 | { Block *nb; | |
| 1991/1122 | ulong l; | |
| 1991/1105 | if(s->readq) { | |
| 1991/1122 | if(msg) { l = strlen(msg); nb = allocb(l); strcpy((char*)nb->wptr, msg); nb->wptr += l; } else nb = allocb(0); | |
| 1991/1105 | nb->type = M_HANGUP; nb->flags |= S_DELIM; PUTNEXT(s->readq, nb); | |
| 1991/1121/sys/src/9/port/stil.c:588,609 – 1991/1122/sys/src/9/port/stil.c:607,657 | ||
| 1991/10302 | base = (Ipconv*)a; end = &base[conf.ip]; | |
| 1991/1106 |
| |
| 1991/1122 | tsleep(&ilackr, return0, 0, Mstime); | |
| 1991/10302 | for(s = base; s < end; s++) { | |
| 1991/1105 | ic = &s->ilctl; switch(ic->state) { | |
| 1991/1101 |
| |
| 1991/1122 | default: | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilclosing: | |
| 1991/1122 | ic->timeout++; if(ic->timeout >= Slowtime) { ic->state = Ilclosed; ilhangup(s, 0); } | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilsyncee: | |
| 1991/1122 | ic->timeout++; if(ic->timeout >= Slowtime) { ic->state = Ilclosed; ilhangup(s, Ctimedout); break; } print("Rxmit %d/%d %s", s->psrc, s->pdst, ilstate[ic->state]); ilsendctl(s, 0, Ilsync); | |
| 1991/1106 | break; | |
| 1991/1105 | case Ilsyncer: | |
| 1991/1122 | ic->timeout++; if(ic->timeout >= Slowtime) { ic->state = Ilclosed; ilhangup(s, Ctimedout); break; } print("Rxmit %d/%d %s", s->psrc, s->pdst, ilstate[ic->state]); ilsendctl(s, 0, Ilsync); | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilestablished: | |
| 1991/1122 | ic->timeout++; if(ic->unacked == 0) break; if(ic->timeout >= Slowtime) { ic->state = Ilclosed; ilhangup(s, Ctimedout); break; } print("Rxmit %d/%d %s", s->psrc, s->pdst, ilstate[ic->state]); ilsendctl(s, 0, Ilstate); | |
| 1991/1101 | break; } | |
| 1991/10302 | } | |
| 1991/1122/sys/src/9/port/stil.c:18,44 – 1991/1124/sys/src/9/port/stil.c:18,49 (short | long) | ||
| 1991/1119 | ||
| 1991/1023 | char *ilstate[] = { "Closed", "Syncer", "Syncee", "Established", "Listening", "Closing" }; | |
| 1991/1106 | char *iltype[] = { "sync", "data", "dataquerey", "ack", "querey", "state", "close" }; | |
| 1991/1124 | static char *etime = "connection timed out"; | |
| 1991/1019 | ||
| 1991/1124 | /* Always Acktime < Fasttime < Slowtime << Ackkeepalive */ | |
| 1991/1105 | enum { | |
| 1991/1122 |
| |
| 1991/1124 | Iltickms = 100, Slowtime = 20*Iltickms, Fasttime = 5*Iltickms, Acktime = 3*Iltickms, Ackkeepalive = 1000*Iltickms, Defaultwin = 20, | |
| 1991/1105 | }; | |
| 1991/1124 | #define Backoff(s) (s)*=2 #define Starttimer(s) {(s)->timeout = 0; (s)->fasttime = Fasttime;} | |
| 1991/1013 | void ilrcvmsg(Ipconv*, Block*); void ilackproc(void*); | |
| 1991/1106 |
| |
| 1991/1124 | void ilsendctl(Ipconv*, Ilhdr*, int, ulong, ulong); | |
| 1991/1022 | void ilackq(Ilcb*, Block*); void ilprocess(Ipconv*, Ilhdr*, Block*); | |
| 1991/1105 | void ilpullup(Ipconv*); | |
| 1991/1122 |
| |
| 1991/1124 | void ilhangup(Ipconv*, char *); | |
| 1991/1107 | void ilfreeq(Ilcb*); | |
| 1991/1124 | void ilrexmit(Ilcb*); | |
| 1991/1012 | ||
| 1991/1122 |
| |
| 1991/1012 | void ilopen(Queue *q, Stream *s) { | |
| 1991/1122/sys/src/9/port/stil.c:88,98 – 1991/1124/sys/src/9/port/stil.c:93,105 | ||
| 1991/1101 | case Ilestablished: | |
| 1991/1107 | ilfreeq(ic); | |
| 1991/1101 | ic->state = Ilclosing; | |
| 1991/1106 |
| |
| 1991/1124 | ilsendctl(s, 0, Ilclose, ic->next, ic->recvd); | |
| 1991/1101 | break; | |
| 1991/1122 | case Illistening: | |
| 1991/1101 | ic->state = Ilclosed; | |
| 1991/1122 | s->psrc = 0; | |
| 1991/1124 | s->pdst = 0; s->dst = 0; | |
| 1991/1101 | break; } | |
| 1991/1115 | netdisown(&s->ipinterface->net, s->index); | |
| 1991/1122/sys/src/9/port/stil.c:160,167 – 1991/1124/sys/src/9/port/stil.c:167,175 | ||
| 1991/1013 | /* Checksum of ilheader plus data (not ip & no pseudo header) */ if(ilcksum) hnputs(ih->ilsum, ptcl_csum(bp, IL_EHSIZE, dlen+IL_HDRSIZE)); | |
| 1991/1122 | ||
| 1991/1019 | ilackq(ic, bp); | |
| 1991/1124 | ic->acktime = Ackkeepalive; | |
| 1991/1019 | PUTNEXT(q, bp); } | |
| 1991/1122/sys/src/9/port/stil.c:172,182 – 1991/1124/sys/src/9/port/stil.c:180,192 | ||
| 1991/1019 | ||
| 1991/1013 | /* Enqueue a copy on the unacked queue in case this one gets lost */ np = copyb(bp, blen(bp)); | |
| 1991/1124 | qlock(&ic->ackq); | |
| 1991/1030 | if(ic->unacked) | |
| 1991/10302 | ic->unackedtail->list = np; | |
| 1991/1030 | else | |
| 1991/1013 | ic->unacked = np; | |
| 1991/1030 | ic->unackedtail = np; | |
| 1991/1124 | qunlock(&ic->ackq); | |
| 1991/10302 | np->list = 0; | |
| 1991/1019 | } | |
| 1991/1013 | ||
| 1991/1122/sys/src/9/port/stil.c:185,203 – 1991/1124/sys/src/9/port/stil.c:195,215 | ||
| 1991/1019 | { Ilhdr *h; Block *bp; | |
| 1991/1106 |
| |
| 1991/1124 | ulong id; | |
| 1991/1019 | ||
| 1991/1124 | qlock(&ic->ackq); | |
| 1991/1025 | while(ic->unacked) { h = (Ilhdr *)ic->unacked->rptr; | |
| 1991/1106 |
| |
| 1991/1124 | id = nhgetl(h->ilid); if(ackto < id) | |
| 1991/1105 | break; | |
| 1991/1106 |
| |
| 1991/1124 | ||
| 1991/1025 | bp = ic->unacked; | |
| 1991/10302 | ic->unacked = bp->list; bp->list = 0; | |
| 1991/1025 | freeb(bp); | |
| 1991/1019 | } | |
| 1991/1124 | qunlock(&ic->ackq); | |
| 1991/1012 | } void | |
| 1991/1122/sys/src/9/port/stil.c:239,245 – 1991/1124/sys/src/9/port/stil.c:251,256 | ||
| 1991/1108 | ||
| 1991/1019 | etab = &ipc[conf.ip]; | |
| 1991/1101 | for(s = ipc; s < etab; s++) | |
| 1991/1122 |
| |
| 1991/1122/sys/src/9/port/stil.c:257,267 – 1991/1124/sys/src/9/port/stil.c:268,277 | ||
| 1991/1101 | if(s->dst == 0) { | |
| 1991/1122 | if(s->curlog > s->backlog) goto reset; | |
| 1991/1124 | ||
| 1991/1115 | new = ipincoming(ipc, s); | |
| 1991/1122 |
| |
| 1991/1124 | if(new == 0) | |
| 1991/1023 | goto reset; | |
| 1991/1122 |
| |
| 1991/1023 | new->newcon = 1; new->ipinterface = s->ipinterface; | |
| 1991/1122/sys/src/9/port/stil.c:271,283 – 1991/1124/sys/src/9/port/stil.c:281,293 | ||
| 1991/1106 | ic = &new->ilctl; ic->state = Ilsyncee; | |
| 1991/1120 |
| |
| 1991/1106 | initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1120 |
| |
| 1991/1107 |
| |
| 1991/1124 | ic->start = initseq; ic->next = ic->start+1; | |
| 1991/1106 | ic->recvd = 0; ic->rstart = nhgetl(ih->ilid); | |
| 1991/1124 | ic->slowtime = Slowtime; ic->window = Defaultwin; | |
| 1991/1023 | ilprocess(new, ih, bp); | |
| 1991/1025 | s->ipinterface->ref++; | |
| 1991/1122/sys/src/9/port/stil.c:287,298 – 1991/1124/sys/src/9/port/stil.c:297,306 | ||
| 1991/1019 | } } | |
| 1991/1102 | drop: | |
| 1991/1106 |
| |
| 1991/1102 | freeb(bp); return; | |
| 1991/1023 | reset: | |
| 1991/1106 |
| |
| 1991/1124 | ilsendctl(0, ih, Ilclose, 0, 0); | |
| 1991/1013 | freeb(bp); } | |
| 1991/1122/sys/src/9/port/stil.c:307,313 – 1991/1124/sys/src/9/port/stil.c:315,320 | ||
| 1991/1026 | ack = nhgetl(h->ilack); ic = &s->ilctl; | |
| 1991/1122 |
| |
| 1991/1026 | switch(ic->state) { | |
| 1991/1106 | default: panic("il unknown state"); | |
| 1991/1122/sys/src/9/port/stil.c:321,340 – 1991/1124/sys/src/9/port/stil.c:328,348 | ||
| 1991/1025 | case Ilsync: | |
| 1991/1106 | if(ack != ic->start) { ic->state = Ilclosed; | |
| 1991/1122 |
| |
| 1991/1124 | ilhangup(s, "connection rejected"); | |
| 1991/1106 | } else { ic->recvd = id; ic->rstart = id; | |
| 1991/1124 | ilsendctl(s, 0, Ilack, ic->next, ic->recvd); | |
| 1991/1106 | ic->state = Ilestablished; ilpullup(s); | |
| 1991/1124 | Starttimer(ic); | |
| 1991/1106 | } | |
| 1991/1025 | break; | |
| 1991/1106 | case Ilclose: if(ack == ic->start) { ic->state = Ilclosed; | |
| 1991/1122 |
| |
| 1991/1124 | ilhangup(s, "remote close"); | |
| 1991/1106 | } break; } | |
| 1991/1122/sys/src/9/port/stil.c:349,355 – 1991/1124/sys/src/9/port/stil.c:357,364 | ||
| 1991/1106 | ic->state = Ilclosed; else { ic->recvd = id; | |
| 1991/1124 | ilsendctl(s, 0, Ilsync, ic->start, ic->recvd); Starttimer(ic); | |
| 1991/1106 | } break; | |
| 1991/1025 | case Ilack: | |
| 1991/1122/sys/src/9/port/stil.c:356,367 – 1991/1124/sys/src/9/port/stil.c:365,377 | ||
| 1991/1106 | if(ack == ic->start) { ic->state = Ilestablished; ilpullup(s); | |
| 1991/1124 | Starttimer(ic); | |
| 1991/1106 | } | |
| 1991/1025 | break; | |
| 1991/1106 | case Ilclose: | |
| 1991/1124 | if(id == ic->next) { | |
| 1991/1106 | ic->state = Ilclosed; | |
| 1991/1122 |
| |
| 1991/1124 | ilhangup(s, "remote close"); | |
| 1991/1106 | } break; | |
| 1991/1025 | } | |
| 1991/1122/sys/src/9/port/stil.c:372,427 – 1991/1124/sys/src/9/port/stil.c:382,435 | ||
| 1991/1106 | case Ilsync: if(id != ic->start) { ic->state = Ilclosed; | |
| 1991/1122 |
| |
| 1991/1124 | ilhangup(s, "remote close"); | |
| 1991/1106 | } | |
| 1991/1124 | else { ilsendctl(s, 0, Ilack, ic->next, ic->rstart); Starttimer(ic); } | |
| 1991/1106 | freeb(bp); break; case Ildata: | |
| 1991/1124 | Starttimer(ic); ilackto(ic, ack); ic->acktime = Acktime; iloutoforder(s, h, bp); ilpullup(s); break; | |
| 1991/1106 | case Ildataquery: | |
| 1991/1124 | Starttimer(ic); ilackto(ic, ack); ic->acktime = Acktime; | |
| 1991/1106 | iloutoforder(s, h, bp); | |
| 1991/1105 | ilpullup(s); | |
| 1991/1106 |
| |
| 1991/1124 | ilsendctl(s, 0, Ilstate, ic->next, ic->recvd); | |
| 1991/1106 | break; case Ilack: ilackto(ic, ack); | |
| 1991/1124 | Starttimer(ic); | |
| 1991/1106 | freeb(bp); break; case Ilquerey: ilackto(ic, ack); | |
| 1991/1124 | ilsendctl(s, 0, Ilstate, ic->next, ic->recvd); Starttimer(ic); | |
| 1991/1106 | freeb(bp); break; case Ilstate: ilackto(ic, ack); | |
| 1991/1108 |
| |
| 1991/1121 |
| |
| 1991/1106 |
| |
| 1991/1124 | ilrexmit(ic); Starttimer(ic); | |
| 1991/1106 | freeb(bp); break; case Ilclose: freeb(bp); | |
| 1991/1108 |
| |
| 1991/1124 | if(ack < ic->start || ack > ic->next) | |
| 1991/1106 | break; | |
| 1991/1124 | ilsendctl(s, 0, Ilclose, ic->next, ic->recvd); | |
| 1991/1106 | ic->state = Ilclosing; | |
| 1991/1107 | ilfreeq(ic); | |
| 1991/1124 | Starttimer(ic); | |
| 1991/1106 | break; | |
| 1991/1026 | } break; | |
| 1991/1122/sys/src/9/port/stil.c:432,442 – 1991/1124/sys/src/9/port/stil.c:440,451 | ||
| 1991/1106 | switch(h->iltype) { case Ilclose: | |
| 1991/1108 | ic->recvd = id; | |
| 1991/1124 | ilsendctl(s, 0, Ilclose, ic->next, ic->recvd); | |
| 1991/1107 | if(ack == ic->next) { | |
| 1991/1106 | ic->state = Ilclosed; | |
| 1991/1122 | ilhangup(s, 0); | |
| 1991/1106 | } | |
| 1991/1108 |
| |
| 1991/1124 | Starttimer(ic); | |
| 1991/1106 | break; | |
| 1991/1025 | default: break; | |
| 1991/1122/sys/src/9/port/stil.c:446,451 – 1991/1124/sys/src/9/port/stil.c:455,483 | ||
| 1991/1019 | } | |
| 1991/1105 | } | |
| 1991/1026 | ||
| 1991/1124 | void ilrexmit(Ilcb *ic) { Block *nb; Ilhdr *h; if(ic->unacked == 0) return; nb = copyb(ic->unacked, blen(ic->unacked)); h = (Ilhdr*)nb->rptr; DBG("rxmit %d.", nhgetl(h->ilid)); h->iltype = Ildataquery; hnputl(h->ilack, ic->recvd); h->ilsum[0] = 0; h->ilsum[1] = 0; if(ilcksum) hnputs(h->ilsum, ptcl_csum(nb, IL_EHSIZE, nhgets(h->illen))); PUTNEXT(Ipoutput, nb); } | |
| 1991/1106 | /* DEBUG */ | |
| 1991/1105 | void | |
| 1991/1106 | ilprocess(Ipconv *s, Ilhdr *h, Block *bp) | |
| 1991/1122/sys/src/9/port/stil.c:453,459 – 1991/1124/sys/src/9/port/stil.c:485,491 | ||
| 1991/1106 | Ilcb *ic = &s->ilctl; | |
| 1991/1108 | USED(ic); | |
| 1991/1122 |
| |
| 1991/1124 | DBG("%11s rcv %d/%d snt %d/%d pkt(%s id %d ack %d %d->%d) ", | |
| 1991/1107 | ilstate[ic->state], ic->rstart, ic->recvd, ic->start, ic->next, iltype[h->iltype], nhgetl(h->ilid), nhgetl(h->ilack), nhgets(h->ilsrc), nhgets(h->ildst)); | |
| 1991/1122/sys/src/9/port/stil.c:460,466 – 1991/1124/sys/src/9/port/stil.c:492,498 | ||
| 1991/1106 | _ilprocess(s, h, bp); | |
| 1991/1122 |
| |
| 1991/1124 | DBG("%11s rcv %d snt %d\n", ilstate[ic->state], ic->recvd, ic->next); | |
| 1991/1106 | } void | |
| 1991/1122/sys/src/9/port/stil.c:467,474 – 1991/1124/sys/src/9/port/stil.c:499,507 | ||
| 1991/1122 | ilhangup(Ipconv *s, char *msg) | |
| 1991/1105 | { Block *nb; | |
| 1991/1122 |
| |
| 1991/1124 | int l; | |
| 1991/1105 | ||
| 1991/1124 | DBG("hangup! %s %d/%d\n", msg ? msg : "??", s->psrc, s->pdst); | |
| 1991/1105 | if(s->readq) { | |
| 1991/1122 | if(msg) { l = strlen(msg); | |
| 1991/1122/sys/src/9/port/stil.c:482,487 – 1991/1124/sys/src/9/port/stil.c:515,523 | ||
| 1991/1105 | nb->flags |= S_DELIM; PUTNEXT(s->readq, nb); | |
| 1991/1026 | } | |
| 1991/1124 | s->psrc = 0; s->pdst = 0; s->dst = 0; | |
| 1991/1025 | } | |
| 1991/1105 | void | |
| 1991/1122/sys/src/9/port/stil.c:499,523 – 1991/1124/sys/src/9/port/stil.c:535,565 | ||
| 1991/1105 | if(ic->state != Ilestablished) return; | |
| 1991/1124 | qlock(&ic->outo); | |
| 1991/1105 | while(ic->outoforder) { bp = ic->outoforder; oh = (Ilhdr*)bp->rptr; oid = nhgetl(oh->ilid); | |
| 1991/1124 | if(oid <= ic->recvd) { | |
| 1991/1105 | ic->outoforder = bp->list; freeb(bp); | |
| 1991/1124 | continue; | |
| 1991/1105 | } | |
| 1991/1124 | if(oid != ic->recvd+1) break; ic->recvd = oid; ic->outoforder = bp->list; ic->oblks--; qunlock(&ic->outo); bp->list = 0; dlen = nhgets(oh->illen)-IL_HDRSIZE; bp = btrim(bp, IL_EHSIZE+IL_HDRSIZE, dlen); PUTNEXT(s->readq, bp); qlock(&ic->outo); | |
| 1991/1105 | } | |
| 1991/1124 | qunlock(&ic->outo); | |
| 1991/1105 | } | |
| 1991/1025 | void | |
| 1991/1122/sys/src/9/port/stil.c:530,559 – 1991/1124/sys/src/9/port/stil.c:572,614 | ||
| 1991/1025 | ic = &s->ilctl; | |
| 1991/1105 | bp->list = 0; | |
| 1991/1025 |
| |
| 1991/1124 | id = nhgetl(h->ilid); /* Window checks */ if(id <= ic->recvd || ic->oblks > ic->window) { freeb(bp); | |
| 1991/1105 | return; | |
| 1991/1025 | } | |
| 1991/1105 |
| |
| 1991/1124 | /* Packet is acceptable so sort onto receive queue for pullup */ qlock(&ic->outo); ic->oblks++; if(ic->outoforder == 0) ic->outoforder = bp; else { l = &ic->outoforder; for(f = *l; f; f = f->list) { lid = ((Ilhdr*)(f->rptr))->ilid; if(id < nhgetl(lid)) { bp->list = f; *l = bp; qunlock(&ic->outo); return; } l = &f->list; } *l = bp; | |
| 1991/1025 | } | |
| 1991/1105 |
| |
| 1991/1124 | qunlock(&ic->outo); | |
| 1991/1019 | } void | |
| 1991/1106 |
| |
| 1991/1124 | ilsendctl(Ipconv *ipc, Ilhdr *inih, int type, ulong id, ulong ack) | |
| 1991/1019 | { | |
| 1991/1013 | Ilhdr *ih; Ilcb *ic; Block *bp; | |
| 1991/1106 |
| |
| 1991/1013 | bp = allocb(IL_EHSIZE+IL_HDRSIZE); | |
| 1991/1019 | bp->wptr += IL_EHSIZE+IL_HDRSIZE; | |
| 1991/1122/sys/src/9/port/stil.c:577,587 – 1991/1124/sys/src/9/port/stil.c:632,640 | ||
| 1991/1024 | hnputl(ih->dst, ipc->dst); | |
| 1991/1013 | hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); | |
| 1991/1107 |
| |
| 1991/1106 |
| |
| 1991/1013 |
| |
| 1991/1124 | hnputl(ih->ilack, ack); ic->acktime = Ackkeepalive; | |
| 1991/1013 | } ih->iltype = type; ih->ilspec = 0; | |
| 1991/1122/sys/src/9/port/stil.c:607,657 – 1991/1124/sys/src/9/port/stil.c:660,713 | ||
| 1991/10302 | base = (Ipconv*)a; end = &base[conf.ip]; | |
| 1991/1124 | ||
| 1991/10302 | for(;;) { | |
| 1991/1122 |
| |
| 1991/1124 | tsleep(&ilackr, return0, 0, Iltickms); | |
| 1991/10302 | for(s = base; s < end; s++) { | |
| 1991/1105 | ic = &s->ilctl; | |
| 1991/1124 | ic->timeout += Iltickms; | |
| 1991/1105 | switch(ic->state) { | |
| 1991/1122 |
| |
| 1991/1124 | case Ilclosed: case Illistening: | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilclosing: | |
| 1991/1122 |
| |
| 1991/1124 | if(ic->timeout >= ic->fasttime) { ilsendctl(s, 0, Ilclose, ic->next, ic->recvd); Backoff(ic->fasttime); } if(ic->timeout >= ic->slowtime) { | |
| 1991/1122 | ic->state = Ilclosed; ilhangup(s, 0); } | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilsyncee: | |
| 1991/1122 |
| |
| 1991/1106 |
| |
| 1991/1105 | case Ilsyncer: | |
| 1991/1122 |
| |
| 1991/1124 | if(ic->timeout >= ic->fasttime) { ilsendctl(s, 0, Ilsync, ic->start, ic->recvd); Backoff(ic->fasttime); } if(ic->timeout >= ic->slowtime) { | |
| 1991/1122 | ic->state = Ilclosed; | |
| 1991/1124 | ilhangup(s, etime); | |
| 1991/1122 | } | |
| 1991/1105 | break; | |
| 1991/1101 | case Ilestablished: | |
| 1991/1122 |
| |
| 1991/1124 | ic->acktime -= Iltickms; if(ic->acktime <= 0) ilsendctl(s, 0, Ilack, ic->next, ic->recvd); if(ic->unacked == 0) { ic->timeout = 0; | |
| 1991/1122 | break; | |
| 1991/1124 | } if(ic->timeout >= ic->fasttime) { ilrexmit(ic); Backoff(ic->fasttime); } if(ic->timeout >= ic->slowtime) { | |
| 1991/1122 | ic->state = Ilclosed; | |
| 1991/1124 | ilhangup(s, etime); | |
| 1991/1122 | break; } | |
| 1991/1101 | break; } | |
| 1991/10302 | } | |
| 1991/1122/sys/src/9/port/stil.c:669,682 – 1991/1124/sys/src/9/port/stil.c:725,737 | ||
| 1991/1105 | ic->timeout = 0; | |
| 1991/1014 | ic->unacked = 0; ic->outoforder = 0; | |
| 1991/1120 |
| |
| 1991/1124 | ic->slowtime = Slowtime; | |
| 1991/1014 | initseq += TK2MS(MACHP(0)->ticks); | |
| 1991/1120 |
| |
| 1991/1107 |
| |
| 1991/1124 | ic->start = initseq; ic->next = ic->start+1; | |
| 1991/1026 | ic->recvd = 0; | |
| 1991/1107 |
| |
| 1991/1014 | ic->window = window; switch(type) { | |
| 1991/1122/sys/src/9/port/stil.c:685,691 – 1991/1124/sys/src/9/port/stil.c:740,746 | ||
| 1991/1014 | break; case IL_ACTIVE: ic->state = Ilsyncer; | |
| 1991/1106 |
| |
| 1991/1124 | ilsendctl(ipc, 0, Ilsync, ic->start, ic->recvd); | |
| 1991/1014 | break; } | |
| 1991/1107 | } | |
| 1991/1122/sys/src/9/port/stil.c:695,708 – 1991/1124/sys/src/9/port/stil.c:750,768 | ||
| 1991/1107 | { Block *bp, *next; | |
| 1991/1124 | qlock(&ic->ackq); | |
| 1991/1107 | for(bp = ic->unacked; bp; bp = next) { next = bp->list; freeb(bp); } | |
| 1991/1124 | ic->unacked = 0; qunlock(&ic->ackq); qlock(&ic->outo); | |
| 1991/1107 | for(bp = ic->outoforder; bp; bp = next) { next = bp->list; freeb(bp); } | |
| 1991/1124 | qunlock(&ic->outo); | |
| 1991/1012 | } | |
| Too many diffs (26 > 25). Stopping. | ||