fix ipv6 icmphostunr() locking and memory free bugs (from sources)
This commit is contained in:
parent
9d30cabbaf
commit
688c1f15cd
|
@ -432,23 +432,19 @@ icmphostunr(Fs *f, Ipifc *ifc, Block *bp, int code, int free)
|
||||||
p = (Ip6hdr *)bp->rp;
|
p = (Ip6hdr *)bp->rp;
|
||||||
|
|
||||||
if(isv6mcast(p->src))
|
if(isv6mcast(p->src))
|
||||||
goto clean;
|
goto freebl;
|
||||||
|
|
||||||
nbp = newIPICMP(sz);
|
nbp = newIPICMP(sz);
|
||||||
np = (IPICMP *)nbp->rp;
|
np = (IPICMP *)nbp->rp;
|
||||||
|
|
||||||
rlock(ifc);
|
rlock(ifc);
|
||||||
if(ipv6anylocal(ifc, np->src))
|
if(ipv6anylocal(ifc, np->src))
|
||||||
netlog(f, Logicmp, "send icmphostunr -> src %I dst %I\n",
|
netlog(f, Logicmp, "send icmphostunr -> src %I dst %I\n", p->src, p->dst);
|
||||||
p->src, p->dst);
|
|
||||||
else {
|
else {
|
||||||
netlog(f, Logicmp, "icmphostunr fail -> src %I dst %I\n",
|
netlog(f, Logicmp, "icmphostunr fail -> src %I dst %I\n", p->src, p->dst);
|
||||||
p->src, p->dst);
|
runlock(ifc);
|
||||||
freeblist(nbp);
|
freeblist(nbp);
|
||||||
if(free)
|
goto freebl;
|
||||||
goto clean;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(np->dst, p->src, IPaddrlen);
|
memmove(np->dst, p->src, IPaddrlen);
|
||||||
|
@ -462,14 +458,12 @@ icmphostunr(Fs *f, Ipifc *ifc, Block *bp, int code, int free)
|
||||||
|
|
||||||
if(free)
|
if(free)
|
||||||
ipiput6(f, ifc, nbp);
|
ipiput6(f, ifc, nbp);
|
||||||
else {
|
else
|
||||||
ipoput6(f, nbp, 0, MAXTTL, DFLTTOS, nil);
|
ipoput6(f, nbp, 0, MAXTTL, DFLTTOS, nil);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clean:
|
|
||||||
runlock(ifc);
|
runlock(ifc);
|
||||||
freeblist(bp);
|
freebl:
|
||||||
|
if(free)
|
||||||
|
freeblist(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
|
Loading…
Reference in a new issue