Allow for ip_output() to be called with a NULL route pointer.
This fixes a panic I introduced yesterday in ip_icmp.c,v 1.64.
This commit is contained in:
parent
b3079d8ae1
commit
5fcff41f8a
@ -1867,7 +1867,6 @@ tbf_send_packet(vifp, m)
|
||||
{
|
||||
struct ip_moptions imo;
|
||||
int error;
|
||||
static struct route ro;
|
||||
int s = splnet();
|
||||
|
||||
if (vifp->v_flags & VIFF_TUNNEL) {
|
||||
@ -1886,7 +1885,7 @@ tbf_send_packet(vifp, m)
|
||||
* should get rejected because they appear to come from
|
||||
* the loopback interface, thus preventing looping.
|
||||
*/
|
||||
error = ip_output(m, (struct mbuf *)0, &ro,
|
||||
error = ip_output(m, (struct mbuf *)0, NULL,
|
||||
IP_FORWARDING, &imo);
|
||||
|
||||
if (mrtdebug & DEBUG_XMIT)
|
||||
|
@ -123,11 +123,11 @@ ip_output(m0, opt, ro, flags, imo)
|
||||
struct mbuf *m = m0;
|
||||
int hlen = sizeof (struct ip);
|
||||
int len, off, error = 0;
|
||||
struct route iproute;
|
||||
struct sockaddr_in *dst;
|
||||
struct in_ifaddr *ia;
|
||||
int isbroadcast, sw_csum;
|
||||
#ifdef IPSEC
|
||||
struct route iproute;
|
||||
struct socket *so = NULL;
|
||||
struct secpolicy *sp = NULL;
|
||||
#endif
|
||||
@ -188,9 +188,6 @@ ip_output(m0, opt, ro, flags, imo)
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("ip_output no HDR");
|
||||
if (!ro)
|
||||
panic("ip_output no route, proto = %d",
|
||||
mtod(m, struct ip *)->ip_p);
|
||||
#endif
|
||||
if (opt) {
|
||||
m = ip_insertoptions(m, opt, &len);
|
||||
@ -213,6 +210,11 @@ ip_output(m0, opt, ro, flags, imo)
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
}
|
||||
|
||||
/* Route packet. */
|
||||
if (ro == NULL) {
|
||||
ro = &iproute;
|
||||
bzero(ro, sizeof(*ro));
|
||||
}
|
||||
dst = (struct sockaddr_in *)&ro->ro_dst;
|
||||
/*
|
||||
* If there is a cached route,
|
||||
|
Loading…
Reference in New Issue
Block a user