* [PATCHv2] xfrm: fix xfrm by MARK logic
@ 2010-07-02 17:47 Peter Kosyh
2010-07-03 6:38 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Peter Kosyh @ 2010-07-02 17:47 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
From: Peter Kosyh <p.kosyh@gmail.com>
While using xfrm by MARK feature in
2.6.34 - 2.6.35 kernels, the mark
is always cleared in flowi structure via memset in
_decode_session4 (net/ipv4/xfrm4_policy.c), so
the policy lookup fails.
IPv6 code is affected by this bug too.
Signed-off-by: Peter Kosyh <p.kosyh@gmail.com>
---
diff -uprN linux-2.6.35-rc3.orig/net/ipv4/xfrm4_policy.c linux-2.6.35-rc3/net/ipv4/xfrm4_policy.c
--- linux-2.6.35-rc3.orig/net/ipv4/xfrm4_policy.c 2010-06-12 06:14:04.000000000 +0400
+++ linux-2.6.35-rc3/net/ipv4/xfrm4_policy.c 2010-07-02 20:20:49.000000000 +0400
@@ -108,6 +108,8 @@ _decode_session4(struct sk_buff *skb, st
u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
memset(fl, 0, sizeof(struct flowi));
+ fl->mark = skb->mark;
+
if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) {
switch (iph->protocol) {
case IPPROTO_UDP:
diff -uprN linux-2.6.35-rc3.orig/net/ipv6/xfrm6_policy.c linux-2.6.35-rc3/net/ipv6/xfrm6_policy.c
--- linux-2.6.35-rc3.orig/net/ipv6/xfrm6_policy.c 2010-06-12 06:14:04.000000000 +0400
+++ linux-2.6.35-rc3/net/ipv6/xfrm6_policy.c 2010-07-02 20:20:22.000000000 +0400
@@ -124,6 +124,8 @@ _decode_session6(struct sk_buff *skb, st
u8 nexthdr = nh[IP6CB(skb)->nhoff];
memset(fl, 0, sizeof(struct flowi));
+ fl->mark = skb->mark;
+
ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr);
ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] xfrm: fix xfrm by MARK logic
2010-07-02 17:47 [PATCHv2] xfrm: fix xfrm by MARK logic Peter Kosyh
@ 2010-07-03 6:38 ` Eric Dumazet
2010-07-03 7:02 ` Andreas Steffen
2010-07-04 18:46 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-07-03 6:38 UTC (permalink / raw)
To: Peter Kosyh; +Cc: netdev
Le vendredi 02 juillet 2010 à 21:47 +0400, Peter Kosyh a écrit :
> From: Peter Kosyh <p.kosyh@gmail.com>
>
> While using xfrm by MARK feature in
> 2.6.34 - 2.6.35 kernels, the mark
> is always cleared in flowi structure via memset in
> _decode_session4 (net/ipv4/xfrm4_policy.c), so
> the policy lookup fails.
> IPv6 code is affected by this bug too.
>
> Signed-off-by: Peter Kosyh <p.kosyh@gmail.com>
> ---
>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Thanks !
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] xfrm: fix xfrm by MARK logic
2010-07-03 6:38 ` Eric Dumazet
@ 2010-07-03 7:02 ` Andreas Steffen
2010-07-04 18:46 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Steffen @ 2010-07-03 7:02 UTC (permalink / raw)
To: Peter Kosyh; +Cc: Eric Dumazet, netdev
Great,
this was the second bug [besides the xfrm_mark_get issue] I was looking
for this week and which prevented strongSwan from successfully using
mark-based IPsec policies. It works like a charm now.
Thanks!
On 07/03/2010 08:38 AM, Eric Dumazet wrote:
> Le vendredi 02 juillet 2010 à 21:47 +0400, Peter Kosyh a écrit :
>> From: Peter Kosyh <p.kosyh@gmail.com>
>>
>> While using xfrm by MARK feature in
>> 2.6.34 - 2.6.35 kernels, the mark
>> is always cleared in flowi structure via memset in
>> _decode_session4 (net/ipv4/xfrm4_policy.c), so
>> the policy lookup fails.
>> IPv6 code is affected by this bug too.
>>
>> Signed-off-by: Peter Kosyh <p.kosyh@gmail.com>
>> ---
>>
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Thanks !
--
======================================================================
Andreas Steffen andreas.steffen@strongswan.org
strongSwan - the Linux VPN Solution! www.strongswan.org
Institute for Internet Technologies and Applications
University of Applied Sciences Rapperswil
CH-8640 Rapperswil (Switzerland)
===========================================================[ITA-HSR]==
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] xfrm: fix xfrm by MARK logic
2010-07-03 6:38 ` Eric Dumazet
2010-07-03 7:02 ` Andreas Steffen
@ 2010-07-04 18:46 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-07-04 18:46 UTC (permalink / raw)
To: eric.dumazet; +Cc: p.kosyh, netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 03 Jul 2010 08:38:03 +0200
> Le vendredi 02 juillet 2010 à 21:47 +0400, Peter Kosyh a écrit :
>> From: Peter Kosyh <p.kosyh@gmail.com>
>>
>> While using xfrm by MARK feature in
>> 2.6.34 - 2.6.35 kernels, the mark
>> is always cleared in flowi structure via memset in
>> _decode_session4 (net/ipv4/xfrm4_policy.c), so
>> the policy lookup fails.
>> IPv6 code is affected by this bug too.
>>
>> Signed-off-by: Peter Kosyh <p.kosyh@gmail.com>
>> ---
>>
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-04 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-02 17:47 [PATCHv2] xfrm: fix xfrm by MARK logic Peter Kosyh
2010-07-03 6:38 ` Eric Dumazet
2010-07-03 7:02 ` Andreas Steffen
2010-07-04 18:46 ` David Miller
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).