| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ipsec.c,v 1.60 2013/06/08 13:50:22 rmind Exp $ */ | | 1 | /* $NetBSD: ipsec.c,v 1.61 2013/12/24 13:57:06 degroote Exp $ */ |
2 | /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */ | | 2 | /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */ |
3 | /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */ | | 3 | /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 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: ipsec.c,v 1.60 2013/06/08 13:50:22 rmind Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.61 2013/12/24 13:57:06 degroote Exp $"); |
36 | | | 36 | |
37 | /* | | 37 | /* |
38 | * IPsec controller part. | | 38 | * IPsec controller part. |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include "opt_inet.h" | | 41 | #include "opt_inet.h" |
42 | #ifdef __FreeBSD__ | | 42 | #ifdef __FreeBSD__ |
43 | #include "opt_inet6.h" | | 43 | #include "opt_inet6.h" |
44 | #endif | | 44 | #endif |
45 | #include "opt_ipsec.h" | | 45 | #include "opt_ipsec.h" |
46 | | | 46 | |
47 | #include <sys/param.h> | | 47 | #include <sys/param.h> |
48 | #include <sys/systm.h> | | 48 | #include <sys/systm.h> |
| @@ -1601,27 +1601,27 @@ ipsec4_get_policy(struct inpcb *inp, con | | | @@ -1601,27 +1601,27 @@ ipsec4_get_policy(struct inpcb *inp, con |
1601 | if (len < sizeof(*xpl)) | | 1601 | if (len < sizeof(*xpl)) |
1602 | return EINVAL; | | 1602 | return EINVAL; |
1603 | xpl = (const struct sadb_x_policy *)request; | | 1603 | xpl = (const struct sadb_x_policy *)request; |
1604 | | | 1604 | |
1605 | /* select direction */ | | 1605 | /* select direction */ |
1606 | switch (xpl->sadb_x_policy_dir) { | | 1606 | switch (xpl->sadb_x_policy_dir) { |
1607 | case IPSEC_DIR_INBOUND: | | 1607 | case IPSEC_DIR_INBOUND: |
1608 | policy = inp->inp_sp->sp_in; | | 1608 | policy = inp->inp_sp->sp_in; |
1609 | break; | | 1609 | break; |
1610 | case IPSEC_DIR_OUTBOUND: | | 1610 | case IPSEC_DIR_OUTBOUND: |
1611 | policy = inp->inp_sp->sp_out; | | 1611 | policy = inp->inp_sp->sp_out; |
1612 | break; | | 1612 | break; |
1613 | default: | | 1613 | default: |
1614 | ipseclog((LOG_ERR, "ipsec4_set_policy: invalid direction=%u\n", | | 1614 | ipseclog((LOG_ERR, "ipsec4_get_policy: invalid direction=%u\n", |
1615 | xpl->sadb_x_policy_dir)); | | 1615 | xpl->sadb_x_policy_dir)); |
1616 | return EINVAL; | | 1616 | return EINVAL; |
1617 | } | | 1617 | } |
1618 | | | 1618 | |
1619 | return ipsec_get_policy(policy, mp); | | 1619 | return ipsec_get_policy(policy, mp); |
1620 | } | | 1620 | } |
1621 | | | 1621 | |
1622 | /* delete policy in PCB */ | | 1622 | /* delete policy in PCB */ |
1623 | int | | 1623 | int |
1624 | ipsec4_delete_pcbpolicy(struct inpcb *inp) | | 1624 | ipsec4_delete_pcbpolicy(struct inpcb *inp) |
1625 | { | | 1625 | { |
1626 | IPSEC_ASSERT(inp != NULL, ("ipsec4_delete_pcbpolicy: null inp")); | | 1626 | IPSEC_ASSERT(inp != NULL, ("ipsec4_delete_pcbpolicy: null inp")); |
1627 | | | 1627 | |