summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-07-05 01:28:07 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-07-05 01:28:07 +0000
commit5cf939d711ef3abda3c3d47bd195a2ce56a54ec7 (patch)
tree60c304b4e8e0f31c4efb157e65372cc03768580e
parentc0d9a53f905d0a9ce26e6ac1b3ccd4079701dfa9 (diff)
Fix IKEV2_N_NO_ADDITIONAL_SAS notification by including the SPI
-rw-r--r--sbin/iked/ikev2.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c
index 3ab9684f8bf..2c130466445 100644
--- a/sbin/iked/ikev2.c
+++ b/sbin/iked/ikev2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2.c,v 1.56 2011/05/27 12:01:02 reyk Exp $ */
+/* $OpenBSD: ikev2.c,v 1.57 2011/07/05 01:28:06 mikeb Exp $ */
/* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */
/*
@@ -2228,6 +2228,8 @@ ikev2_resp_create_child_sa(struct iked *env, struct iked_message *msg)
struct ikev2_payload *pld;
struct ibuf *buf = NULL, *e = NULL, *nonce = NULL;
struct group *group;
+ u_int64_t spi64;
+ u_int32_t spi32;
ssize_t len = 0;
int initiator, protoid, rekeying = 1;
int ret = -1;
@@ -2294,8 +2296,18 @@ ikev2_resp_create_child_sa(struct iked *env, struct iked_message *msg)
return (-1);
}
n->n_protoid = protoid;
- n->n_spisize = 0;
+ n->n_spisize = rekey->spi_size;
n->n_type = htobe16(IKEV2_N_NO_ADDITIONAL_SAS);
+ switch (rekey->spi_size) {
+ case 4:
+ spi32 = htobe32(rekey->spi);
+ ibuf_add(buf, &spi32, rekey->spi_size);
+ break;
+ case 8:
+ spi64 = htobe64(rekey->spi);
+ ibuf_add(buf, &spi64, rekey->spi_size);
+ break;
+ }
ikev2_send_ike_e(env, sa, buf, IKEV2_PAYLOAD_NOTIFY,
IKEV2_EXCHANGE_CREATE_CHILD_SA, 1);
ibuf_release(buf);