aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2002-04-15 17:12:05 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2002-04-15 17:12:05 +0000
commit41f6cb1ca21f2dbbc5f087aa46b2cb8021aef806 (patch)
tree30c16fb4ca8e514620e18e215aa69d3d4fbd7fe2 /sys
parent3080f4b7206f423b7b2b57b0029d544e5dde82a0 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_icmp.c4
-rw-r--r--sys/netinet/ip_mroute.c3
-rw-r--r--sys/netinet/ip_output.c10
3 files changed, 8 insertions, 9 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 86373ac2392e..6921a2521b4f 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -615,6 +615,8 @@ icmp_reflect(m)
}
t = ip->ip_dst;
ip->ip_dst = ip->ip_src;
+ ro = &rt;
+ bzero(ro, sizeof(*ro));
/*
* If the incoming packet was addressed directly to us,
* use dst as the src for the reply. Otherwise (broadcast
@@ -635,8 +637,6 @@ icmp_reflect(m)
goto match;
}
}
- ro = &rt;
- bzero(ro, sizeof(*ro));
ia = ip_rtaddr(ip->ip_dst, ro);
/* We need a route to do anything useful. */
if (ia == NULL) {
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 16198a1a5f53..7cf6a6a54bd3 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1890,6 +1890,7 @@ tbf_send_packet(vifp, m)
{
struct ip_moptions imo;
int error;
+ static struct route ro;
int s = splnet();
if (vifp->v_flags & VIFF_TUNNEL) {
@@ -1908,7 +1909,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, NULL,
+ error = ip_output(m, (struct mbuf *)0, &ro,
IP_FORWARDING, &imo);
if (mrtdebug & DEBUG_XMIT)
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 2fc9b0d5bb26..31e81acab3f1 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -124,11 +124,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 = NULL;
int isbroadcast, sw_csum;
#ifdef IPSEC
+ struct route iproute;
struct socket *so = NULL;
struct secpolicy *sp = NULL;
#endif
@@ -185,6 +185,9 @@ 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);
@@ -207,11 +210,6 @@ 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,