From f336206e49716e966e80b6a2fd042bc4886f242a Mon Sep 17 00:00:00 2001 From: tobhe Date: Wed, 21 Sep 2022 22:32:10 +0000 Subject: [PATCH] Distinguish between retransmit ok and nothing to retransmit. This makes sure ikes_retransmit_response events don't also increase the ikes_msg_rcvd_busy counter. ok markus@ --- sbin/iked/ikev2.c | 5 +++-- sbin/iked/ikev2_msg.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c index 3f718b7a186..0e2fb5f5f6f 100644 --- a/sbin/iked/ikev2.c +++ b/sbin/iked/ikev2.c @@ -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 @@ -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__); diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c index c36ba5a24f5..96d13026757 100644 --- a/sbin/iked/ikev2_msg.c +++ b/sbin/iked/ikev2_msg.c @@ -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 @@ -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), -- 2.20.1