git: 509f1a0f405d - main - ipsec: fix a logic error in key_do_getnewspi

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Tue, 14 Dec 2021 19:31:02 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=509f1a0f405daf0e2bdaa5b366d21b77052149c3

commit 509f1a0f405daf0e2bdaa5b366d21b77052149c3
Author:     Wenfeng Liu <266lwf@163.com>
AuthorDate: 2021-11-24 09:34:32 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-12-14 19:30:42 +0000

    ipsec: fix a logic error in key_do_getnewspi
---
 sys/netipsec/key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 4eb4c7c76464..9b3d10e28902 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -5055,7 +5055,7 @@ key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx)
 	}
 
 	if (min == max) {
-		if (!key_checkspidup(htonl(min))) {
+		if (key_checkspidup(htonl(min))) {
 			ipseclog((LOG_DEBUG, "%s: SPI %u exists already.\n",
 			    __func__, min));
 			return 0;