diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-16 11:09:41 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-16 11:09:41 +0000 |
commit | 3a3f3f5b2a66fdcf27f621f80a6d0a6d22bfaace (patch) | |
tree | 173fe4df0244a96c60ce236617fe5b7c539ad2f1 /sys/netinet6/ip6_mroute.c | |
parent | 913f86006f0c78d29161101d7aad233f8f4668df (diff) |
Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.
The interface pointer should now be retrieved when necessary with
if_get(). If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.
Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.
Tested by jmatthew@ and krw@, discussed with many.
ok mikeb@, bluhm@, dlg@
Diffstat (limited to 'sys/netinet6/ip6_mroute.c')
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index b1a37e6bf26..a031115d2e1 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1078,10 +1078,10 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) ip6_log_time = time_second; log(LOG_DEBUG, "cannot forward " - "from %s to %s nxt %d received on %s\n", + "from %s to %s nxt %d received on interface %u\n", src, dst, ip6->ip6_nxt, - m->m_pkthdr.rcvif->if_xname); + m->m_pkthdr.ph_ifidx); } return 0; } @@ -1445,8 +1445,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) } /* if wrong iif */ /* If I sourced this packet, it counts as output, else it was input. */ - if (m->m_pkthdr.rcvif == NULL) { - /* XXX: is rcvif really NULL when output?? */ + if (m->m_pkthdr.ph_ifidx == 0) { + /* XXX: is ph_ifidx really 0 when output?? */ mif6table[mifi].m6_pkt_out++; mif6table[mifi].m6_bytes_out += plen; } else { @@ -1526,7 +1526,7 @@ phyint_send6(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) * Otherwise, we can simply send the packet to the interface * sending queue. */ - if (m->m_pkthdr.rcvif == NULL) { + if (m->m_pkthdr.ph_ifidx == 0) { struct ip6_moptions im6o; im6o.im6o_ifidx = ifp->if_index; |