summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2016-12-14 17:15:57 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2016-12-14 17:15:57 +0000
commit6f222eeebb3e4c4f2231b31beeee962ec45d5316 (patch)
treec53f01dc8e5affca1dae2921015e9e9fa38238e0
parentb0a878f8f83d69c5ce65720db2a77dadfbc7a45b (diff)
Set the rtableid for new mbufs when sending packets in igmp_sendpkt().
ok mikeb@, phessler@
-rw-r--r--sys/netinet/igmp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 11446ce4188..efab07550a1 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.56 2016/12/05 15:31:43 mpi Exp $ */
+/* $OpenBSD: igmp.c,v 1.57 2016/12/14 17:15:56 rzalamena Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -613,14 +613,21 @@ igmp_slowtimo(void)
void
igmp_sendpkt(struct in_multi *inm, int type, in_addr_t addr)
{
+ struct ifnet *ifp;
struct mbuf *m;
struct igmp *igmp;
struct ip *ip;
struct ip_moptions imo;
+ if ((ifp = if_get(inm->inm_ifidx)) == NULL)
+ return;
+
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m == NULL)
+ if (m == NULL) {
+ if_put(ifp);
return;
+ }
+
/*
* Assume max_linkhdr + sizeof(struct ip) + IGMP_MINLEN
* is smaller than mbuf size returned by MGETHDR.
@@ -652,6 +659,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);
+ m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
imo.imo_ifidx = inm->inm_ifidx;
imo.imo_ttl = 1;
@@ -666,6 +674,7 @@ igmp_sendpkt(struct in_multi *inm, int type, in_addr_t addr)
#endif /* MROUTING */
ip_output(m, router_alert, NULL, IP_MULTICASTOPTS, &imo, NULL, 0);
+ if_put(ifp);
++igmpstat.igps_snd_reports;
}