diff options
author | glebius <glebius@FreeBSD.org> | 2012-07-02 19:44:18 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-07-02 19:44:18 +0000 |
commit | 6223b4d21b416cf6379fee6c7a63ddafa0d8c88a (patch) | |
tree | 1a1b353fcccca68bd5c82f51bfca79669ea5a62a | |
parent | dccf4b181e80e005034ef0e1aa8c3ebaa0e69fdc (diff) | |
download | FreeBSD-src-6223b4d21b416cf6379fee6c7a63ddafa0d8c88a.zip FreeBSD-src-6223b4d21b416cf6379fee6c7a63ddafa0d8c88a.tar.gz |
Remove route caching from IP multicast routing code. There is no
reason to do that, and also, cached route never got unreferenced,
which meant a reference leak.
Reviewed by: bms
-rw-r--r-- | sys/netinet/ip_mroute.c | 3 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.h | 1 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 30 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.h | 1 |
4 files changed, 17 insertions, 18 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index d7c23cd..9250be5 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -924,7 +924,6 @@ add_vif(struct vifctl *vifcp) vifp->v_pkt_out = 0; vifp->v_bytes_in = 0; vifp->v_bytes_out = 0; - bzero(&vifp->v_route, sizeof(vifp->v_route)); /* Adjust numvifs up if the vifi is higher than numvifs */ if (V_numvifs <= vifcp->vifc_vifi) @@ -1702,7 +1701,7 @@ send_packet(struct vif *vifp, struct mbuf *m) * should get rejected because they appear to come from * the loopback interface, thus preventing looping. */ - error = ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, &imo, NULL); + error = ip_output(m, NULL, NULL, IP_FORWARDING, &imo, NULL); CTR3(KTR_IPMF, "%s: vif %td err %d", __func__, (ptrdiff_t)(vifp - V_viftable), error); } diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h index c54c75a..e945b92 100644 --- a/sys/netinet/ip_mroute.h +++ b/sys/netinet/ip_mroute.h @@ -262,7 +262,6 @@ struct vif { u_long v_pkt_out; /* # pkts out on interface */ u_long v_bytes_in; /* # bytes in on interface */ u_long v_bytes_out; /* # bytes out on interface */ - struct route v_route; /* cached route */ }; #ifdef _KERNEL diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 98bf0ac..8ecd60e 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -717,7 +717,6 @@ add_m6if(struct mif6ctl *mifcp) mifp->m6_pkt_out = 0; mifp->m6_bytes_in = 0; mifp->m6_bytes_out = 0; - bzero(&mifp->m6_route, sizeof(mifp->m6_route)); /* Adjust nummifs up if the mifi is higher than nummifs */ if (nummifs <= mifcp->mif6c_mifi) @@ -1576,11 +1575,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) struct mbuf *mb_copy; struct ifnet *ifp = mifp->m6_ifp; int error = 0; - struct sockaddr_in6 *dst6; u_long linkmtu; - dst6 = &mifp->m6_route.ro_dst; - /* * Make a new reference to the packet; make sure that * the IPv6 header is actually copied, not just referenced, @@ -1610,8 +1606,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) /* XXX: ip6_output will override ip6->ip6_hlim */ im6o.im6o_multicast_hlim = ip6->ip6_hlim; im6o.im6o_multicast_loop = 1; - error = ip6_output(mb_copy, NULL, &mifp->m6_route, - IPV6_FORWARDING, &im6o, NULL, NULL); + error = ip6_output(mb_copy, NULL, NULL, IPV6_FORWARDING, &im6o, + NULL, NULL); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_XMIT) @@ -1626,10 +1622,13 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) * loop back a copy now. */ if (in6_mcast_loop) { - dst6->sin6_len = sizeof(struct sockaddr_in6); - dst6->sin6_family = AF_INET6; - dst6->sin6_addr = ip6->ip6_dst; - ip6_mloopback(ifp, m, &mifp->m6_route.ro_dst); + struct sockaddr_in6 dst6; + + bzero(&dst6, sizeof(dst6)); + dst6.sin6_len = sizeof(struct sockaddr_in6); + dst6.sin6_family = AF_INET6; + dst6.sin6_addr = ip6->ip6_dst; + ip6_mloopback(ifp, m, &dst6); } /* @@ -1638,15 +1637,18 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) */ linkmtu = IN6_LINKMTU(ifp); if (mb_copy->m_pkthdr.len <= linkmtu || linkmtu < IPV6_MMTU) { - dst6->sin6_len = sizeof(struct sockaddr_in6); - dst6->sin6_family = AF_INET6; - dst6->sin6_addr = ip6->ip6_dst; + struct sockaddr_in6 dst6; + + bzero(&dst6, sizeof(dst6)); + dst6.sin6_len = sizeof(struct sockaddr_in6); + dst6.sin6_family = AF_INET6; + dst6.sin6_addr = ip6->ip6_dst; /* * We just call if_output instead of nd6_output here, since * we need no ND for a multicast forwarded packet...right? */ error = (*ifp->if_output)(ifp, mb_copy, - (struct sockaddr *)&mifp->m6_route.ro_dst, NULL); + (struct sockaddr *)&dst6, NULL); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_XMIT) log(LOG_DEBUG, "phyint_send on mif %d err %d\n", diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h index 701d534..d2df0db 100644 --- a/sys/netinet6/ip6_mroute.h +++ b/sys/netinet6/ip6_mroute.h @@ -212,7 +212,6 @@ struct mif6 { u_quad_t m6_pkt_out; /* # pkts out on interface */ u_quad_t m6_bytes_in; /* # bytes in on interface */ u_quad_t m6_bytes_out; /* # bytes out on interface */ - struct route_in6 m6_route; /* cached route */ #ifdef notyet u_int m6_rsvp_on; /* RSVP listening on this vif */ struct socket *m6_rsvpd; /* RSVP daemon socket */ |