sync icmp from nix -> 9 kernels. Reference: /n/atom/patch/applied/sync9icmp Date: Sun Jun 7 20:49:19 CES 2015 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/ip/icmp.c Sun Jun 7 20:49:10 2015 +++ /sys/src/9/ip/icmp.c Sun Jun 7 20:49:11 2015 @@ -130,11 +130,10 @@ icmpstate(Conv *c, char *state, int n) { USED(c); - return snprint(state, n, "%s qin %d qout %d ttl %d\n", + return snprint(state, n, "%s qin %d qout %d\n", "Datagram", c->rq ? qlen(c->rq) : 0, - c->wq ? qlen(c->wq) : 0, - c->ttl + c->wq ? qlen(c->wq) : 0 ); } @@ -319,6 +318,16 @@ [3] "port unreachable", [4] "fragmentation needed and DF set", [5] "source route failed", +[6] "destination network unknown", +[7] "destination host unknown", +[8] "source host isolated", +[9] "network administratively prohibited", +[10] "host administratively prohibited", +[11] "network unreachable for tos", +[12] "host unreachable for tos", +[13] "communication administratively prohibited", +[14] "host precedence violation", +[15] "precedence cutoff in effect", }; static void @@ -372,8 +381,11 @@ ipoput4(icmp->f, r, 0, MAXTTL, DFLTTOS, nil); break; case Unreachable: - if(p->code > 5) - msg = unreachcode[1]; + if(p->code >= nelem(unreachcode)){ + snprint(m2, sizeof m2, "unreachable %V->%V code %d", + p->src, p->dst, p->code); + msg = m2; + } else msg = unreachcode[p->code]; @@ -394,7 +406,7 @@ break; case TimeExceed: if(p->code == 0){ - sprint(m2, "ttl exceeded at %V", p->src); + snprint(m2, sizeof m2, "ttl exceeded at %V", p->src); bp->rp += ICMP_IPSIZE+ICMP_HDRSIZE; if(blocklen(bp) < MinAdvise){