git: b19071bdff2d - stable/12 - ipsec: fix a logic error in key_do_getnewspi

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sun, 19 Dec 2021 14:46:07 UTC
The branch stable/12 has been updated by mjg:

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

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

    ipsec: fix a logic error in key_do_getnewspi
    
    (cherry picked from commit 509f1a0f405daf0e2bdaa5b366d21b77052149c3)
---
 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 d1119413f143..efe4ee519659 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -5064,7 +5064,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;