summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2002-03-22 16:45:54 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2002-03-22 16:45:54 +0000
commite3f406b3c1f506c48f09fed9dc1588172a655465 (patch)
tree0af413607ca5eca2f6e2c8d42cb082903ea99317
parentdb512567072952a8939a1d11517492da4ee27230 (diff)
Notes
-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 c671a0a630ad..7042dd87c4b9 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -600,6 +600,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
@@ -620,8 +622,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 32493080fb60..4847b6d54c58 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1867,6 +1867,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) {
@@ -1885,7 +1886,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 d46d9842c9e7..f456456cfbd6 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -123,12 +123,12 @@ 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;
struct in_addr pkt_dst;
#ifdef IPSEC
+ struct route iproute;
struct socket *so = NULL;
struct secpolicy *sp = NULL;
#endif
@@ -189,6 +189,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);
@@ -214,11 +217,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,