summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-12-01 13:48:16 +0000
committerru <ru@FreeBSD.org>2001-12-01 13:48:16 +0000
commit5fcff41f8a2071b3a0e95fe3c7b0290c907407b0 (patch)
tree3d794089377ef4bb74a2f60b5e1862977fee39d2 /sys/netinet/ip_output.c
parentb3079d8ae1e568c43dbc59b7822d96301530c0cd (diff)
downloadFreeBSD-src-5fcff41f8a2071b3a0e95fe3c7b0290c907407b0.zip
FreeBSD-src-5fcff41f8a2071b3a0e95fe3c7b0290c907407b0.tar.gz
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.
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 304aa4d..ecf0faa 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -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,
OpenPOWER on IntegriCloud