diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-06-26 11:09:11 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-06-26 11:09:11 +0000 |
commit | d2604ec21a13bf5c800c90a1d4ddc39356ee6a2c (patch) | |
tree | b7139a5709ba67a1a552ad57b4330218a21d7b2d | |
parent | fd9397cf91d402020a102e6012f5a9fd9111cc26 (diff) |
improve ikev2_msg_retransmit_timeout
-rw-r--r-- | sbin/iked/ikev2_msg.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c index c70c4a53b36..622c6b2241b 100644 --- a/sbin/iked/ikev2_msg.c +++ b/sbin/iked/ikev2_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_msg.c,v 1.17 2012/06/26 11:00:28 mikeb Exp $ */ +/* $OpenBSD: ikev2_msg.c,v 1.18 2012/06/26 11:09:10 mikeb Exp $ */ /* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */ /* @@ -964,19 +964,21 @@ ikev2_msg_retransmit_timeout(struct iked *env, void *arg) struct iked_message *msg = arg; struct iked_sa *sa = msg->msg_sa; - if ((sendto(msg->msg_fd, ibuf_data(msg->msg_data), - ibuf_size(msg->msg_data), 0, - (struct sockaddr *)&msg->msg_peer, msg->msg_peerlen)) == -1) { - log_warn("%s: sendto", __func__); - sa_free(env, sa); - return; - } - if (msg->msg_tries < IKED_RETRANSMIT_TRIES) { + if ((sendto(msg->msg_fd, ibuf_data(msg->msg_data), + ibuf_size(msg->msg_data), 0, + (struct sockaddr *)&msg->msg_peer, + msg->msg_peerlen)) == -1) { + log_warn("%s: sendto", __func__); + sa_free(env, sa); + return; + } TAILQ_INSERT_TAIL(&sa->sa_requests, msg, msg_entry); /* Exponential timeout */ timer_register(env, &msg->msg_timer, IKED_RETRANSMIT_TIMEOUT * (2 << (msg->msg_tries++))); - } else + } else { + log_debug("%s: retransmit limit reached", __func__); sa_free(env, sa); + } } |