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

View file

@ -725,11 +725,12 @@ 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);