git: 19592949abd2 - stable/13 - ipsec: fix a logic error in key_do_getnewspi

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

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

commit 19592949abd2953a3c00cda59231113d29d4dd63
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:44:52 +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 71eaac7f8fa3..b9d867a1d83a 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -5023,7 +5023,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;