NetBSD Problem Report #42606

From  Mon Jan 11 14:43:22 2010
Return-Path: <>
Received: from ( [])
	by (Postfix) with ESMTP id 0751763C503
	for <>; Mon, 11 Jan 2010 14:43:22 +0000 (UTC)
Message-Id: <>
Date: Mon, 11 Jan 2010 14:43:21 +0000 (UTC)
Subject: Netbsd-5 racoon: Multiple Phase2 SAs generated when NAT-T enabled
X-Send-Pr-Version: www-1.0

>Number:         42606
>Category:       kern
>Synopsis:       Netbsd-5 racoon: Multiple Phase2 SAs generated when NAT-T enabled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jnemeth
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 11 14:45:00 +0000 2010
>Last-Modified:  Sun Sep 23 19:15:03 +0000 2012
>Originator:     Daniel Zebralla
>Release:        NetBSD-5.0-release
A.P.E. GmbH
NetBSD GW-A 5.0_STABLE NetBSD 5.0_STABLE (GW-A_NB5) #11: Mon Jan  4 11:50:37 CET 2010  
zebralla@sirrug:/home/zebralla/GW-A/ i386
We tried to establish an IPsec-connection in tunnel-mode using two
netbsd-5 branch machines as gateways and racoon set for two scenarios:
Scenario 1: GWs directly connected via cross-link-cable, NAT-T forced
on in both racoons (option "nat_traversal force;")
Scenario 2: NAT-Box in between doing source-NAT on initiators' IP, NAT-T
set to on in both racoons  (option "nat_traversal on;")

Before, we used IPsec in aggressive mode without NAT-T. It works without problems.
As such, we think that NAT-T has a problem.

In both scenarios, when pings are sent from initiators' LAN to
responders' LAN, Phase1 (ISAKMP) is completed successfully, but Phase2
(IPsec) is "looping". This means that after a timeout, a (additional)
pair of Phase2-SAs is generated. The tunnel itself never gets usable for
data traffic.
This is also what we see with a more recent racoon (from NetBSD-
current) and without NAT-T, see PR kern/42592.

For config-files and some debug output please see the posting at ipsec-
tools-devel mailing list [1].

Use two netbsd-5 branch-systems for building an IPsec-connection in
tunnel-mode. One system is the passive responder, the other the active

Scenario 1:
Connect both systems via cross-link. Force NAT-T on in racoon and use

Scenario 2:
Connect both systems with a NAT-device in between, applying source-NAT
on initiators' IP. Set NAT-T to on in racoon and use aggressive-mode. 

See our racoon.conf- and ipsec.conf-files at [1].

No fix found, instead of not using NAT-T.


From: "S.P.Zeidler" <>
Subject: PR/42606 CVS commit: src/sys
Date: Sun, 5 Sep 2010 06:52:54 +0000

 Module Name:	src
 Committed By:	spz
 Date:		Sun Sep  5 06:52:54 UTC 2010

 Modified Files:
 	src/sys/net: pfkeyv2.h
 	src/sys/netipsec: key.c
 	src/sys/netkey: key.c

 Log Message:
 fix two bugs in the PFKEY interface:

 1) RFC2367 says in 2.3.3 Address Extension: "All non-address
    information in the sockaddrs, such as sin_zero for AF_INET sockaddrs,
    and sin6_flowinfo for AF_INET6 sockaddrs, MUST be zeroed out."
    the IPSEC_NAT_T code was expecting the port information it needs
    to be conveyed in the sockaddr instead of exclusively by
    and was not zeroing out the port information in the non-nat-traversal
    Since it was expecting the port information to reside in the sockaddr
    it could get away with (re)setting the ports after starting to use them.
    -> Set the natt ports before setting the SA mature.

 2) RFC3947 has two Original Address fields, initiator and responder,
    so we need SADB_X_EXT_NAT_T_OAI and SADB_X_EXT_NAT_T_OAR and not just

 The change has been created using vanhu's patch for FreeBSD as reference.

 Note that establishing actual nat-t sessions has not yet been tested.

 Likely fixes the following:
 PR bin/41757
 PR net/42592
 PR net/42606

 To generate a diff of this commit:
 cvs rdiff -u -r1.26 -r1.27 src/sys/net/pfkeyv2.h
 cvs rdiff -u -r1.63 -r1.64 src/sys/netipsec/key.c
 cvs rdiff -u -r1.177 -r1.178 src/sys/netkey/key.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-When: Sun, 26 Sep 2010 23:08:05 +0000
Did the commit help?

State-Changed-From-To: feedback->closed
State-Changed-When: Mon, 13 Aug 2012 20:44:53 +0000
in feedback for almost two years + feedback mail has started bouncing.
presume fixed.

Responsible-Changed-From-To: kern-bug-people->jnemeth
Responsible-Changed-When: Thu, 16 Aug 2012 21:10:01 +0000
Assign to myself to remind me to test this.

State-Changed-From-To: closed->open
State-Changed-When: Thu, 16 Aug 2012 21:10:01 +0000
Something in the back of my mind is telling me it hasn't been fixed.

From: (John Nemeth)
Subject: Re: kern/42606
Date: Tue, 21 Aug 2012 23:33:27 -0700

      I tested NAT-T with a NetBSD-current built yesterday against a
 Cisco router.  I can confirm that NAT-T still doesn't function.

From: Chuck Zmudzinski <>
Subject: Re: kern/42606
Date: Sun, 23 Sep 2012 14:11:16 -0500

 I did some tests today by forcing nat-t on a direct connection between
 two netbsd 5.0.2 virtual machines. First, I verified both tunnel mode
 and transport mode worked without nat-t, and then when I tried to do
 nat-t on transport mode, it worked fine and did not generate multiple
 SA's and I got a useful connection. It was only when I tried nat-t in
 tunnel mode that I saw this problem of multiple phase 2 SAs.

 Chuck Zmudzinski (an occasional NetBSD user)


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.