NetBSD Problem Report #59346
From www@netbsd.org Wed Apr 23 15:35:22 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 56BB01A9239
for <gnats-bugs@gnats.NetBSD.org>; Wed, 23 Apr 2025 15:35:22 +0000 (UTC)
Message-Id: <20250423153520.DFCCA1A923E@mollari.NetBSD.org>
Date: Wed, 23 Apr 2025 15:35:20 +0000 (UTC)
From: andrew.cagney@gmail.com
Reply-To: andrew.cagney@gmail.com
To: gnats-bugs@NetBSD.org
Subject: racoon's established IPsec-SA message reverses log polarity
X-Send-Pr-Version: www-1.0
>Number: 59346
>Category: bin
>Synopsis: racoon's established IPsec-SA message reverses log polarity
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 23 15:40:00 +0000 2025
>Originator: cagney
>Release: 10.1
>Organization:
>Environment:
NetBSD west 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
The machine 192.1.2.45:
vioif1: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=0x1<VLAN_MTU>
ec_enabled=0
address: 12:00:00:64:64:45
status: active
inet6 fe80::1000:ff:fe64:6445%vioif1/64 flags 0 scopeid 0x2
inet6 2001:db8:1:2::45/64 flags 0
inet 192.1.2.45/24 broadcast 192.1.2.255 flags 0
establishes an IPsec SA with the machine 192.1.2.23:
[root@west interop-racoon-10-aggr-initiator-ikev1]# racoonctl show-sa esp
192.1.2.23 192.1.2.45
esp mode=tunnel spi=255250(0x0003e512) reqid=0(0x00000000)
E: aes-cbc 488b0c0a 4350bb92 ea4bd669 86109375
A: hmac-sha1 bdf4f860 37bb2b09 5d950f94 29685420 9dbcc73e
seq=0x00000000 replay=4 flags=0x00000000 state=mature
created: Apr 23 15:16:00 2025 current: Apr 23 15:17:09 2025
diff: 69(s) hard: 43200(s) soft: 34560(s)
last: Apr 23 15:15:41 2025 hard: 0(s) soft: 0(s)
current: 0(bytes) hard: 0(bytes) soft: 0(bytes)
allocated: 0 hard: 0 soft: 0
sadb_seq=1 pid=1023 refcnt=0
192.1.2.45 192.1.2.23
esp mode=tunnel spi=1682472294(0x64487d66) reqid=0(0x00000000)
E: aes-cbc f15777c6 5ab30070 db458007 4f70e1c7
A: hmac-sha1 8a0238a9 2ca7dbab 2b47c692 e7f595d2 2664b455
seq=0x00000000 replay=4 flags=0x00000000 state=mature
created: Apr 23 15:16:00 2025 current: Apr 23 15:17:09 2025
diff: 69(s) hard: 43200(s) soft: 34560(s)
last: Apr 23 15:15:41 2025 hard: 0(s) soft: 0(s)
current: 0(bytes) hard: 0(bytes) soft: 0(bytes)
allocated: 0 hard: 0 soft: 0
sadb_seq=0 pid=1023 refcnt=0
looking carefully, at SRC, DST, and SPI, there's:
192.1.2.23 192.1.2.45 spi=255250(0x0003e512) inbound?
192.1.2.45 192.1.2.23 spi=1682472294(0x64487d66) outbound?
now compare that to the log messages emitted by racoon when things establish:
2025-04-23 15:15:59: INFO: initiate new phase 2 negotiation: 192.1.2.45[500]<=>192.1.2.23[500]
2025-04-23 15:15:59: INFO: IPsec-SA established: ESP/Tunnel 192.1.2.45[500]->192.1.2.23[500] spi=255250(0x3e512)
2025-04-23 15:15:59: INFO: IPsec-SA established: ESP/Tunnel 192.1.2.45[500]->192.1.2.23[500] spi=1682472294(0x64487d66)
note the `->`. The SPI is for 192.1.2.23->192.1.2.45, i.e., the reverse.
>How-To-Repeat:
>Fix:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.