Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Introduce KEY_SA_UNREF and replace KEY_FREESAV with it w...
details: https://anonhg.NetBSD.org/src/rev/f5032a93ef8f
branches: trunk
changeset: 355566:f5032a93ef8f
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Aug 03 06:32:51 2017 +0000
description:
Introduce KEY_SA_UNREF and replace KEY_FREESAV with it where sav will never be actually freed in the future
KEY_SA_UNREF is still key_freesav so no functional change for now.
This change reduces diff of further changes.
diffstat:
sys/netinet/tcp_input.c | 10 +++++-----
sys/netinet/tcp_output.c | 6 +++---
sys/netipsec/ipsec.c | 10 +++++-----
sys/netipsec/ipsec_input.c | 6 +++---
sys/netipsec/ipsec_netbsd.c | 12 ++++++------
sys/netipsec/ipsec_output.c | 16 ++++++++--------
sys/netipsec/key.c | 14 +++++++-------
sys/netipsec/key.h | 4 +++-
sys/netipsec/xform_ah.c | 16 ++++++++--------
sys/netipsec/xform_esp.c | 18 +++++++++---------
sys/netipsec/xform_ipcomp.c | 18 +++++++++---------
11 files changed, 66 insertions(+), 64 deletions(-)
diffs (truncated from 559 to 300 lines):
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netinet/tcp_input.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.359 2017/07/07 01:37:34 ozaki-r Exp $ */
+/* $NetBSD: tcp_input.c,v 1.360 2017/08/03 06:32:51 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.359 2017/07/07 01:37:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.360 2017/08/03 06:32:51 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3448,12 +3448,12 @@
TCP_STATINC(TCP_STAT_GOODSIG);
key_sa_recordxfer(sav, m);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
return 0;
out:
if (sav != NULL)
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
return -1;
#endif
}
@@ -4714,7 +4714,7 @@
if (sav) {
(void)tcp_signature(m, th, hlen, sav, sigp);
key_sa_recordxfer(sav, m);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
#endif
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netinet/tcp_output.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.196 2017/06/02 03:41:20 ozaki-r Exp $ */
+/* $NetBSD: tcp_output.c,v 1.197 2017/08/03 06:32:51 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.196 2017/06/02 03:41:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.197 2017/08/03 06:32:51 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1505,7 +1505,7 @@
tcp_signature(m, th, (char *)th - mtod(m, char *), sav, sigp);
key_sa_recordxfer(sav, m);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
#endif
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netipsec/ipsec.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.115 2017/08/02 04:03:28 ozaki-r Exp $ */
+/* $NetBSD: ipsec.c,v 1.116 2017/08/03 06:32:51 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.115 2017/08/02 04:03:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.116 2017/08/03 06:32:51 ozaki-r Exp $");
/*
* IPsec controller part.
@@ -815,7 +815,7 @@
*destmtu -= ipsechdr;
}
rtcache_unref(rt, ro);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
KEY_SP_UNREF(&sp);
return 0;
@@ -1911,7 +1911,7 @@
error = key_checkrequest(isr, &sav);
if (error == 0) {
clen = esp_hdrsiz(sav);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
} else
clen = esp_hdrsiz(NULL);
break;
@@ -1919,7 +1919,7 @@
error = key_checkrequest(isr, &sav);
if (error == 0) {
clen = ah_hdrsiz(sav);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
} else
clen = ah_hdrsiz(NULL);
break;
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netipsec/ipsec_input.c
--- a/sys/netipsec/ipsec_input.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netipsec/ipsec_input.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_input.c,v 1.50 2017/08/03 04:42:26 ozaki-r Exp $ */
+/* $NetBSD: ipsec_input.c,v 1.51 2017/08/03 06:32:51 ozaki-r Exp $ */
/* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $ */
/* $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $ */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.50 2017/08/03 04:42:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.51 2017/08/03 06:32:51 ozaki-r Exp $");
/*
* IPsec input processing.
@@ -288,7 +288,7 @@
* everything else.
*/
error = (*sav->tdb_xform->xf_input)(m, sav, skip, protoff);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
splx(s);
return error;
}
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netipsec/ipsec_netbsd.c
--- a/sys/netipsec/ipsec_netbsd.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netipsec/ipsec_netbsd.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_netbsd.c,v 1.44 2017/07/07 01:37:34 ozaki-r Exp $ */
+/* $NetBSD: ipsec_netbsd.c,v 1.45 2017/08/03 06:32:51 ozaki-r Exp $ */
/* $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $ */
/* $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.44 2017/07/07 01:37:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.45 2017/08/03 06:32:51 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -123,7 +123,7 @@
offsetof(struct icmp, icmp_ip));
icmp_mtudisc(icp, ip->ip_dst);
}
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
}
return NULL;
@@ -168,7 +168,7 @@
offsetof(struct icmp, icmp_ip));
icmp_mtudisc(icp, ip->ip_dst);
}
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
}
return NULL;
@@ -237,7 +237,7 @@
if (sav) {
if (SADB_SASTATE_USABLE_P(sav))
valid++;
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
/* XXX Further validation? */
@@ -342,7 +342,7 @@
if (sav) {
if (SADB_SASTATE_USABLE_P(sav))
valid++;
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
}
/* XXX Further validation? */
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netipsec/ipsec_output.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_output.c,v 1.57 2017/07/27 06:59:28 ozaki-r Exp $ */
+/* $NetBSD: ipsec_output.c,v 1.58 2017/08/03 06:32:51 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.57 2017/07/27 06:59:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.58 2017/08/03 06:32:51 ozaki-r Exp $");
/*
* IPsec output processing.
@@ -428,7 +428,7 @@
" to policy (check your sysctls)\n");
IPSEC_OSTAT(PDROPS);
*error = EHOSTUNREACH;
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
goto bad;
}
@@ -491,7 +491,7 @@
if (ntohs(ip->ip_len) <= sav->esp_frag)
goto noneed;
*mtu = sav->esp_frag;
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
splx(s);
return 0;
}
@@ -605,11 +605,11 @@
} else {
error = ipsec_process_done(m, isr, sav);
}
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
splx(s);
return error;
unrefsav:
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
bad:
splx(s);
if (m)
@@ -791,11 +791,11 @@
compute_ipsec_pos(m, &i, &off);
}
error = (*sav->tdb_xform->xf_output)(m, isr, sav, NULL, i, off);
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
splx(s);
return error;
unrefsav:
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
bad:
splx(s);
if (m)
diff -r b44a35dd2e82 -r f5032a93ef8f sys/netipsec/key.c
--- a/sys/netipsec/key.c Thu Aug 03 06:31:58 2017 +0000
+++ b/sys/netipsec/key.c Thu Aug 03 06:32:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.205 2017/08/03 06:31:58 ozaki-r Exp $ */
+/* $NetBSD: key.c,v 1.206 2017/08/03 06:32:51 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.205 2017/08/03 06:31:58 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.206 2017/08/03 06:32:51 ozaki-r Exp $");
/*
* This code is referd to RFC 2367
@@ -3147,7 +3147,7 @@
continue;
sav = key_getsavbyspi(sah, spi);
if (sav != NULL) {
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
return true;
}
}
@@ -5439,7 +5439,7 @@
return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
}
error:
- KEY_FREESAV(&sav);
+ KEY_SA_UNREF(&sav);
return key_senderror(so, m, error);
}
@@ -5580,7 +5580,7 @@
/* We can create new SA only if SPI is differenct. */
sav = key_getsavbyspi(sah, sa0->sadb_sa_spi);
if (sav != NULL) {
- KEY_FREESAV(&sav);
Home |
Main Index |
Thread Index |
Old Index