M ip/arp.c => ip/arp.c +4 -4
@@ 125,7 125,7 @@ newarp6(Arp *arp, uchar *ip, Ipifc *ifc, int addrxt)
memmove(a->ip, ip, sizeof(a->ip));
a->utime = NOW;
- a->ctime = a->utime;
+ a->ctime = 0;
a->type = m;
a->rtime = NOW + ReTransTimer;
@@ 354,14 354,16 @@ arpenter(Fs *fs, int version, uchar *ip, uchar *mac, int n, int refresh)
}
}
- a->hold = nil;
a->ifc = ifc;
a->ifcid = ifc->ifcid;
bp = a->hold;
a->hold = nil;
if(version == V4)
ip += IPv4off;
+ a->utime = NOW;
+ a->ctime = a->utime;
qunlock(arp);
+
while(bp){
next = bp->list;
if(ifc != nil){
@@ 380,8 382,6 @@ arpenter(Fs *fs, int version, uchar *ip, uchar *mac, int n, int refresh)
freeb(bp);
bp = next;
}
- a->utime = NOW;
- a->ctime = a->utime;
return;
}
}
M ip/ip.c => ip/ip.c +2 -1
@@ 486,7 486,7 @@ ipiput4(Fs *f, Ipifc *ifc, Block *bp)
/* don't forward to source's network */
conv.r = nil;
r = v4lookup(f, h->dst, &conv);
- if(r != nil && r->ifc == ifc){
+ if(r == nil || r->ifc == ifc){
ip->stats[OutDiscards]++;
freeblist(bp);
return;
@@ 502,6 502,7 @@ ipiput4(Fs *f, Ipifc *ifc, Block *bp)
}
/* reassemble if the interface expects it */
+if(r->ifc == nil) panic("nil route rfc");
if(r->ifc->reassemble){
frag = nhgets(h->frag);
if(frag) {
M ip/ipifc.c => ip/ipifc.c +9 -0
@@ 305,10 305,19 @@ ipifckick(void *x)
return;
ifc = (Ipifc*)c->ptcl;
+ if(!canrlock(ifc)){
+ freeb(bp);
+ return;
+ }
+ if(waserror()){
+ runlock(ifc);
+ nexterror();
+ }
if(ifc->m == nil || ifc->m->pktin == nil)
freeb(bp);
else
(*ifc->m->pktin)(c->p->f, ifc, bp);
+ runlock(ifc);
}
/*