diff options
author | 2012-05-24 14:41:36 +0000 | |
---|---|---|
committer | 2012-05-24 14:41:36 +0000 | |
commit | 10650a52ec2c907f752659b960b3026510ed1ba3 (patch) | |
tree | 73128ce9567b76021abfeceace2a4d1a9f5f075d | |
parent | Move this modem to the list of supported devices. Tested by myself. (diff) | |
download | wireguard-openbsd-10650a52ec2c907f752659b960b3026510ed1ba3.tar.xz wireguard-openbsd-10650a52ec2c907f752659b960b3026510ed1ba3.zip |
don't increment the next expected message id when sending a response back.
while it might look like a step backwards, this fixes up eap negotiation
and bigger changes to this code are in the pipe anyways.
-rw-r--r-- | sbin/iked/ikev2_msg.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c index b06c6a414f7..228f0ec61b1 100644 --- a/sbin/iked/ikev2_msg.c +++ b/sbin/iked/ikev2_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_msg.c,v 1.13 2012/05/07 10:58:38 mikeb Exp $ */ +/* $OpenBSD: ikev2_msg.c,v 1.14 2012/05/24 14:41:36 mikeb Exp $ */ /* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */ /* @@ -255,14 +255,17 @@ ikev2_msg_send(struct iked *env, int fd, struct iked_message *msg) u_int32_t ikev2_msg_id(struct iked *env, struct iked_sa *sa, int response) { - u_int32_t *id; + u_int32_t id; - id = response ? &sa->sa_msgid : &sa->sa_reqid; - if (++*id == UINT32_MAX) { + if (response) + return (sa->sa_msgid); + + id = sa->sa_reqid; + if (++sa->sa_reqid == UINT32_MAX) { /* XXX we should close and renegotiate the connection now */ log_debug("%s: IKEv2 message sequence overflow", __func__); } - return (*id - 1); + return (id); } struct ibuf * |