KAME libipsec/libpfkey, 2003/08/26

This commit is contained in:
itojun 2003-08-26 03:25:29 +00:00
parent db3b5e3692
commit b5f8b9a7c0
4 changed files with 21 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $KAME: ipsec_dump_policy.c,v 1.12 2001/11/13 12:38:47 jinmei Exp $ */
/* $KAME: ipsec_dump_policy.c,v 1.13 2002/06/27 14:35:11 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@ -260,7 +260,7 @@ ipsec_dump_ipsecrequest(buf, len, xisr, bound)
ch = '#';
else
ch = ':';
snprintf(buf, len, "%s/%s/%s/%s%c%d", proto, mode, abuf, level,
snprintf(buf, len, "%s/%s/%s/%s%c%u", proto, mode, abuf, level,
ch, xisr->sadb_x_ipsecrequest_reqid);
}

View File

@ -1,4 +1,4 @@
.\" $KAME: ipsec_set_policy.3,v 1.15 2001/08/17 07:21:36 itojun Exp $
.\" $KAME: ipsec_set_policy.3,v 1.16 2003/01/06 21:59:03 sumikawa Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
.\" All rights reserved.
@ -76,7 +76,7 @@ Therefore,
can be regarded as inverse conversion of
.Fn ipsec_set_policy .
.Fa buf
points to a IPsec policy structure,
points to an IPsec policy structure,
.Li struct sadb_x_policy .
.Fa delim
is a delimiter string, which is usually a blank character.

View File

@ -1,4 +1,4 @@
/* $KAME: pfkey.c,v 1.40 2001/06/28 12:55:44 sakane Exp $ */
/* $KAME: pfkey.c,v 1.45 2003/08/26 03:24:20 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@ -703,11 +703,14 @@ pfkey_recv_register(so)
int error = -1;
/* receive message */
do {
for (;;) {
if ((newmsg = pfkey_recv(so)) == NULL)
return -1;
} while (newmsg->sadb_msg_type != SADB_REGISTER
|| newmsg->sadb_msg_pid != pid);
if (newmsg->sadb_msg_type == SADB_REGISTER &&
newmsg->sadb_msg_pid == pid)
break;
free(newmsg);
}
/* check and fix */
newmsg->sadb_msg_len = PFKEY_UNUNIT64(newmsg->sadb_msg_len);
@ -1759,6 +1762,9 @@ pfkey_align(msg, mhp)
case SADB_EXT_SPIRANGE:
case SADB_X_EXT_POLICY:
case SADB_X_EXT_SA2:
#ifdef SADB_X_EXT_TAG
case SADB_X_EXT_TAG:
#endif
mhp[ext->sadb_ext_type] = (caddr_t)ext;
break;
default:

View File

@ -1,4 +1,4 @@
/* $KAME: policy_parse.y,v 1.11 2001/08/31 09:44:18 itojun Exp $ */
/* $KAME: policy_parse.y,v 1.14 2003/06/27 03:39:20 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@ -84,6 +84,7 @@ static void policy_parse_request_init __P((void));
static caddr_t policy_parse __P((char *msg, int msglen));
extern void __policy__strbuffer__init__ __P((char *msg));
extern void __policy__strbuffer__free__ __P((void));
extern int yyparse __P((void));
extern int yylex __P((void));
@ -299,12 +300,14 @@ init_x_policy()
__ipsec_errcode = EIPSEC_NO_BUFS;
return -1;
}
memset(pbuf, 0, tlen);
p = (struct sadb_x_policy *)pbuf;
p->sadb_x_policy_len = 0; /* must update later */
p->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
p->sadb_x_policy_type = p_type;
p->sadb_x_policy_dir = p_dir;
p->sadb_x_policy_reserved = 0;
p->sadb_x_policy_id = 0;
offset = tlen;
__ipsec_errcode = EIPSEC_NO_ERROR;
@ -397,6 +400,8 @@ policy_parse(msg, msglen)
__policy__strbuffer__init__(msg);
error = yyparse(); /* it must be set errcode. */
__policy__strbuffer__free__();
if (error) {
if (pbuf != NULL)
free(pbuf);