summaryrefslogtreecommitdiffstats
path: root/sys/netatalk
diff options
context:
space:
mode:
authorhsu <hsu@FreeBSD.org>2002-12-18 11:46:59 +0000
committerhsu <hsu@FreeBSD.org>2002-12-18 11:46:59 +0000
commitc3153934cb24d911042c92eedf9e5dd6d7be07e1 (patch)
tree079e82ffd683b796c6432b8bcf3ff23f996d4e04 /sys/netatalk
parent2d0e93bb2eab2533104a92a432361a0d75aae7da (diff)
downloadFreeBSD-src-c3153934cb24d911042c92eedf9e5dd6d7be07e1.zip
FreeBSD-src-c3153934cb24d911042c92eedf9e5dd6d7be07e1.tar.gz
Lock up ifaddr reference counts.
Diffstat (limited to 'sys/netatalk')
-rw-r--r--sys/netatalk/at_control.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c
index c0e6727..d7e7586 100644
--- a/sys/netatalk/at_control.c
+++ b/sys/netatalk/at_control.c
@@ -159,12 +159,6 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
} else {
at_ifaddr = aa0;
}
- /*
- * Don't Add a reference for the aa itself!
- * I fell into this trap. IFAFREE tests for <=0
- * not <= 1 like RTFREE
- */
- /* aa->aa_ifa.ifa_refcnt++; DON'T DO THIS!! */
aa = aa0;
/*
@@ -172,14 +166,11 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
* and link our new one on the end
*/
ifa = (struct ifaddr *)aa;
+ IFA_LOCK_INIT(ifa);
+ ifa->ifa_refcnt = 1;
TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
/*
- * Add a reference for the linking into the ifp_if_addrlist.
- */
- ifa->ifa_refcnt++;
-
- /*
* As the at_ifaddr contains the actual sockaddrs,
* and the ifaddr itself, link them al together correctly.
*/
OpenPOWER on IntegriCloud