summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-19 08:23:14 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-19 08:23:14 +0000
commit97c55638692ca49b78b34b6b09a24864767d8dd0 (patch)
tree6268187d7e7b8852529c87dc67918e9326b74726 /sys/netinet/ip_input.c
parent0a851c56f2f6d600c64a908b72be7e46e48faf62 (diff)
Instead of freeing a cached RTF_MPATH route after using it, free it
when the next packet needs to be forwarded, just like if the route was invalid. ok mikeb@, claudio@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 2dd0b36056c..4da9325a738 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.272 2016/04/18 12:10:34 mpi Exp $ */
+/* $OpenBSD: ip_input.c,v 1.273 2016/04/19 08:23:13 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1416,8 +1416,9 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt)
rtableid = m->m_pkthdr.ph_rtableid;
+ rt = ipforward_rt.ro_rt;
sin = satosin(&ipforward_rt.ro_dst);
- if ((rt = ipforward_rt.ro_rt) == NULL ||
+ if (rt == NULL || ISSET(rt->rt_flags, RTF_MPATH) ||
ip->ip_dst.s_addr != sin->sin_addr.s_addr ||
rtableid != ipforward_rt.ro_tableid) {
if (ipforward_rt.ro_rt) {
@@ -1500,7 +1501,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt)
goto freecopy;
}
if (!fake)
- goto freert;
+ return;
switch (error) {
@@ -1522,9 +1523,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt)
code = ICMP_UNREACH_NEEDFRAG;
#ifdef IPSEC
- if (ipforward_rt.ro_rt) {
- struct rtentry *rt = ipforward_rt.ro_rt;
-
+ if (rt != NULL) {
if (rt->rt_rmx.rmx_mtu)
destmtu = rt->rt_rmx.rmx_mtu;
else {
@@ -1563,15 +1562,6 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt)
freecopy:
if (fake)
m_tag_delete_chain(&mfake);
- freert:
-#ifndef SMALL_KERNEL
- if (ipmultipath && ipforward_rt.ro_rt &&
- (ipforward_rt.ro_rt->rt_flags & RTF_MPATH)) {
- rtfree(ipforward_rt.ro_rt);
- ipforward_rt.ro_rt = NULL;
- }
-#endif
- return;
}
int