netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* when having to acquire an SA, ipsec drops the packet
@ 2007-02-01 22:51 Joy Latten
  2007-02-01 23:44 ` James Morris
  0 siblings, 1 reply; 17+ messages in thread
From: Joy Latten @ 2007-02-01 22:51 UTC (permalink / raw)
  To: netdev; +Cc: paul.moore, vyekkirala, jmorris, herbert, davem

IPsec returns EAGAIN when it needs to acquire an SA.
There have been a thread or two about this...
Has there been any info or progress in how best to fix this?

James Morris presented some work/ideas,
http://vger.kernel.org/jmorris_ipsec_sa_resolution_netconf2006.pdf

When using labeled xfrms (xfrms that contain a security context), there
is potential for a greater amount of SAs to be created than when using
regular xfrms. An SA may be created every time a different security
context is encountered in a particular traffic stream. This could be
many if each networking app has its own security context, making current
behavior problematic.

Bugreport 225328 has been opened in the Redhat Bugzilla to address
when having to acquire an SA, ipsec drops the packet.

Regards,
Joy


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: when having to acquire an SA, ipsec drops the packet
@ 2007-02-07 16:33 Joy Latten
  0 siblings, 0 replies; 17+ messages in thread
From: Joy Latten @ 2007-02-07 16:33 UTC (permalink / raw)
  To: davem; +Cc: herbert, jmorris, netdev, paul.moore, vyekkirala

>From: Joy Latten <latten@austin.ibm.com>
>Date: Mon, 05 Feb 2007 14:53:39 -0600
>
>> I can run some tests with this patch and report any results... 
>
>Please check out the two most recent patches I posted:
>
>1) Updated core patch with ipv6 side added.
>2) Fix for thinko noticed by Venkat.

Just a quick update. I have patched an lspp kernel and 
latest kernel.org kernel. I have been using them alternately
while doing some minor testing and have not found any problems.
Over the next few days, I plan to run a few stress tests for 
labeled ipsec and regular ipsec and will do so with the patched
lspp kernel.  I will also try with kernel.org kernel.
It may take a few days. 

Regards,
Joy

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: when having to acquire an SA, ipsec drops the packet
@ 2007-03-06  1:47 Joy Latten
  2007-03-06  3:21 ` James Morris
  0 siblings, 1 reply; 17+ messages in thread
From: Joy Latten @ 2007-03-06  1:47 UTC (permalink / raw)
  To: davem; +Cc: herbert, jmorris, netdev, paul.moore, vyekkirala

>From: Joy Latten <latten@austin.ibm.com>
>Date: Mon, 05 Feb 2007 14:53:39 -0600
>
>> I can run some tests with this patch and report any results... 
>
>Please check out the two most recent patches I posted:
>
>1) Updated core patch with ipv6 side added.
>2) Fix for thinko noticed by Venkat.

I have been testing this a lot in the lspp kernel.
Plan to test also in upstream kernel.
I am seeing a second ACQUIRE occur while establishing the SAs.

My scenario:
My policy states to use both the ESP and AH protocols (may not
make much sense but this was for testing purposes).  I get double 
SAs with only difference being SPI.

Here is what I see happening... 

1. Trigger first ACQUIRE via ping or netperf.

2. xfrm_lookup() calls xfrm_tmpl_resolv() who calls xfrm_state_find().
   First time around, we need to establish SA, so a minimal SA
   get allocated and put in SAD, timer is set for the minimal SA
   to be ACQUIRED and km_query() gets called.
   
3. xfrm_tmpl_resolv() returns -EAGAIN causing add_wait_queue(&km_waitq, &wait)
   and proceeding code to get called waiting for SA to be established.
   As long as the minimal SA with XFRM_STATE_ACQUIRE is in SAD,
   we keep waiting...
   
4. First set of SAs (one for AH and ESP) for IN direction get inserted in SAD.
 
