diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-03-07 22:39:50 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-03-07 22:39:50 +0100 |
commit | 4b8f7a2110d80fdad0f09f376dbfd2204e2e8f8e (patch) | |
tree | de1716025d3e3a5a61967dfe196f8d7299094a06 /sys/src/9/ip/ip.c | |
parent | 4885c75526f91ff9eb245b32a63512e2e67b3038 (diff) |
devip: ignore the evil bit in fragment info field
using ~IP_DF mask to select offset and "more fragments" bits
includes the evil bit 15. so instead define a constant IP_FO
for the fragment offset bits and use (IP_MF|IP_FO). that way
the evil bit gets ignored and doesnt cause any useless calls
to ipreassemble().
Diffstat (limited to 'sys/src/9/ip/ip.c')
-rw-r--r-- | sys/src/9/ip/ip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/9/ip/ip.c b/sys/src/9/ip/ip.c index ace707632..0752cb6f0 100644 --- a/sys/src/9/ip/ip.c +++ b/sys/src/9/ip/ip.c @@ -333,7 +333,7 @@ ipiput4(Fs *f, Ipifc *ifc, Block *bp) /* reassemble if the interface expects it */ if(nifc->reassemble){ frag = nhgets(h->frag); - if(frag & ~IP_DF) { + if(frag & (IP_MF|IP_FO)) { bp = ip4reassemble(ip, frag, bp); if(bp == nil) return; @@ -360,7 +360,7 @@ ipiput4(Fs *f, Ipifc *ifc, Block *bp) } frag = nhgets(h->frag); - if(frag & ~IP_DF) { + if(frag & (IP_MF|IP_FO)) { bp = ip4reassemble(ip, frag, bp); if(bp == nil) return; @@ -436,7 +436,7 @@ ip4reassemble(IP *ip, int offset, Block *bp) * and get rid of any fragments that might go * with it. */ - if((offset & ~IP_DF) == 0) { + if((offset & (IP_MF|IP_FO)) == 0) { if(f != nil) { ip->stats[ReasmFails]++; ipfragfree4(ip, f); @@ -451,7 +451,7 @@ ip4reassemble(IP *ip, int offset, Block *bp) } fp = (Ipfrag*)bp->base; - fp->foff = (offset & 0x1fff)<<3; + fp->foff = (offset & IP_FO)<<3; fp->flen = fragsize; /* First fragment allocates a reassembly queue */ |