Deleted Added
full compact
pfkey.c (122107) pfkey.c (125681)
1/* $KAME: pfkey.c,v 1.46 2003/08/26 03:37:06 itojun Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
1/* $KAME: pfkey.c,v 1.46 2003/08/26 03:37:06 itojun Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/lib/libipsec/pfkey.c 122107 2003-11-05 09:41:23Z ume $");
33__FBSDID("$FreeBSD: head/lib/libipsec/pfkey.c 125681 2004-02-11 04:34:34Z bms $");
34
35#include <sys/types.h>
36#include <sys/param.h>
37#include <sys/socket.h>
38#include <net/pfkeyv2.h>
39#include <netkey/key_var.h>
40#include <netinet/in.h>
41#include <netinet6/ipsec.h>

--- 32 unchanged lines hidden (view full) ---

74static caddr_t pfkey_setsadbkey(caddr_t, caddr_t, u_int, caddr_t, u_int);
75static caddr_t pfkey_setsadblifetime(caddr_t, caddr_t, u_int, u_int32_t,
76 u_int32_t, u_int32_t, u_int32_t);
77static caddr_t pfkey_setsadbxsa2(caddr_t, caddr_t, u_int32_t, u_int32_t);
78
79/*
80 * make and search supported algorithm structure.
81 */
34
35#include <sys/types.h>
36#include <sys/param.h>
37#include <sys/socket.h>
38#include <net/pfkeyv2.h>
39#include <netkey/key_var.h>
40#include <netinet/in.h>
41#include <netinet6/ipsec.h>

--- 32 unchanged lines hidden (view full) ---

74static caddr_t pfkey_setsadbkey(caddr_t, caddr_t, u_int, caddr_t, u_int);
75static caddr_t pfkey_setsadblifetime(caddr_t, caddr_t, u_int, u_int32_t,
76 u_int32_t, u_int32_t, u_int32_t);
77static caddr_t pfkey_setsadbxsa2(caddr_t, caddr_t, u_int32_t, u_int32_t);
78
79/*
80 * make and search supported algorithm structure.
81 */
82static struct sadb_supported *ipsec_supported[] = { NULL, NULL, NULL, };
82static struct sadb_supported *ipsec_supported[] = { NULL, NULL, NULL, NULL };
83
84static int supported_map[] = {
85 SADB_SATYPE_AH,
86 SADB_SATYPE_ESP,
87 SADB_X_SATYPE_IPCOMP,
83
84static int supported_map[] = {
85 SADB_SATYPE_AH,
86 SADB_SATYPE_ESP,
87 SADB_X_SATYPE_IPCOMP,
88 SADB_X_SATYPE_TCPSIGNATURE
88};
89
90static int
91findsupportedmap(satype)
92 int satype;
93{
94 int i;
95

--- 1068 unchanged lines hidden (view full) ---

1164 __ipsec_errcode = EIPSEC_INVAL_ALGS;
1165 return -1;
1166 }
1167 if (a_type != SADB_AALG_NONE) {
1168 __ipsec_errcode = EIPSEC_NO_ALGS;
1169 return -1;
1170 }
1171 break;
89};
90
91static int
92findsupportedmap(satype)
93 int satype;
94{
95 int i;
96

--- 1068 unchanged lines hidden (view full) ---

1165 __ipsec_errcode = EIPSEC_INVAL_ALGS;
1166 return -1;
1167 }
1168 if (a_type != SADB_AALG_NONE) {
1169 __ipsec_errcode = EIPSEC_NO_ALGS;
1170 return -1;
1171 }
1172 break;
1173 case SADB_X_SATYPE_TCPSIGNATURE:
1174 if (e_type != SADB_EALG_NONE) {
1175 __ipsec_errcode = EIPSEC_INVAL_ALGS;
1176 return -1;
1177 }
1178 if (a_type != SADB_X_AALG_TCP_MD5) {
1179 __ipsec_errcode = EIPSEC_INVAL_ALGS;
1180 return -1;
1181 }
1182 break;
1172 default:
1173 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1174 return -1;
1175 }
1176
1177 /* create new sadb_msg to reply. */
1178 len = sizeof(struct sadb_msg)
1179 + sizeof(struct sadb_sa)

--- 194 unchanged lines hidden (view full) ---

1374 }
1375 break;
1376 default:
1377 switch (satype) {
1378 case SADB_SATYPE_UNSPEC:
1379 case SADB_SATYPE_AH:
1380 case SADB_SATYPE_ESP:
1381 case SADB_X_SATYPE_IPCOMP:
1183 default:
1184 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1185 return -1;
1186 }
1187
1188 /* create new sadb_msg to reply. */
1189 len = sizeof(struct sadb_msg)
1190 + sizeof(struct sadb_sa)

--- 194 unchanged lines hidden (view full) ---

1385 }
1386 break;
1387 default:
1388 switch (satype) {
1389 case SADB_SATYPE_UNSPEC:
1390 case SADB_SATYPE_AH:
1391 case SADB_SATYPE_ESP:
1392 case SADB_X_SATYPE_IPCOMP:
1393 case SADB_X_SATYPE_TCPSIGNATURE:
1382 break;
1383 default:
1384 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1385 return -1;
1386 }
1387 }
1388
1389 /* create new sadb_msg to send. */

--- 443 unchanged lines hidden (view full) ---

1833 case SADB_EXPIRE:
1834 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1835 return -1;
1836 }
1837 break;
1838 case SADB_SATYPE_ESP:
1839 case SADB_SATYPE_AH:
1840 case SADB_X_SATYPE_IPCOMP:
1394 break;
1395 default:
1396 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1397 return -1;
1398 }
1399 }
1400
1401 /* create new sadb_msg to send. */

--- 443 unchanged lines hidden (view full) ---

1845 case SADB_EXPIRE:
1846 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1847 return -1;
1848 }
1849 break;
1850 case SADB_SATYPE_ESP:
1851 case SADB_SATYPE_AH:
1852 case SADB_X_SATYPE_IPCOMP:
1853 case SADB_X_SATYPE_TCPSIGNATURE:
1841 switch (msg->sadb_msg_type) {
1842 case SADB_X_SPDADD:
1843 case SADB_X_SPDDELETE:
1844 case SADB_X_SPDGET:
1845 case SADB_X_SPDDUMP:
1846 case SADB_X_SPDFLUSH:
1847 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1848 return -1;

--- 264 unchanged lines hidden ---
1854 switch (msg->sadb_msg_type) {
1855 case SADB_X_SPDADD:
1856 case SADB_X_SPDDELETE:
1857 case SADB_X_SPDGET:
1858 case SADB_X_SPDDUMP:
1859 case SADB_X_SPDFLUSH:
1860 __ipsec_errcode = EIPSEC_INVAL_SATYPE;
1861 return -1;

--- 264 unchanged lines hidden ---