5. Around the time the set of SAs for OUT direction are to be
   inserted into SAD, I see another ACQUIRE happening.
   
   I have not yet figured out where this second ACQUIRE comes from
   and why it happens. As long as the minimal SA or set of valid outgoing
   SAs exist in SAD, an ACQUIRE should not happen.
   The minimal SA does not get removed from the SAD until the set 
   of SAs for OUT get added and the xfrm_state_lock
   released. And the lock pretty much guarantees no one else can step
   through the SAD until after new SAs are being added...
   and if someone gets the lock to step though SAD before OUT SAs
   are added, minimal SA is still there... 

 6. Since this second ACQUIRE was able to happen, result is identical
    sets of SAs for the traffic stream. SPIs are only difference.
 
 7. Noticed something while pasting log info below.
    Perhaps when outgoing AH SA is added, wake_up(&km_waitq) gets called, 
    lock released, and minimal SA deleted (xfrm_state_add()), 
    xfrm_tmpl_resolv() is called and it looks first for the outgoing
    ESP SA. Since it is not there yet and no minimal SA, then km_query()
    results in an ACQUIRE just before the outgoing ESP SA gets added.

    It would explain why I only see it when both ESP and AH are specified...
    that is if I am thinking correctly... 

Regards,
Joy Latten

>From my log file:

Mar  5 19:10:02 racoon: INFO: initiate new phase 2 negotiation: 9.3.192.210[500]<=>9.3.189.55[500]
Mar  5 19:10:03 racoon: INFO: IPsec-SA established: AH/Transport 9.3.189.55[0]->9.3.192.210[0] spi=137942922(0x838d78a)
Mar  5 19:10:03 racoon: INFO: IPsec-SA established: ESP/Transport 9.3.189.55[0]->9.3.192.210[0] spi=244321490(0xe900cd2)
Mar  5 19:10:03 racoon: INFO: IPsec-SA established: AH/Transport 9.3.192.210[0]->9.3.189.55[0] spi=38721750(0x24ed8d6)
Mar  5 19:10:03 racoon: INFO: initiate new phase 2 negotiation: 9.3.192.210[500]<=>9.3.189.55[500]
Mar  5 19:10:03 racoon: INFO: IPsec-SA established: ESP/Transport 9.3.192.210[0]->9.3.189.55[0] spi=265079770(0xfcccbda)
Mar  5 19:10:05 racoon: INFO: IPsec-SA established: AH/Transport 9.3.189.55[0]->9.3.192.210[0] spi=108627618(0x67986a2)
Mar  5 19:10:05 racoon: INFO: IPsec-SA established: ESP/Transport 9.3.189.55[0]->9.3.192.210[0] spi=182973856(0xae7f5a0)
Mar  5 19:10:05 racoon: INFO: IPsec-SA established: AH/Transport 9.3.192.210[0]->9.3.189.55[0] spi=58486297(0x37c6e19)
Mar  5 19:10:05 racoon: INFO: IPsec-SA established: ESP/Transport 9.3.192.210[0]->9.3.189.55[0] spi=268295215(0xffddc2f)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-03-06 19:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 22:51 when having to acquire an SA, ipsec drops the packet Joy Latten
2007-02-01 23:44 ` James Morris
2007-02-02 15:30   ` Paul Moore
2007-02-05  4:53   ` David Miller
2007-02-05 16:33     ` James Morris
2007-02-05 20:34       ` James Morris
2007-02-05 21:07         ` David Miller
2007-02-05 20:49     ` Venkat Yekkirala
2007-02-05 21:11       ` David Miller
2007-02-05 20:53     ` Joy Latten
2007-02-05 21:13       ` David Miller
2007-02-05 20:52   ` Joy Latten
  -- strict thread matches above, loose matches on Subject: below --
2007-02-07 16:33 Joy Latten
2007-03-06  1:47 Joy Latten
2007-03-06  3:21 ` James Morris
2007-03-06 17:14   ` Joy Latten
2007-03-06 19:40     ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).