devip: ignore icmp advise about laggard fragments

icmp has to advise protocols about the first
fragment only. all other fragments should be
ignored.
This commit is contained in:
cinap_lenrek 2019-03-07 01:25:11 +01:00
parent 88e054ffdf
commit 4885c75526
2 changed files with 12 additions and 9 deletions

View file

@ -401,11 +401,13 @@ icmpiput(Proto *icmp, Ipifc*, Block *bp)
goto raise; goto raise;
} }
p = (Icmp *)bp->rp; p = (Icmp *)bp->rp;
if((nhgets(p->frag) & ~(IP_DF|IP_MF)) == 0){
pr = Fsrcvpcolx(icmp->f, p->proto); pr = Fsrcvpcolx(icmp->f, p->proto);
if(pr != nil && pr->advise != nil) { if(pr != nil && pr->advise != nil) {
(*pr->advise)(pr, bp, msg); (*pr->advise)(pr, bp, msg);
return; return;
} }
}
bp->rp -= ICMP_IPSIZE+ICMP_HDRSIZE; bp->rp -= ICMP_IPSIZE+ICMP_HDRSIZE;
goticmpkt(icmp, bp); goticmpkt(icmp, bp);
break; break;

View file

@ -725,12 +725,13 @@ icmpiput6(Proto *icmp, Ipifc *ifc, Block *bp)
bp->rp -= IP6HDR; bp->rp -= IP6HDR;
} }
} }
if(p->proto != FH){
pr = Fsrcvpcolx(icmp->f, p->proto); pr = Fsrcvpcolx(icmp->f, p->proto);
if(pr != nil && pr->advise != nil) { if(pr != nil && pr->advise != nil) {
(*pr->advise)(pr, bp, msg); (*pr->advise)(pr, bp, msg);
return; return;
} }
}
bp->rp -= IPICMPSZ; bp->rp -= IPICMPSZ;
goticmpkt6(icmp, bp, 0); goticmpkt6(icmp, bp, 0);
break; break;