summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/igmp.c17
-rw-r--r--sys/netinet/in_var.h8
2 files changed, 12 insertions, 13 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 0a29dea107e..cc6bf91a480 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.53 2015/09/13 17:47:07 mpi Exp $ */
+/* $OpenBSD: igmp.c,v 1.54 2015/11/11 10:01:46 mpi Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -149,7 +149,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->if_index == inm->inm_ifidx) {
+ if (rti->rti_ifidx == inm->inm_ifidx) {
inm->inm_rti = rti;
if (rti->rti_type == IGMP_v1_ROUTER)
return (IGMP_v1_HOST_MEMBERSHIP_REPORT);
@@ -162,7 +162,7 @@ rti_fill(struct in_multi *inm)
M_MRTABLE, M_NOWAIT);
if (rti == NULL)
return (-1);
- rti->rti_ifp = if_get(inm->inm_ifidx);
+ rti->rti_ifidx = inm->inm_ifidx;
rti->rti_type = IGMP_v2_ROUTER;
rti->rti_next = rti_head;
rti_head = rti;
@@ -176,7 +176,7 @@ rti_find(struct ifnet *ifp)
struct router_info *rti;
for (rti = rti_head; rti != 0; rti = rti->rti_next) {
- if (rti->rti_ifp == ifp)
+ if (rti->rti_ifidx == ifp->if_index)
return (rti);
}
@@ -184,7 +184,7 @@ rti_find(struct ifnet *ifp)
M_MRTABLE, M_NOWAIT);
if (rti == NULL)
return (NULL);
- rti->rti_ifp = if_ref(ifp);
+ rti->rti_ifidx = ifp->if_index;
rti->rti_type = IGMP_v2_ROUTER;
rti->rti_next = rti_head;
rti_head = rti;
@@ -197,8 +197,7 @@ rti_delete(struct ifnet *ifp)
struct router_info *rti, **prti = &rti_head;
for (rti = rti_head; rti != 0; rti = rti->rti_next) {
- if (rti->rti_ifp == ifp) {
- if_put(ifp);
+ if (rti->rti_ifidx == ifp->if_index) {
*prti = rti->rti_next;
free(rti, M_MRTABLE, sizeof(*rti));
break;
@@ -225,7 +224,7 @@ igmp_input(struct mbuf *m, ...)
m_freem(m);
return;
}
-
+
igmp_input_if(ifp, m, iphlen);
if_put(ifp);
}
@@ -510,7 +509,7 @@ igmp_joingroup(struct in_multi *inm)
ifp && (ifp->if_flags & IFF_LOOPBACK) == 0) {
if ((i = rti_fill(inm)) == -1)
goto out;
-
+
igmp_sendpkt(inm, i, 0);
inm->inm_state = IGMP_DELAYING_MEMBER;
inm->inm_timer = IGMP_RANDOM_DELAY(
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 29ff5071e07..769faf127f9 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.35 2015/01/12 13:51:45 mpi Exp $ */
+/* $OpenBSD: in_var.h,v 1.36 2015/11/11 10:01:46 mpi Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -98,9 +98,9 @@ do { \
* Per-interface router version information.
*/
struct router_info {
- struct ifnet *rti_ifp;
- int rti_type; /* type of router on this interface */
- int rti_age; /* time since last v1 query */
+ unsigned int rti_ifidx;
+ int rti_type; /* type of router on this interface */
+ int rti_age; /* time since last v1 query */
struct router_info *rti_next;
};