diff options
| author | Xin LI <delphij@FreeBSD.org> | 2010-10-11 11:25:37 +0000 |
|---|---|---|
| committer | Xin LI <delphij@FreeBSD.org> | 2010-10-11 11:25:37 +0000 |
| commit | 0b5575ed4b0430326e0325b54f1a4dec1828358d (patch) | |
| tree | dac80f6596b98222824cca41eb3c40c4ee410b27 | |
| parent | 04ae02407db63c6405854817e7a269b42ed96e0c (diff) | |
Notes
| -rw-r--r-- | sys/netinet/in_rmx.c | 5 | ||||
| -rw-r--r-- | sys/netinet6/in6_rmx.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index 96406aa45cfb..1389873eb802 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -121,12 +121,13 @@ in_matroute(void *v_arg, struct radix_node_head *head) struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - /*XXX locking? */ - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c index 8927a176df92..2a1364673b31 100644 --- a/sys/netinet6/in6_rmx.c +++ b/sys/netinet6/in6_rmx.c @@ -193,11 +193,13 @@ in6_matroute(void *v_arg, struct radix_node_head *head) struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } |
