Distinguish between retransmit ok and nothing to retransmit. This makes
authortobhe <tobhe@openbsd.org>
Wed, 21 Sep 2022 22:32:10 +0000 (22:32 +0000)
committertobhe <tobhe@openbsd.org>
Wed, 21 Sep 2022 22:32:10 +0000 (22:32 +0000)
sure ikes_retransmit_response events don't also increase the
ikes_msg_rcvd_busy counter.

ok markus@

sbin/iked/ikev2.c
sbin/iked/ikev2_msg.c

index 3f718b7..0e2fb5f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2.c,v 1.352 2022/09/19 20:54:02 tobhe Exp $       */
+/*     $OpenBSD: ikev2.c,v 1.353 2022/09/21 22:32:10 tobhe Exp $       */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -754,9 +754,10 @@ ikev2_recv(struct iked *env, struct iked_message *msg)
                        initiator = 0;
                /*
                 * See if we have responded to this request before
+                * For return values 0 and -1 we have.
                 */
                if ((r = ikev2_msg_retransmit_response(env, sa, msg,
-                   hdr->ike_exchange)) != 0) {
+                   hdr->ike_exchange)) != -2) {
                        if (r == -1) {
                                log_warn("%s: failed to retransmit a "
                                    "response", __func__);
index c36ba5a..96d1302 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2_msg.c,v 1.86 2022/09/19 20:54:02 tobhe Exp $    */
+/*     $OpenBSD: ikev2_msg.c,v 1.87 2022/09/21 22:32:11 tobhe Exp $    */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -1265,7 +1265,7 @@ ikev2_msg_retransmit_response(struct iked *env, struct iked_sa *sa,
 
        if ((mr = ikev2_msg_lookup(env, &sa->sa_responses, msg, exchange))
            == NULL)
-               return (0);
+               return (-2);    /* not found */
 
        TAILQ_FOREACH(m, &mr->mrt_frags, msg_entry) {
                if (sendtofrom(m->msg_fd, ibuf_data(m->msg_data),