ref: 2af6b0896040ab24c2d411a36781d7588935c6cf
parent: 827020f6863490c649470087008ab5ca8138afc0
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 3 22:09:39 EST 2019
devip: use common code in icmp for handling advise
--- a/sys/src/9/ip/icmp.c
+++ b/sys/src/9/ip/icmp.c
@@ -394,6 +394,7 @@
} else
msg = unreachcode[p->code];
+ Advise:
bp->rp += ICMP_IPSIZE+ICMP_HDRSIZE;
if(BLEN(bp) < MinAdvise){
ipriv->stats[LenErrs]++;
@@ -410,20 +411,8 @@
break;
case TimeExceed:
if(p->code == 0){
- snprint(m2, sizeof m2, "ttl exceeded at %V", p->src);
-
- bp->rp += ICMP_IPSIZE+ICMP_HDRSIZE;
- if(BLEN(bp) < MinAdvise){
- ipriv->stats[LenErrs]++;
- goto raise;
- }
- p = (Icmp *)bp->rp;
- pr = Fsrcvpcolx(icmp->f, p->proto);
- if(pr != nil && pr->advise != nil) {
- (*pr->advise)(pr, bp, m2);
- return;
- }
- bp->rp -= ICMP_IPSIZE+ICMP_HDRSIZE;
+ snprint(msg = m2, sizeof m2, "ttl exceeded at %V", p->src);
+ goto Advise;
}
goticmpkt(icmp, bp);
break;