Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Look up sav instead of relying on unstable sp->...
details: https://anonhg.NetBSD.org/src/rev/c8cec712310d
branches: trunk
changeset: 355213:c8cec712310d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Jul 19 06:31:54 2017 +0000
description:
Look up sav instead of relying on unstable sp->req->sav
This code is executed only in an error path so an additional lookup
doesn't matter.
diffstat:
sys/netipsec/ipsec.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r 9ff0626cd017 -r c8cec712310d sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c Wed Jul 19 06:30:32 2017 +0000
+++ b/sys/netipsec/ipsec.c Wed Jul 19 06:31:54 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.105 2017/07/19 06:30:32 ozaki-r Exp $ */
+/* $NetBSD: ipsec.c,v 1.106 2017/07/19 06:31:54 ozaki-r Exp $ */
/* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.105 2017/07/19 06:30:32 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.106 2017/07/19 06:31:54 ozaki-r Exp $");
/*
* IPsec controller part.
@@ -826,11 +826,15 @@
/*
* Find the correct route for outer IPv4 header, compute tunnel MTU.
*/
- if (sp->req && sp->req->sav) {
+ if (sp->req) {
struct route *ro;
struct rtentry *rt;
+ struct secasvar *sav = NULL;
- ro = &sp->req->sav->sah->sa_route;
+ error = key_checkrequest(sp->req, &sav);
+ if (error != 0)
+ return error;
+ ro = &sav->sah->sa_route;
rt = rtcache_validate(ro);
if (rt && rt->rt_ifp) {
*destmtu = rt->rt_rmx.rmx_mtu ?
@@ -838,6 +842,7 @@
*destmtu -= ipsechdr;
}
rtcache_unref(rt, ro);
+ KEY_FREESAV(&sav);
}
KEY_FREESP(&sp);
return 0;
Home |
Main Index |
Thread Index |
Old Index