From: Yurij M. Plotnikov <hidden> Date: 2012-12-19 13:20:30
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
This can be reproduced with 3 hosts configuration. Let it be the hosts:
host_A, host_B and host _C. host_A via interface eth1 connected with
host_B via intefaces eth1. Let host_C via interface eth1 connected with
host_B via interface eth2. Also Lets address 10.0.1.1/24 is assigned to
eth1 on host_A; 10.0.1.2/24 is assigned to eth1 on host_B; 10.0.2.1/24
is assigned to eth2 on host_B; 10.0.2.2/24 is assigned to eth1 on
host_C. Also there are two routes: "10.0.2.2 via 10.0.1.2 dev eth1" on
host_A and "10.0.1.1 via 10.0.2.1 dev eth1" on host_C. Also forwarding
is on on host_B. So we have the following picture:
host_A-eth1(10.0.1.1)<-->(10.0.1.2)eth1-host_B-eth2(10.0.2.1)<-->(10.0.2.2)eth1-host_C
MTU is equal to 1500 on all involved interfaces. Then we make the
followign steps:
on host_A:
1. socket(SOCK_DGRAM) -> 6
2. bind(6, 10.0.1.1:25630) -> 0
on host_C:
3. socket(SOCK_DGRAM) -> 5
4. bind(5, 10.0.2.2:25631) -> 0
on host_A:
5. connect(6, 10.0.2.2:25631) -> 0
on host_C:
6. connect(5, 10.0.1.1:25630) -> 0
on host_A
7. getsockopt(6,IP_MTU) -> 0 // Returns that MTU is 1500
8. getsockopt(6,IP_MTU_DISCOVER) -> 0 // Returns that default value is
IP_PMTUDISC_WANT
On eth2 on host_B and on eth1 on host_C change MTU from 1500 to 750.
Wait for a while.
9. send(6, lenght=1400) -> 1400 // the packet is sent with "Don't
Fragment" bit, tcpdump on eth1 on host_B shows it
10. sleep(5);
11. send(6, length=1400) -> -1 with EMSGSIZE
12. sleep(5);
13. getsockopt(6,IP_MTU) -> 0 // Returns that MTU is 1500 once again. So
value is not updated.
14. send(6, lenght=1400) -> 1400 // the packet one again is sent with
"Don't Fragment" bit, tcpdump on eth1 on host_B shows it
So "Don't Fragment" bit is always set for the packets in case when value
of IP_MTU_DISCOVER is IP_PMTUDISC_WANT. If at step 8 we change
IP_MTU_DISCOVER value from IP_PMTUDISC_WANT to IP_PMTUDISC_DO we have
the same picture. The value of IP_MTU socket options is still 1500 at
step 13 in this case.
From: Ben Hutchings <hidden> Date: 2012-12-19 13:35:23
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert [off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
[...]
On eth2 on host_B and on eth1 on host_C change MTU from 1500 to 750.
Wait for a while.
9. send(6, lenght=1400) -> 1400 // the packet is sent with "Don't
Fragment" bit, tcpdump on eth1 on host_B shows it
10. sleep(5);
11. send(6, length=1400) -> -1 with EMSGSIZE
12. sleep(5);
13. getsockopt(6,IP_MTU) -> 0 // Returns that MTU is 1500 once again. So
value is not updated.
[...]
What if you read this option immediately before the sleep(5)?
Ben.
From: Yurij M. Plotnikov <hidden> Date: 2012-12-19 14:27:35
On 12/19/12 17:35, Ben Hutchings wrote:
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
quoted
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert[off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
With reverted commit there is no such problem on 3.7.1: IP_MTU is
updated and DF is set only for the first packet in case of
IP_PMTUDISC_WANT.
[...]
quoted
On eth2 on host_B and on eth1 on host_C change MTU from 1500 to 750.
Wait for a while.
9. send(6, lenght=1400) -> 1400 // the packet is sent with "Don't
Fragment" bit, tcpdump on eth1 on host_B shows it
10. sleep(5);
11. send(6, length=1400) -> -1 with EMSGSIZE
12. sleep(5);
13. getsockopt(6,IP_MTU) -> 0 // Returns that MTU is 1500 once again. So
value is not updated.
[...]
What if you read this option immediately before the sleep(5)?
From: Ben Hutchings <hidden> Date: 2012-12-19 19:37:48
On Wed, 2012-12-19 at 18:27 +0400, Yurij M. Plotnikov wrote:
On 12/19/12 17:35, Ben Hutchings wrote:
quoted
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
quoted
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert[off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
With reverted commit there is no such problem on 3.7.1: IP_MTU is
updated and DF is set only for the first packet in case of
IP_PMTUDISC_WANT.
[...]
So it looks like something is going wrong with the expiry calculation
here.
This change shouldn't affect the PMTU actually used by the kernel, but
could affect Onload since that relies on netlink route updates to keep
in synch. You didn't say you were using Onload, but if you are then we
should not bother netdev with this until we can demonstrate a problem
that involves only the kernel stack.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Yurij M. Plotnikov <hidden> Date: 2012-12-20 07:14:16
On 12/19/12 23:37, Ben Hutchings wrote:
On Wed, 2012-12-19 at 18:27 +0400, Yurij M. Plotnikov wrote:
quoted
On 12/19/12 17:35, Ben Hutchings wrote:
quoted
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
quoted
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert[off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
With reverted commit there is no such problem on 3.7.1: IP_MTU is
updated and DF is set only for the first packet in case of
IP_PMTUDISC_WANT.
[...]
So it looks like something is going wrong with the expiry calculation
here.
This change shouldn't affect the PMTU actually used by the kernel, but
could affect Onload since that relies on netlink route updates to keep
in synch. You didn't say you were using Onload, but if you are then we
should not bother netdev with this until we can demonstrate a problem
that involves only the kernel stack.
The results were obtained on pure Linux kernel without using Onload.
Yurij.
On Wed, Dec 19, 2012 at 07:37:44PM +0000, Ben Hutchings wrote:
On Wed, 2012-12-19 at 18:27 +0400, Yurij M. Plotnikov wrote:
quoted
On 12/19/12 17:35, Ben Hutchings wrote:
quoted
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
quoted
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert[off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
With reverted commit there is no such problem on 3.7.1: IP_MTU is
updated and DF is set only for the first packet in case of
IP_PMTUDISC_WANT.
[...]
So it looks like something is going wrong with the expiry calculation
here.
This change shouldn't affect the PMTU actually used by the kernel, but
could affect Onload since that relies on netlink route updates to keep
in synch. You didn't say you were using Onload, but if you are then we
should not bother netdev with this until we can demonstrate a problem
that involves only the kernel stack.
I'm really surprised that this change can have such an effect,
it changes nothing at the kernels pmtu handling. When looking
at the code, I found that we may report a mtu value from a stale
dst_entry when we query the mtu value with the IP_MTU socket
option. But a subsequent send() should update the socket cached
dst_entry, so at most one packet should be affected.
Does the patch below change anything?
@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,{structdst_entry*dst;val=0;-dst=sk_dst_get(sk);+dst=sk_dst_check(sk,0);if(dst){val=dst_mtu(dst);dst_release(dst);
From: Yurij M. Plotnikov <hidden> Date: 2012-12-20 11:22:24
On 12/20/12 11:34, Steffen Klassert wrote:
quoted hunk
On Wed, Dec 19, 2012 at 07:37:44PM +0000, Ben Hutchings wrote:
quoted
On Wed, 2012-12-19 at 18:27 +0400, Yurij M. Plotnikov wrote:
quoted
On 12/19/12 17:35, Ben Hutchings wrote:
quoted
On Wed, 2012-12-19 at 17:10 +0400, Yurij M. Plotnikov wrote:
quoted
On kernel 3.7.1 I get strange behaviour of IP_MTU_DISCOVER socket
option. The behaviour in case of IP_PMTUDISC_DO and IP_PMTUDISC_WANT
values of IP_MTU_DISCOVER socket option on SOCK_DGRAM socket are the
same and packet is always sent with "Don't Fragment" bit in case of
IP_PMTUDISC_WANT. Also, the value of IP_MTU socket option is not updated.
You could try reverting:
commit ee9a8f7ab2edf801b8b514c310455c94acc232f6
Author: Steffen Klassert[off-list ref]
Date: Mon Oct 8 00:56:54 2012 +0000
ipv4: Don't report stale pmtu values to userspace
We report cached pmtu values even if they are already expired.
Change this to not report these values after they are expired
and fix a race in the expire time calculation, as suggested by
Eric Dumazet.
Still, PMTU information is not supposed to expire for 10 minutes...
With reverted commit there is no such problem on 3.7.1: IP_MTU is
updated and DF is set only for the first packet in case of
IP_PMTUDISC_WANT.
[...]
So it looks like something is going wrong with the expiry calculation
here.
This change shouldn't affect the PMTU actually used by the kernel, but
could affect Onload since that relies on netlink route updates to keep
in synch. You didn't say you were using Onload, but if you are then we
should not bother netdev with this until we can demonstrate a problem
that involves only the kernel stack.
I'm really surprised that this change can have such an effect,
it changes nothing at the kernels pmtu handling. When looking
at the code, I found that we may report a mtu value from a stale
dst_entry when we query the mtu value with the IP_MTU socket
option. But a subsequent send() should update the socket cached
dst_entry, so at most one packet should be affected.
Does the patch below change anything?
@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,{structdst_entry*dst;val=0;-dst=sk_dst_get(sk);+dst=sk_dst_check(sk,0);if(dst){val=dst_mtu(dst);dst_release(dst);
With this patch kernel 3.7.1 works perfect. All described problems are
fixed.
@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,{structdst_entry*dst;val=0;-dst=sk_dst_get(sk);+dst=sk_dst_check(sk,0);if(dst){val=dst_mtu(dst);dst_release(dst);
With this patch kernel 3.7.1 works perfect. All described problems
are fixed.
Thanks for testing!
I'm not sure if we can't use this as a fix. I think with this patch it
could happen that we return -ENOTCONN instead of a pmtu value on a
connected socket. Perhaps it is better to update the cached dst_entry in
ipv4_sk_update_pmtu() when we receive the -EMSGSIZE. I'll do some
investigation.
Anyway, it is still odd that reverting my other patch 'fixes'
this issue too.
@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,{structdst_entry*dst;val=0;-dst=sk_dst_get(sk);+dst=sk_dst_check(sk,0);if(dst){val=dst_mtu(dst);dst_release(dst);
With this patch kernel 3.7.1 works perfect. All described problems
are fixed.
Thanks for testing!
I'm not sure if we can't use this as a fix. I think with this patch it
could happen that we return -ENOTCONN instead of a pmtu value on a
connected socket. Perhaps it is better to update the cached dst_entry in
ipv4_sk_update_pmtu() when we receive the -EMSGSIZE. I'll do some
investigation.
It turned out that updating the cached dst_entry in ipv4_sk_update_pmtu()
is not trivial. We need to implement proper socket locking and we need
socket release calback functions for all protocols that use
ipv4_sk_update_pmtu(), similar to tcp.
Today is my last office day for this year, so we probably have to defer
a solution to the next year.
Thanks.
@@ -1198,7 +1198,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,{structdst_entry*dst;val=0;-dst=sk_dst_get(sk);+dst=sk_dst_check(sk,0);if(dst){val=dst_mtu(dst);dst_release(dst);
With this patch kernel 3.7.1 works perfect. All described problems
are fixed.
Thanks for testing!
I'm not sure if we can't use this as a fix. I think with this patch it
could happen that we return -ENOTCONN instead of a pmtu value on a
connected socket. Perhaps it is better to update the cached dst_entry in
ipv4_sk_update_pmtu() when we receive the -EMSGSIZE. I'll do some
investigation.
It turned out that updating the cached dst_entry in ipv4_sk_update_pmtu()
is not trivial. We need to implement proper socket locking and we need
socket release calback functions for all protocols that use
ipv4_sk_update_pmtu(), similar to tcp.
Today is my last office day for this year, so we probably have to defer
a solution to the next year.
Thanks.
Hi Steffen,
Could you, please, tell me is there any news about this bug?
Thanks in advance,
Yurij.
On Mon, Jan 14, 2013 at 12:26:59PM +0400, Yurij M. Plotnikov wrote:
Could you, please, tell me is there any news about this bug?
Ok, I tried to reconstruct your testcase and I can confirm this bug.
It happens only on the first pmtu event on a given route. It works
if I run this test again. Actually it works sometimes even on the
first pmtu event, so it took me quite a while to understand what's ging on.
This is because standart routes (no pmtu or redirect events happened on
that route) are per cpu, so each cpu has it's own struct rtable. This means
that we do not invalidate the socket cached route if the NET_RX_SOFTIRQ
(which handles the pmtu event) is not served by the same cpu that the
sending socket uses. Exceptional routes (routes where a pmtu or redirect
event occured) are not per cpu, so there is no problem.
I'll send three patches in reply to this mail. Applying patch one and two
should fix the bug you reported. If you use IPsec you need patch three too.
The patches are marked as RFC, I'll do proper patch submission if you can
confirm that they fix this bug.
The route lookup in ipv4_sk_update_pmtu() might return a route
different from the route we cached at the socket. This is because
standart routes are per cpu, so each cpu has it's own struct rtable.
This means that we do not invalidate the socket cached route if the
NET_RX_SOFTIRQ is not served by the same cpu that the sending socket
uses. As a result, the cached route reused until we disconnect.
With this patch we invalidate the socket cached route if possible.
If the socket is owened by the user, we can't update the cached
route directly. A followup patch will implement socket release
callback functions for datagram sockets to handle this case.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/route.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
This implements a socket release callback function to check
if the socket cached route got invalid during the time
we owned the socket. The function is used from udp, raw
and ping sockets.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/net/ip.h | 2 ++
net/ipv4/datagram.c | 25 +++++++++++++++++++++++++
net/ipv4/ping.c | 1 +
net/ipv4/raw.c | 1 +
net/ipv4/udp.c | 1 +
5 files changed, 30 insertions(+)
On IPsec pmtu events we can't access the transport headers of
the original packet, so we can't find the socket that sent
the packet. The only chance to notify the socket about the
pmtu change is to force a relookup for all routes. This
patch implenents this for the IPsec protocols.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/ah4.c | 7 +++++--
net/ipv4/esp4.c | 7 +++++--
net/ipv4/ipcomp.c | 7 +++++--
3 files changed, 15 insertions(+), 6 deletions(-)
The route lookup in ipv4_sk_update_pmtu() might return a route
different from the route we cached at the socket. This is because
standart routes are per cpu, so each cpu has it's own struct rtable.
This means that we do not invalidate the socket cached route if the
NET_RX_SOFTIRQ is not served by the same cpu that the sending socket
uses. As a result, the cached route reused until we disconnect.
With this patch we invalidate the socket cached route if possible.
If the socket is owened by the user, we can't update the cached
route directly. A followup patch will implement socket release
callback functions for datagram sockets to handle this case.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This implements a socket release callback function to check
if the socket cached route got invalid during the time
we owned the socket. The function is used from udp, raw
and ping sockets.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
On IPsec pmtu events we can't access the transport headers of
the original packet, so we can't find the socket that sent
the packet. The only chance to notify the socket about the
pmtu change is to force a relookup for all routes. This
patch implenents this for the IPsec protocols.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Expensive, but I really can't come up with a better idea.
Hello,
On Fri, 18 Jan 2013, Steffen Klassert wrote:
quoted hunk
The route lookup in ipv4_sk_update_pmtu() might return a route
different from the route we cached at the socket. This is because
standart routes are per cpu, so each cpu has it's own struct rtable.
This means that we do not invalidate the socket cached route if the
NET_RX_SOFTIRQ is not served by the same cpu that the sending socket
uses. As a result, the cached route reused until we disconnect.
With this patch we invalidate the socket cached route if possible.
If the socket is owened by the user, we can't update the cached
route directly. A followup patch will implement socket release
callback functions for datagram sockets to handle this case.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/route.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
On IPsec pmtu events we can't access the transport headers of
the original packet, so we can't find the socket that sent
the packet. The only chance to notify the socket about the
pmtu change is to force a relookup for all routes. This
patch implenents this for the IPsec protocols.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Expensive, but I really can't come up with a better idea.
Yes, it's a last resort fix. But pmtu events are rare, so
it should not harm too much.
From: Yurij M. Plotnikov <hidden> Date: 2013-01-21 11:31:31
On 01/18/13 12:11, Steffen Klassert wrote:
On Mon, Jan 14, 2013 at 12:26:59PM +0400, Yurij M. Plotnikov wrote:
quoted
Could you, please, tell me is there any news about this bug?
Ok, I tried to reconstruct your testcase and I can confirm this bug.
It happens only on the first pmtu event on a given route. It works
if I run this test again. Actually it works sometimes even on the
first pmtu event, so it took me quite a while to understand what's ging on.
This is because standart routes (no pmtu or redirect events happened on
that route) are per cpu, so each cpu has it's own struct rtable. This means
that we do not invalidate the socket cached route if the NET_RX_SOFTIRQ
(which handles the pmtu event) is not served by the same cpu that the
sending socket uses. Exceptional routes (routes where a pmtu or redirect
event occured) are not per cpu, so there is no problem.
I'll send three patches in reply to this mail. Applying patch one and two
should fix the bug you reported. If you use IPsec you need patch three too.
The patches are marked as RFC, I'll do proper patch submission if you can
confirm that they fix this bug.
Sorry for long delay. I've just checked patches 1+2 and they fix the bug
for me.
Yurij.
On Mon, Jan 21, 2013 at 03:31:20PM +0400, Yurij M. Plotnikov wrote:
On 01/18/13 12:11, Steffen Klassert wrote:
quoted
I'll send three patches in reply to this mail. Applying patch one and two
should fix the bug you reported. If you use IPsec you need patch three too.
The patches are marked as RFC, I'll do proper patch submission if you can
confirm that they fix this bug.
Sorry for long delay. I've just checked patches 1+2 and they fix the
bug for me.
On IPsec pmtu events we can't access the transport headers of
the original packet, so we can't find the socket that sent
the packet. The only chance to notify the socket about the
pmtu change is to force a relookup for all routes. This
patch implenents this for the IPsec protocols.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Expensive, but I really can't come up with a better idea.
I've just applied this to the ipsec tree.
I'll send a pull request tomorrow.