From 8935ef0e31f6be7048f243204107829686656184 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 4 Dec 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-12-04 --- ip/icmp.c | 18 +++++++++++++++--- ip/ip.c | 3 +++ ip/ip.h | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ip/icmp.c b/ip/icmp.c index 52e2a65446c092cd5682e557c8b8abf7d4cec93a..026ca674303d819c1131acb26a290f8a3e57e4ed 100644 --- a/ip/icmp.c +++ b/ip/icmp.c @@ -215,8 +215,8 @@ icmpttlexceeded(Fs *f, uchar *ia, Block *bp) } -extern void -icmpnoconv(Fs *f, Block *bp) +static void +icmpunreachable(Fs *f, Block *bp, int code) { Block *nbp; Icmp *p, *np; @@ -244,7 +244,7 @@ icmpnoconv(Fs *f, Block *bp) memmove(np->src, p->dst, sizeof(np->src)); memmove(np->data, bp->rp, ICMP_IPSIZE + 8); np->type = Unreachable; - np->code = 3; + np->code = code; np->proto = IP_ICMPPROTO; hnputs(np->icmpid, 0); hnputs(np->seq, 0); @@ -253,6 +253,18 @@ icmpnoconv(Fs *f, Block *bp) ipoput4(f, nbp, 0, MAXTTL, DFLTTOS); } +extern void +icmpnoconv(Fs *f, Block *bp) +{ + icmpunreachable(f, bp, 3); +} + +extern void +icmpcantfrag(Fs *f, Block *bp) +{ + icmpunreachable(f, bp, 4); +} + static void goticmpkt(Proto *icmp, Block *bp) { diff --git a/ip/ip.c b/ip/ip.c index 18b68fe763d520d2b7bd42fa2338743c716ae865..5c486619af40c783e5c2e5881ae4484fa526b45b 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -312,9 +312,12 @@ ipoput4(Fs *f, Block *bp, int gating, int ttl, int tos) return; } +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); netlog(f, Logip, "%V: eh->frag[0] & (IP_DF>>8)\n", eh->dst); goto raise; } diff --git a/ip/ip.h b/ip/ip.h index bf0f78afe09a81b14269627e766a609dd0182237..f20092a8c4eecb2cddfa769ef4f7ea7574dc6758 100644 --- a/ip/ip.h +++ b/ip/ip.h @@ -614,6 +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 icmpttlexceeded(Fs*, uchar*, Block*); extern ushort ipcsum(uchar*); extern void ipiput4(Fs*, Ipifc*, Block*);