summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2007-03-20 00:36:10 +0000
committerbms <bms@FreeBSD.org>2007-03-20 00:36:10 +0000
commit4ffc00490175f1ea8b4a87149bed2b0076df6f3b (patch)
treea99ae311b25195ab5b7322b739f496dec7a7cd69 /sys/net/if_var.h
parenta8db64a5b356ec426744ef16079c671b79e6369b (diff)
downloadFreeBSD-src-4ffc00490175f1ea8b4a87149bed2b0076df6f3b.zip
FreeBSD-src-4ffc00490175f1ea8b4a87149bed2b0076df6f3b.tar.gz
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
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r--sys/net/if_var.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 574bb72..032bcca 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -600,8 +600,6 @@ struct ifprefix {
/*
* Multicast address structure. This is analogous to the ifaddr
* structure except that it keeps track of multicast addresses.
- * Also, the reference count here is a count of requests for this
- * address, not a count of pointers to this structure.
*/
struct ifmultiaddr {
TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
@@ -610,6 +608,7 @@ struct ifmultiaddr {
struct ifnet *ifma_ifp; /* back-pointer to interface */
u_int ifma_refcount; /* reference count */
void *ifma_protospec; /* protocol-specific state, if any */
+ struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */
};
#ifdef _KERNEL
@@ -667,6 +666,7 @@ int if_allmulti(struct ifnet *, int);
struct ifnet* if_alloc(u_char);
void if_attach(struct ifnet *);
int if_delmulti(struct ifnet *, struct sockaddr *);
+void if_delmulti_ifma(struct ifmultiaddr *);
void if_detach(struct ifnet *);
void if_purgeaddrs(struct ifnet *);
void if_down(struct ifnet *);
OpenPOWER on IntegriCloud