From d1dd20be6e083b93b09d4a34c292fc935aa2a225 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sat, 4 Oct 2003 03:44:50 +0000 Subject: Locking for updates to routing table entries. Each rtentry gets a mutex that covers updates to the contents. Note this is separate from holding a reference and/or locking the routing table itself. Other/related changes: o rtredirect loses the final parameter by which an rtentry reference may be returned; this was never used and added unwarranted complexity for locking. o minor style cleanups to routing code (e.g. ansi-fy function decls) o remove the logic to bump the refcnt on the parent of cloned routes, we assume the parent will remain as long as the clone; doing this avoids a circularity in locking during delete o convert some timeouts to MPSAFE callouts Notes: 1. rt_mtx in struct rtentry is guarded by #ifdef _KERNEL as user-level applications cannot/do-no know about mutex's. Doing this requires that the mutex be the last element in the structure. A better solution is to introduce an externalized version of struct rtentry but this is a major task because of the intertwining of rtentry and other data structures that are visible to user applications. 2. There are known LOR's that are expected to go away with forthcoming work to eliminate many held references. If not these will be resolved prior to release. 3. ATM changes are untested. Sponsored by: FreeBSD Foundation Obtained from: BSD/OS (partly) --- sys/net/if_faith.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/net/if_faith.c') diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 761f1511d889..8a9cb7c777ef 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -270,6 +270,8 @@ faithrtrequest(cmd, rt, info) struct rtentry *rt; struct rt_addrinfo *info; { + RT_LOCK_ASSERT(rt); + if (rt) { rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; /* for ISO */ /* @@ -371,7 +373,7 @@ faithprefix(in6) else ret = 0; if (rt) - RTFREE(rt); + RTFREE_LOCKED(rt); return ret; } #endif -- cgit v1.2.3