summaryrefslogtreecommitdiff
path: root/sys/netinet/igmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/igmp.c')
-rw-r--r--sys/netinet/igmp.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 51fbb15fc38..2babdd30dfd 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.36 2013/11/28 10:16:44 mpi Exp $ */
+/* $OpenBSD: igmp.c,v 1.37 2014/01/21 10:18:26 mpi Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -128,7 +128,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_ifp) {
+ if (rti->rti_ifp->if_index == inm->inm_ifidx) {
inm->inm_rti = rti;
if (rti->rti_type == IGMP_v1_ROUTER)
return (IGMP_v1_HOST_MEMBERSHIP_REPORT);
@@ -141,7 +141,7 @@ rti_fill(struct in_multi *inm)
M_MRTABLE, M_NOWAIT);
if (rti == NULL)
return (-1);
- rti->rti_ifp = inm->inm_ifp;
+ rti->rti_ifp = if_get(inm->inm_ifidx);
rti->rti_type = IGMP_v2_ROUTER;
rti->rti_next = rti_head;
rti_head = rti;
@@ -462,13 +462,16 @@ igmp_input(struct mbuf *m, ...)
void
igmp_joingroup(struct in_multi *inm)
{
- int i, s = splsoftnet();
+ struct ifnet* ifp;
+ int i, s;
+
+ ifp = if_get(inm->inm_ifidx);
+ s = splsoftnet();
inm->inm_state = IGMP_IDLE_MEMBER;
if (!IN_LOCAL_GROUP(inm->inm_addr.s_addr) &&
- inm->inm_ifp &&
- (inm->inm_ifp->if_flags & IFF_LOOPBACK) == 0) {
+ ifp && (ifp->if_flags & IFF_LOOPBACK) == 0) {
if ((i = rti_fill(inm)) == -1) {
splx(s);
return;
@@ -486,15 +489,17 @@ igmp_joingroup(struct in_multi *inm)
void
igmp_leavegroup(struct in_multi *inm)
{
+ struct ifnet* ifp;
+ int s;
- int s = splsoftnet();
+ ifp = if_get(inm->inm_ifidx);
+ s = splsoftnet();
switch (inm->inm_state) {
case IGMP_DELAYING_MEMBER:
case IGMP_IDLE_MEMBER:
if (!IN_LOCAL_GROUP(inm->inm_addr.s_addr) &&
- inm->inm_ifp &&
- (inm->inm_ifp->if_flags & IFF_LOOPBACK) == 0)
+ ifp && (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);
@@ -616,7 +621,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_ifp;
+ imo.imo_multicast_ifp = if_get(inm->inm_ifidx);
imo.imo_multicast_ttl = 1;
/*