summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_var.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-03-23 18:14:41 +0000
committerwollman <wollman@FreeBSD.org>1995-03-23 18:14:41 +0000
commit04db7a9c8076f9357785fba7eb791bb9f4133d17 (patch)
tree68b64c053e97161efa415e4f2f99519e0bcaf585 /sys/netinet/in_var.h
parent784a7ccf3c686fa4681d4266fe021d006a1a0b07 (diff)
downloadFreeBSD-src-04db7a9c8076f9357785fba7eb791bb9f4133d17.zip
FreeBSD-src-04db7a9c8076f9357785fba7eb791bb9f4133d17.tar.gz
in_var.h: in_multi structures now form a queue(3)-style LIST structure
in.c: when an interface address is deleted, keep its multicast membership . records (attached to a struct multi_kludge) for attachment to the . next address on the same interface. Also, in_multi structures now . gain a reference to the ifaddr so that they won't point off into . freed memory if an interface goes away and doesn't come back before . the last socket reference drops. This is analogous to how it is . done for routes, and seems to make the most sense.
Diffstat (limited to 'sys/netinet/in_var.h')
-rw-r--r--sys/netinet/in_var.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index cba0cb4..f4548c6 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -31,12 +31,14 @@
* SUCH DAMAGE.
*
* @(#)in_var.h 8.1 (Berkeley) 6/10/93
- * $Id: in_var.h,v 1.7 1994/10/25 22:13:32 swallace Exp $
+ * $Id: in_var.h,v 1.8 1995/03/16 18:14:53 bde Exp $
*/
#ifndef _NETINET_IN_VAR_H_
#define _NETINET_IN_VAR_H_
+#include <sys/queue.h>
+
/*
* Interface address, Internet version. One of these structures
* is allocated for each interface with an Internet address.
@@ -58,7 +60,8 @@ struct in_ifaddr {
struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
#define ia_broadaddr ia_dstaddr
struct sockaddr_in ia_sockmask; /* reserve space for general netmask */
- struct in_multi *ia_multiaddrs; /* list of multicast addresses */
+ LIST_HEAD(in_multihead, in_multi) ia_multiaddrs;
+ /* list of multicast addresses */
};
struct in_aliasreq {
@@ -140,12 +143,12 @@ struct router_info {
* structure.
*/
struct in_multi {
+ LIST_ENTRY(in_multi) inm_entry; /* list glue */
struct in_addr inm_addr; /* IP multicast address */
struct ifnet *inm_ifp; /* back pointer to ifnet */
struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */
u_int inm_refcount; /* no. membership claims by sockets */
u_int inm_timer; /* IGMP membership report timer */
- struct in_multi *inm_next; /* ptr to next multicast address */
u_int inm_state; /* state of the membership */
struct router_info *inm_rti; /* router info*/
};
@@ -175,9 +178,9 @@ struct in_multistep {
if (ia == NULL) \
(inm) = NULL; \
else \
- for ((inm) = ia->ia_multiaddrs; \
+ for ((inm) = ia->ia_multiaddrs.lh_first; \
(inm) != NULL && (inm)->inm_addr.s_addr != (addr).s_addr; \
- (inm) = inm->inm_next) \
+ (inm) = inm->inm_entry.le_next) \
continue; \
}
@@ -193,13 +196,13 @@ struct in_multistep {
/* struct in_multi *inm; */ \
{ \
if (((inm) = (step).i_inm) != NULL) \
- (step).i_inm = (inm)->inm_next; \
+ (step).i_inm = (inm)->inm_entry.le_next; \
else \
while ((step).i_ia != NULL) { \
- (inm) = (step).i_ia->ia_multiaddrs; \
+ (inm) = (step).i_ia->ia_multiaddrs.lh_first; \
(step).i_ia = (step).i_ia->ia_next; \
if ((inm) != NULL) { \
- (step).i_inm = (inm)->inm_next; \
+ (step).i_inm = (inm)->inm_entry.le_next; \
break; \
} \
} \
OpenPOWER on IntegriCloud