diff options
| -rw-r--r-- | sys/src/9/ip/ip.c | 5 | ||||
| -rw-r--r-- | sys/src/9/ip/ipifc.c | 3 | ||||
| -rw-r--r-- | sys/src/9/ip/ipv6.c | 5 |
3 files changed, 10 insertions, 3 deletions
diff --git a/sys/src/9/ip/ip.c b/sys/src/9/ip/ip.c index 9f7bfa0a0..7f197b22b 100644 --- a/sys/src/9/ip/ip.c +++ b/sys/src/9/ip/ip.c @@ -123,7 +123,10 @@ ipoput4(Fs *f, Block *bp, int gating, int ttl, int tos, Routehint *rh) else gate = r->v4.gate; - rlock(ifc); + if(!canrlock(ifc)){ + ip->stats[OutDiscards]++; + goto free; + } if(waserror()){ runlock(ifc); nexterror(); diff --git a/sys/src/9/ip/ipifc.c b/sys/src/9/ip/ipifc.c index 7af840991..9dd55f93b 100644 --- a/sys/src/9/ip/ipifc.c +++ b/sys/src/9/ip/ipifc.c @@ -1167,7 +1167,8 @@ findipifc(Fs *f, uchar *local, uchar *remote, int type) xspec = 0; for(cp = f->ipifc->conv; *cp != nil; cp++){ ifc = (Ipifc*)(*cp)->ptcl; - rlock(ifc); + if(!canrlock(ifc)) + continue; for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){ if(type & Runi){ if(ipcmp(remote, lifc->local) == 0){ diff --git a/sys/src/9/ip/ipv6.c b/sys/src/9/ip/ipv6.c index 7d7cdc09a..1d8750cde 100644 --- a/sys/src/9/ip/ipv6.c +++ b/sys/src/9/ip/ipv6.c @@ -76,7 +76,10 @@ ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos, Routehint *rh) else gate = r->v6.gate; - rlock(ifc); + if(!canrlock(ifc)){ + ip->stats[OutDiscards]++; + goto free; + } if(waserror()){ runlock(ifc); nexterror(); |
