From f17afe12c24f04c1345de158e856fc2c487d9fb6 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Fri, 18 Oct 2013 09:04:04 +0000 Subject: Abstract the fact that IPv4 muticast records are linked to the interface descriptor throught the first configured address in the global list, this will help reducing the size of future diffs. No object change. ok sthen@ --- sys/netinet/igmp.c | 16 ++++++++-------- sys/netinet/in.c | 4 ++-- sys/netinet/in_var.h | 3 ++- sys/netinet/ip_output.c | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'sys') diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 9817db36bc2..977e048b252 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.34 2013/10/14 11:07:42 mpi Exp $ */ +/* $OpenBSD: igmp.c,v 1.35 2013/10/18 09:04:02 mpi Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -127,7 +127,7 @@ rti_fill(struct in_multi *inm) struct router_info *rti; for (rti = rti_head; rti != 0; rti = rti->rti_next) { - if (rti->rti_ifp == inm->inm_ia->ia_ifp) { + if (rti->rti_ifp == inm->inm_ifp) { inm->inm_rti = rti; if (rti->rti_type == IGMP_v1_ROUTER) return (IGMP_v1_HOST_MEMBERSHIP_REPORT); @@ -140,7 +140,7 @@ rti_fill(struct in_multi *inm) M_MRTABLE, M_NOWAIT); if (rti == NULL) return (-1); - rti->rti_ifp = inm->inm_ia->ia_ifp; + rti->rti_ifp = inm->inm_ifp; rti->rti_type = IGMP_v2_ROUTER; rti->rti_next = rti_head; rti_head = rti; @@ -459,8 +459,8 @@ igmp_joingroup(struct in_multi *inm) inm->inm_state = IGMP_IDLE_MEMBER; if (!IN_LOCAL_GROUP(inm->inm_addr.s_addr) && - inm->inm_ia->ia_ifp && - (inm->inm_ia->ia_ifp->if_flags & IFF_LOOPBACK) == 0) { + inm->inm_ifp && + (inm->inm_ifp->if_flags & IFF_LOOPBACK) == 0) { if ((i = rti_fill(inm)) == -1) { splx(s); return; @@ -483,8 +483,8 @@ igmp_leavegroup(struct in_multi *inm) case IGMP_DELAYING_MEMBER: case IGMP_IDLE_MEMBER: if (!IN_LOCAL_GROUP(inm->inm_addr.s_addr) && - inm->inm_ia->ia_ifp && - (inm->inm_ia->ia_ifp->if_flags & IFF_LOOPBACK) == 0) + inm->inm_ifp && + (inm->inm_ifp->if_flags & IFF_LOOPBACK) == 0) if (inm->inm_rti->rti_type != IGMP_v1_ROUTER) igmp_sendpkt(inm, IGMP_HOST_LEAVE_MESSAGE, INADDR_ALLROUTERS_GROUP); @@ -602,7 +602,7 @@ igmp_sendpkt(struct in_multi *inm, int type, in_addr_t addr) m->m_data -= sizeof(struct ip); m->m_len += sizeof(struct ip); - imo.imo_multicast_ifp = inm->inm_ia->ia_ifp; + imo.imo_multicast_ifp = inm->inm_ifp; imo.imo_multicast_ttl = 1; /* diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 386ea9732be..e65aa6ca32e 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.86 2013/10/09 09:33:43 mpi Exp $ */ +/* $OpenBSD: in.c,v 1.87 2013/10/18 09:04:02 mpi Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -999,7 +999,7 @@ in_delmulti(struct in_multi *inm) * Unlink from list. */ LIST_REMOVE(inm, inm_list); - ifp = inm->inm_ia->ia_ifp; + ifp = inm->inm_ifp; ifafree(&inm->inm_ia->ia_ifa); if (ifp) { diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index b06fe3027c6..0d1b892ca3b 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_var.h,v 1.23 2013/10/17 16:27:43 bluhm Exp $ */ +/* $OpenBSD: in_var.h,v 1.24 2013/10/18 09:04:03 mpi Exp $ */ /* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */ /* @@ -138,6 +138,7 @@ struct router_info { struct in_multi { struct in_addr inm_addr; /* IP multicast address */ struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */ +#define inm_ifp inm_ia->ia_ifp u_int inm_refcount; /* no. membership claims by sockets */ u_int inm_timer; /* IGMP membership report timer */ LIST_ENTRY(in_multi) inm_list; /* list of multicast addresses */ diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index d031c08a760..01cdd2c5307 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.246 2013/08/08 14:29:29 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.247 2013/10/18 09:04:03 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -1835,7 +1835,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m, * membership slots are full. */ for (i = 0; i < imo->imo_num_memberships; ++i) { - if (imo->imo_membership[i]->inm_ia->ia_ifp == ifp && + if (imo->imo_membership[i]->inm_ifp == ifp && imo->imo_membership[i]->inm_addr.s_addr == mreq->imr_multiaddr.s_addr) break; @@ -1917,7 +1917,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m, */ for (i = 0; i < imo->imo_num_memberships; ++i) { if ((ifp == NULL || - imo->imo_membership[i]->inm_ia->ia_ifp == ifp) && + imo->imo_membership[i]->inm_ifp == ifp) && imo->imo_membership[i]->inm_addr.s_addr == mreq->imr_multiaddr.s_addr) break; -- cgit v1.2.3