| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: key.c,v 1.123 2017/05/15 09:51:00 ozaki-r Exp $ */ | | 1 | /* $NetBSD: key.c,v 1.124 2017/05/15 09:52:05 ozaki-r Exp $ */ |
2 | /* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */ | | 2 | /* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */ |
3 | /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ | | 3 | /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | | 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 | * SUCH DAMAGE. | | 31 | * SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.123 2017/05/15 09:51:00 ozaki-r Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.124 2017/05/15 09:52:05 ozaki-r Exp $"); |
36 | | | 36 | |
37 | /* | | 37 | /* |
38 | * This code is referd to RFC 2367 | | 38 | * This code is referd to RFC 2367 |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #if defined(_KERNEL_OPT) | | 41 | #if defined(_KERNEL_OPT) |
42 | #include "opt_inet.h" | | 42 | #include "opt_inet.h" |
43 | #include "opt_ipsec.h" | | 43 | #include "opt_ipsec.h" |
44 | #include "opt_gateway.h" | | 44 | #include "opt_gateway.h" |
45 | #endif | | 45 | #endif |
46 | | | 46 | |
47 | #include <sys/types.h> | | 47 | #include <sys/types.h> |
48 | #include <sys/param.h> | | 48 | #include <sys/param.h> |
| @@ -3011,27 +3011,27 @@ key_newsav(struct mbuf *m, const struct | | | @@ -3011,27 +3011,27 @@ key_newsav(struct mbuf *m, const struct |
3011 | | | 3011 | |
3012 | /* reset created */ | | 3012 | /* reset created */ |
3013 | newsav->created = time_uptime; | | 3013 | newsav->created = time_uptime; |
3014 | newsav->pid = mhp->msg->sadb_msg_pid; | | 3014 | newsav->pid = mhp->msg->sadb_msg_pid; |
3015 | | | 3015 | |
3016 | /* add to satree */ | | 3016 | /* add to satree */ |
3017 | newsav->sah = sah; | | 3017 | newsav->sah = sah; |
3018 | newsav->refcnt = 1; | | 3018 | newsav->refcnt = 1; |
3019 | newsav->state = SADB_SASTATE_LARVAL; | | 3019 | newsav->state = SADB_SASTATE_LARVAL; |
3020 | LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav, | | 3020 | LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav, |
3021 | secasvar, chain); | | 3021 | secasvar, chain); |
3022 | done: | | 3022 | done: |
3023 | KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP, | | 3023 | KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP, |
3024 | "DP from %s:%u return SP:%p\n", where, tag, newsav); | | 3024 | "DP from %s:%u return SA:%p\n", where, tag, newsav); |
3025 | | | 3025 | |
3026 | return newsav; | | 3026 | return newsav; |
3027 | } | | 3027 | } |
3028 | | | 3028 | |
3029 | /* | | 3029 | /* |
3030 | * free() SA variable entry. | | 3030 | * free() SA variable entry. |
3031 | */ | | 3031 | */ |
3032 | static void | | 3032 | static void |
3033 | key_delsav(struct secasvar *sav) | | 3033 | key_delsav(struct secasvar *sav) |
3034 | { | | 3034 | { |
3035 | | | 3035 | |
3036 | KASSERT(sav != NULL); | | 3036 | KASSERT(sav != NULL); |
3037 | KASSERTMSG(sav->refcnt == 0, | | 3037 | KASSERTMSG(sav->refcnt == 0, |