When we construct an answer for SADB_X_SPDGET, don't use an hardcoded 0 for seq but

the seq used by the request. It will improve consistency with the answer of SADB_GET
request and helps some applications which relies both on seq and pid.

Reported by  Karl Knutsson by pr/36119.
This commit is contained in:
degroote 2007-04-11 21:33:40 +00:00
parent 1cfe630356
commit 68c3173bb4
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.45 2007/04/11 21:19:35 degroote Exp $ */
/* $NetBSD: key.c,v 1.46 2007/04/11 21:33:41 degroote 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.45 2007/04/11 21:19:35 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.46 2007/04/11 21:33:41 degroote Exp $");
/*
* This code is referd to RFC 2367
@ -2262,7 +2262,8 @@ key_spdget(so, m, mhp)
return key_senderror(so, m, ENOENT);
}
n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid);
n = key_setdumpsp(sp, SADB_X_SPDGET, mhp->msg->sadb_msg_seq,
mhp->msg->sadb_msg_pid);
KEY_FREESP(&sp); /* ref gained by key_getspbyid */
if (n != NULL) {
m_freem(m);

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.154 2007/03/21 22:38:34 degroote Exp $ */
/* $NetBSD: key.c,v 1.155 2007/04/11 21:33:40 degroote Exp $ */
/* $KAME: key.c,v 1.310 2003/09/08 02:23:44 itojun Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.154 2007/03/21 22:38:34 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.155 2007/04/11 21:33:40 degroote Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -2179,7 +2179,8 @@ key_spdget(so, m, mhp)
return key_senderror(so, m, ENOENT);
}
n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid);
n = key_setdumpsp(sp, SADB_X_SPDGET, mhp->msg->sadb_msg_seq,
mhp->msg->sadb_msg_pid);
key_freesp(sp); /* ref gained by key_getspbyid */
if (n != NULL) {
m_freem(m);