summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-12-03 19:56:21 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-12-03 19:56:21 +0000
commita8d33a63221e6e5131e09fc9d5c1673dabb83b27 (patch)
treeabed01a4fd433c03b9bc07757ef854bf3c5bead5 /sys
parentcc271649681349382b2db60ab265adecf4c749e8 (diff)
Fix fastroute-related panic, fixes PR 1541 (cas@trans-nt.com)
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_input.c9
-rw-r--r--sys/netinet/ip_output.c21
2 files changed, 23 insertions, 7 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index e02e11b7145..f6474023c70 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.60 2000/10/13 02:01:10 itojun Exp $ */
+/* $OpenBSD: ip_input.c,v 1.61 2000/12/03 19:56:20 angelos Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -420,6 +420,13 @@ ipv4_input(struct mbuf *m, ...)
#endif /* IPSEC */
return;
}
+ if (m0 == 0) { /* in case of 'fastroute' */
+#ifdef IPSEC
+ if (tdbi)
+ free (tdbi, M_TEMP);
+#endif /* IPSEC */
+ return;
+ }
ip = mtod(m = m0, struct ip *);
}
#endif
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index ec7ab4151fb..9be0faaaca9 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.84 2000/11/07 18:24:26 provos Exp $ */
+/* $OpenBSD: ip_output.c,v 1.85 2000/12/03 19:56:20 angelos Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -559,16 +559,21 @@ sendit:
error = EHOSTUNREACH;
splx(s);
goto done;
- } else {
- ip = mtod(m = m0, struct ip *);
- hlen = ip->ip_hl << 2;
}
+ if (m0 == 0) { /* in case of 'fastroute' */
+ error = 0;
+ splx(s);
+ goto done;
+ }
+ ip = mtod(m = m0, struct ip *);
+ hlen = ip->ip_hl << 2;
}
#endif /* IPFILTER */
tdb = gettdb(sspi, &sdst, sproto);
if (tdb == NULL) {
error = EHOSTUNREACH;
+ splx(s);
m_freem(m);
goto done;
}
@@ -599,8 +604,12 @@ sendit:
if (fr_checkp && (*fr_checkp)(ip, hlen, ifp, 1, &m0)) {
error = EHOSTUNREACH;
goto done;
- } else
- ip = mtod(m = m0, struct ip *);
+ }
+ if (m0 == 0) { /* in case of 'fastroute' */
+ error = 0;
+ goto done;
+ }
+ ip = mtod(m = m0, struct ip *);
}
#endif
/*