diff options
author | wollman <wollman@FreeBSD.org> | 1996-04-18 15:41:11 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-04-18 15:41:11 +0000 |
commit | de80c032c5957dd5985d78273e4d3add64ac4b19 (patch) | |
tree | 332805b8f6358fa2fc7e39b810b4c1c74c6d2648 /sys/netinet | |
parent | 0deb98a21fd8d1958148c91d4f108db34d1e45fe (diff) | |
download | FreeBSD-src-de80c032c5957dd5985d78273e4d3add64ac4b19.zip FreeBSD-src-de80c032c5957dd5985d78273e4d3add64ac4b19.tar.gz |
Always call ip_output() with a valid route pointer. For igmp, also get the
multicast option structure off the stack rather than malloc.
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/igmp.c | 28 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 13 |
2 files changed, 24 insertions, 17 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index f1bdb2b..68bd839 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)igmp.c 8.1 (Berkeley) 7/19/93 - * $Id: igmp.c,v 1.16 1996/03/14 16:59:16 fenner Exp $ + * $Id: igmp.c,v 1.17 1996/03/26 19:16:42 fenner Exp $ */ /* @@ -422,6 +422,8 @@ igmp_slowtimo() splx(s); } +static struct route igmprt; + static void igmp_sendpkt(inm, type, addr) struct in_multi *inm; @@ -431,18 +433,13 @@ igmp_sendpkt(inm, type, addr) struct mbuf *m; struct igmp *igmp; struct ip *ip; - struct ip_moptions *imo; + struct ip_moptions imo; + struct sockaddr_in *sin; MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) return; - MALLOC(imo, struct ip_moptions *, sizeof *imo, M_IPMOPTS, M_DONTWAIT); - if (!imo) { - m_free(m); - return; - } - m->m_pkthdr.rcvif = loif; m->m_pkthdr.len = sizeof(struct ip) + IGMP_MINLEN; MH_ALIGN(m, IGMP_MINLEN + sizeof(struct ip)); @@ -465,17 +462,20 @@ igmp_sendpkt(inm, type, addr) ip->ip_src.s_addr = INADDR_ANY; ip->ip_dst.s_addr = addr ? addr : igmp->igmp_group.s_addr; - imo->imo_multicast_ifp = inm->inm_ifp; - imo->imo_multicast_ttl = 1; - imo->imo_multicast_vif = -1; + imo.imo_multicast_ifp = inm->inm_ifp; + imo.imo_multicast_ttl = 1; + imo.imo_multicast_vif = -1; /* * Request loopback of the report if we are acting as a multicast * router, so that the process-level routing demon can hear it. */ - imo->imo_multicast_loop = (ip_mrouter != NULL); + imo.imo_multicast_loop = (ip_mrouter != NULL); - ip_output(m, router_alert, (struct route *)0, 0, imo); + /* + * XXX + * Do we have to worry about reentrancy here? Don't think so. + */ + ip_output(m, router_alert, &igmprt, 0, &imo); - FREE(imo, M_IPMOPTS); ++igmpstat.igps_snd_reports; } diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index c30334a..6ab802f 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -9,7 +9,7 @@ * Modified by Bill Fenner, PARC, April 1995 * * MROUTING Revision: 3.5 - * $Id: ip_mroute.c,v 1.30 1996/03/11 17:11:23 fenner Exp $ + * $Id: ip_mroute.c,v 1.31 1996/03/26 19:16:44 fenner Exp $ */ #include "opt_mrouting.h" @@ -1906,11 +1906,12 @@ tbf_send_packet(vifp, m) { struct ip_moptions imo; int error; + static struct route ro; int s = splnet(); if (vifp->v_flags & VIFF_TUNNEL) { /* If tunnel options */ - ip_output(m, (struct mbuf *)0, (struct route *)0, + ip_output(m, (struct mbuf *)0, &vifp->v_route, IP_FORWARDING, (struct ip_moptions *)0); } else { imo.imo_multicast_ifp = vifp->v_ifp; @@ -1918,7 +1919,13 @@ tbf_send_packet(vifp, m) imo.imo_multicast_loop = 1; imo.imo_multicast_vif = -1; - error = ip_output(m, (struct mbuf *)0, (struct route *)0, + /* + * Re-entrancy should not be a problem here, because + * the packets that we send out and are looped back at us + * should get rejected because they appear to come from + * the loopback interface, thus preventing looping. + */ + error = ip_output(m, (struct mbuf *)0, &ro, IP_FORWARDING, &imo); if (mrtdebug & DEBUG_XMIT) |