netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [IPSEC] Too many SADs!
@ 2005-03-21 23:52 Wolfgang Walter
  2005-03-22 16:59 ` Stephen Frost
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Wolfgang Walter @ 2005-03-21 23:52 UTC (permalink / raw)
  To: netdev; +Cc: sfrost

We had the same problem. Seems to be a limitation of the pfkey-implementation 
of linux.

racoon and setkey both use the pfkey-interface.

We switched to iproute2 and openswan which both use the netfilter-interface. 
Therefor they can handle thousands of SAD and SPD rules.

Greetings,

Wolfgang Walter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [IPSEC] Too many SADs!
@ 2005-03-23 12:22 Wolfgang Walter
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Walter @ 2005-03-23 12:22 UTC (permalink / raw)
  To: netdev

> What, openswan uses PF_KEY last I checked on kernel 2.6.  I
> guess you can use KLIPS, but why would you? What's this
> "netfilter-interface" to ipsec code?
> 

Sorry, meant netlink-interface.

> I had the exact same problem the original poster had with
> Racoon.  SPDs would multiply without bounds, seemingly
> geometrically.

> I switched to strongswan and the problems immediately
> vanished.  There is some bug in racoon where it doesn't
> replace SPDs.  I used the latest ipsec-utils and kernel and
> this problem did not go away until I switched instead to
> strongswan (still using PF_KEY) (it also worked with
> openswan).

We don't use openswan with KLIPS but with native ipsec.

I'm rather sure that openswan 2.3.0 uses netlink with native ipsec - there is 
no pfkey-socket open when running pluto and pluto opens a netlink-socket.

Does not really matter. The problem of racoon is that it does a spd-dump when 
started. The kernel seems to run out of memory when generating such a huge 
pfkey-message.

The same is true for setkey. You can use it to add thousands of spd-rules but 
you may not dump (and so list) them (you can use iproute2 to check that 
setkey really added those entries).

So we use iproute2 to flush and list our spd and to set up static spd-rules 
(especially those for discard and none policies). We use pluto from openswan 
2.3.0 for IKE.

Greetings,

Wolfgang Walter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [IPSEC] Too many SADs!
@ 2005-03-23 12:20 Wolfgang Walter
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Walter @ 2005-03-23 12:20 UTC (permalink / raw)
  To: Stephen Frost; +Cc: netdev

> > We had the same problem. Seems to be a limitation of the 
pfkey-implementation 
> > of linux.
> > 
> > racoon and setkey both use the pfkey-interface.
> > 
> > We switched to iproute2 and openswan which both use the 
netfilter-interface. 

Sorry, wanted to say netlink-interface.

> > Therefor they can handle thousands of SAD and SPD rules.
> 

> Well, that's quite interesting.  I didn't realize there were multiple
> interfaces to the IPSEC in Linux.  Additionally, the problem isn't that
> I've got too many policies which end up requiring too many SADs- the
> problem is that SADs are being created above and beyond what's actually
> necessary for my policies, which is a problem.  I'm not entirely sure
> why that's happening either.  At one point a SAD was being added every
> second when there was *already* an apparently current SAD for the
> required policy.  Not good, looks like a bug to me, and I would have
> thought it was a kernel bug but I could be wrong there.

Hmm, we saw this with racoon, too.

I think that linux sometimes can not send pfkey-messages because it can not 
allocate enough memory in that moment. The message get lost and then racoon 
and kernel have different views of the situation. I think the pfkey-protocoll 
is unreliable by design so racoon should handle that.

If you start racoon with no spd-rules and then start to add a lot of them with 
setkey you get a similar behaviour: some of the new rules don't make it to 
racoon and racoon will never learn them. (we tried this as a workaround 
because racoon does not start when more than about 400 spd-rules are already 
set).

That racoon does not start with more then about 400 spd-rules seems to be also 
a problem of the pfkey-implementation: the pfkey-answer to the dump-request 
which racoons does at startup gets to large: the kernel can not allocate 
enough memory.

(and this is the reason setkey can not list the rules, either, so you may use 
it to add more spd-rules it can later list).

> 
> I'm certainly curious about the alternative interface to IPSEC in
> Linux, and especially your claim that it's a 'netfilter' interface.

As mentioned, meant netlink-interface, not netfilter.

> I'll certainly look into that...  What kernel are you using?  What
> version of iproute2 and Openswan?  Do you have to patch the kernel?
> 

iproute2 from debian unstable (20041019-3).

openswan from debian unstable: openswan 2.3.0 (debian version: 2.3.0-2)

>         Stephen
>

Greetings,

Wolfgang Walter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [IPSEC] Too many SADs!
@ 2005-03-21 14:52 Stephen Frost
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Frost @ 2005-03-21 14:52 UTC (permalink / raw)
  To: netdev

Greetings,

  This seems to be the right place for Linux 2.6 ipsec issues:

  Linux 2.6.10 + Virtual Server 1.9.4 + Patrick's IPSEC Netfilter patches
  i386 & amd64 (same source for both)
  Debian Racoon & ipsec-tools 0.5-4
  Setting policies using setkey (not using racoon-tool)
  Using both transport and tunnels

  Problem:

  ===# setkey -D | grep '^[0-9]' | wc -l
  recv: Resource temporarily unavailable
  443
  ===# setkey -D | grep mature | wc -l     
  recv: Resource temporarily unavailable
  443
  ===# setkey -D | grep tunnel | wc -l     
  recv: Resource temporarily unavailable
  18
  ===# setkey -D | grep transport | wc -l
  recv: Resource temporarily unavailable
  425
  ===# ps auwx | grep racoon
  root     17722  3.8  2.0 178268 168252 ?       Ss   Mar20  28:39 /usr/sbin/racoon
  ===# setkey -D -P | grep '^[0-9]' | wc -l
  34
  ===# setkey -D -P | grep transport | wc -l
  20
  ===# setkey -D -P | grep tunnel | wc -l   
  14

  I've seen the number of tunnel SADs go up a bunch too on another
  machine.  I see that there's been some changes in 2.6.11.3 (or so?)
  wrt IPSEC and __xfrm_state_find_acq_byseq(), would that likely fix
  this problem?  I don't tend to use /unique:x but rather /require; in
  my policies, would changing that fix this?  I had originally been
  using a /24 for my transport policy and thought changing that to be a
  bunch of /32 policies for the specific machines I'm talking to would
  help- it didn't.

  Occationally (generally when I first get ipsec going between a couple
  machines) I see pmtu problems which kill that ssh, but after that it
  works.  Not a big deal but I see alot of MTU discussion and patches,
  is that expected to be in 2.6.12?

  	Thanks for any help,

		Stephen

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

end of thread, other threads:[~2005-03-28 13:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-21 23:52 [IPSEC] Too many SADs! Wolfgang Walter
2005-03-22 16:59 ` Stephen Frost
2005-03-22 18:46   ` Michael Richardson
2005-03-22 19:11     ` Stephen Frost
2005-03-22 22:48 ` Scott Mcdermott
2005-03-23  0:33   ` Stephen Frost
2005-03-23  5:55     ` Scott Mcdermott
2005-03-28 13:33       ` Stephen Frost
2005-03-23  8:30 ` jean-mickael guerin
2005-03-23  9:57 ` KOVACS Krisztian
2005-03-23 18:15   ` Wolfgang Walter
  -- strict thread matches above, loose matches on Subject: below --
2005-03-23 12:22 Wolfgang Walter
2005-03-23 12:20 Wolfgang Walter
2005-03-21 14:52 Stephen Frost

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).