From 39d1bb46c68ac628ff2e59d7dd94db058be134e8 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 7 Dec 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-12-07 --- ip/icmp.c | 10 +++++----- ip/ip.c | 6 +++++- ip/ip.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ip/icmp.c b/ip/icmp.c index 026ca674303d819c1131acb26a290f8a3e57e4ed..302669c7661babba8aa5066b8642d10c5d021bdb 100644 --- a/ip/icmp.c +++ b/ip/icmp.c @@ -216,7 +216,7 @@ icmpttlexceeded(Fs *f, uchar *ia, Block *bp) } static void -icmpunreachable(Fs *f, Block *bp, int code) +icmpunreachable(Fs *f, Block *bp, int code, int seq) { Block *nbp; Icmp *p, *np; @@ -247,7 +247,7 @@ icmpunreachable(Fs *f, Block *bp, int code) np->code = code; np->proto = IP_ICMPPROTO; hnputs(np->icmpid, 0); - hnputs(np->seq, 0); + hnputs(np->seq, seq); memset(np->cksum, 0, sizeof(np->cksum)); hnputs(np->cksum, ptclcsum(nbp, ICMP_IPSIZE, blocklen(nbp) - ICMP_IPSIZE)); ipoput4(f, nbp, 0, MAXTTL, DFLTTOS); @@ -256,13 +256,13 @@ icmpunreachable(Fs *f, Block *bp, int code) extern void icmpnoconv(Fs *f, Block *bp) { - icmpunreachable(f, bp, 3); + icmpunreachable(f, bp, 3, 0); } extern void -icmpcantfrag(Fs *f, Block *bp) +icmpcantfrag(Fs *f, Block *bp, int mtu) { - icmpunreachable(f, bp, 4); + icmpunreachable(f, bp, 4, mtu); } static void diff --git a/ip/ip.c b/ip/ip.c index 5c486619af40c783e5c2e5881ae4484fa526b45b..c260b0fe8ab51491fad3b1c18f7ff320d84a3043 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -317,7 +317,7 @@ if((eh->frag[0] & (IP_DF>>8)) && !gating) print("%V: DF set\n", eh->dst); if(eh->frag[0] & (IP_DF>>8)){ ip->stats[FragFails]++; ip->stats[OutDiscards]++; - icmpcantfrag(f, bp); + icmpcantfrag(f, bp, medialen); netlog(f, Logip, "%V: eh->frag[0] & (IP_DF>>8)\n", eh->dst); goto raise; } @@ -528,6 +528,10 @@ ipiput4(Fs *f, Ipifc *ifc, Block *bp) h = (Ip4hdr*)(bp->rp); } + /* don't let any frag info go up the stack */ + h->frag[0] = 0; + h->frag[1] = 0; + proto = h->proto; p = Fsrcvpcol(f, proto); if(p != nil && p->rcv != nil) { diff --git a/ip/ip.h b/ip/ip.h index f20092a8c4eecb2cddfa769ef4f7ea7574dc6758..8863df5e9b4963d1e59b1299748a39b302004a07 100644 --- a/ip/ip.h +++ b/ip/ip.h @@ -614,7 +614,7 @@ extern long ipgateread6(Fs *f, char *cp, ulong offset, int n); extern void iprouting(Fs*, int); extern void closeifcconv(Ifcconv*); extern void icmpnoconv(Fs*, Block*); -extern void icmpcantfrag(Fs*, Block*); +extern void icmpcantfrag(Fs*, Block*, int); extern void icmpttlexceeded(Fs*, uchar*, Block*); extern ushort ipcsum(uchar*); extern void ipiput4(Fs*, Ipifc*, Block*);