ref: c7b2ca571699879cc6e97947263b2481a378c52d
parent: c0383d8291b2da3aed8a7751097a220442777652
parent: 4b8f7a2110d80fdad0f09f376dbfd2204e2e8f8e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Mar 7 17:41:42 EST 2019
merge
--- a/sys/src/9/ip/icmp.c
+++ b/sys/src/9/ip/icmp.c
@@ -401,7 +401,7 @@
goto raise;
}
p = (Icmp *)bp->rp;
- if((nhgets(p->frag) & ~(IP_DF|IP_MF)) == 0){
+ if((nhgets(p->frag) & IP_FO) == 0){
pr = Fsrcvpcolx(icmp->f, p->proto);
if(pr != nil && pr->advise != nil) {
(*pr->advise)(pr, bp, msg);
--- a/sys/src/9/ip/ip.c
+++ b/sys/src/9/ip/ip.c
@@ -333,7 +333,7 @@
/* 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 @@
}
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 @@
* 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 @@
}
fp = (Ipfrag*)bp->base;
- fp->foff = (offset & 0x1fff)<<3;
+ fp->foff = (offset & IP_FO)<<3;
fp->flen = fragsize;
/* First fragment allocates a reassembly queue */
--- a/sys/src/9/ip/ip.h
+++ b/sys/src/9/ip/ip.h
@@ -57,6 +57,7 @@
IP_HLEN4= 5, /* v4: Header length in words */
IP_DF= 0x4000, /* v4: Don't fragment */
IP_MF= 0x2000, /* v4: More fragments */
+ IP_FO= 0x1fff, /* v4: Fragment offset */
IP4HDR= IP_HLEN4<<2, /* sizeof(Ip4hdr) */
IP_MAX= 64*1024, /* Max. Internet packet size, v4 & v6 */