From 4ffc00490175f1ea8b4a87149bed2b0076df6f3b Mon Sep 17 00:00:00 2001 From: bms Date: Tue, 20 Mar 2007 00:36:10 +0000 Subject: Implement reference counting for ifmultiaddr, in_multi, and in6_multi structures. Detect when ifnet instances are detached from the network stack and perform appropriate cleanup to prevent memory leaks. This has been implemented in such a way as to be backwards ABI compatible. Kernel consumers are changed to use if_delmulti_ifma(); in_delmulti() is unable to detect interface removal by design, as it performs searches on structures which are removed with the interface. With this architectural change, the panics FreeBSD users have experienced with carp and pfsync should be resolved. Obtained from: p4 branch bms_netdev Reviewed by: andre Sponsored by: Garance A Drosehn Idea from: NetBSD MFC after: 1 month --- sys/netinet/in_var.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/netinet/in_var.h') diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index 7d22844..7605199 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -165,6 +165,7 @@ struct in_multi { u_int inm_timer; /* IGMP membership report timer */ u_int inm_state; /* state of the membership */ struct router_info *inm_rti; /* router info*/ + u_int inm_refcount; /* reference count */ }; #ifdef _KERNEL @@ -248,7 +249,6 @@ struct route; struct in_multi *in_addmulti(struct in_addr *, struct ifnet *); void in_delmulti(struct in_multi *); void in_delmulti_locked(struct in_multi *); -void in_delmulti_ifp(struct ifnet *ifp); int in_control(struct socket *, u_long, caddr_t, struct ifnet *, struct thread *); void in_rtqdrain(void); -- cgit v1.1