aboutsummaryrefslogtreecommitdiff
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2009-06-21 19:30:33 +0000
committerRobert Watson <rwatson@FreeBSD.org>2009-06-21 19:30:33 +0000
commit1099f828b3c0026cd8d03616473dda5a0cc7429f (patch)
tree2cfffa4418c1fa90f1e9d094aa882742d0ababb9 /sys/net/route.c
parentc808c9632d567c38d12e8c9e59bf05abe60f5fe4 (diff)
downloadsrc-1099f828b3c0026cd8d03616473dda5a0cc7429f.tar.gz
src-1099f828b3c0026cd8d03616473dda5a0cc7429f.zip
Clean up common ifaddr management:
- Unify reference count and lock initialization in a single function, ifa_init(). - Move tear-down from a macro (IFAFREE) to a function ifa_free(). - Move reference count bump from a macro (IFAREF) to a function ifa_ref(). - Instead of using a u_int protected by a mutex to refcount(9) for reference count management. The ifa_mtx is now used for exactly one ioctl, and possibly should be removed. MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=194602
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index aaa38d76c6b0..1705e98e0193 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -474,7 +474,7 @@ rtfree(struct rtentry *rt)
* e.g other routes and ifaddrs.
*/
if (rt->rt_ifa)
- IFAFREE(rt->rt_ifa);
+ ifa_free(rt->rt_ifa);
/*
* The key is separatly alloc'd so free it (see rt_setgate()).
* This also frees the gateway, as they are always malloc'd
@@ -1126,7 +1126,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
* This moved from below so that rnh->rnh_addaddr() can
* examine the ifa and ifa->ifa_ifp if it so desires.
*/
- IFAREF(ifa);
+ ifa_ref(ifa);
rt->rt_ifa = ifa;
rt->rt_ifp = ifa->ifa_ifp;
rt->rt_rmx.rmx_weight = 1;
@@ -1136,7 +1136,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
if (rn_mpath_capable(rnh) &&
rt_mpath_conflict(rnh, rt, netmask)) {
if (rt->rt_ifa) {
- IFAFREE(rt->rt_ifa);
+ ifa_free(rt->rt_ifa);
}
Free(rt_key(rt));
RT_LOCK_DESTROY(rt);
@@ -1153,7 +1153,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
*/
if (rn == NULL) {
if (rt->rt_ifa)
- IFAFREE(rt->rt_ifa);
+ ifa_free(rt->rt_ifa);
Free(rt_key(rt));
RT_LOCK_DESTROY(rt);
uma_zfree(V_rtzone, rt);
@@ -1409,8 +1409,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
*/
if (memcmp(rt->rt_ifa->ifa_addr,
ifa->ifa_addr, ifa->ifa_addr->sa_len)) {
- IFAFREE(rt->rt_ifa);
- IFAREF(ifa);
+ ifa_free(rt->rt_ifa);
+ ifa_ref(ifa);
rt->rt_ifp = ifa->ifa_ifp;
rt->rt_ifa = ifa;
}