* [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding
@ 2012-11-12 22:17 Saurabh
2012-11-14 23:54 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Saurabh @ 2012-11-12 22:17 UTC (permalink / raw)
To: netdev
With the latest kernel there are two things that must be done post decryption
so that the packet are forwarded.
1. Remove the mark from the packet. This will cause the packet to not match
the ipsec-policy again. However doing this causes the post-decryption check to
fail also and the packet will get dropped. (cat /proc/net/xfrm_stat).
2. Remove the sp association in the skbuff so that no policy check is done on
the packet for VTI tunnels.
Due to #2 above we must now do a security-policy check in the vti rcv path
prior to resetting the mark in the skbuff.
Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
Reported-by: Ruben Herold <ruben@puettmann.net>
---
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 1831092..858fddf 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -338,12 +338,17 @@ static int vti_rcv(struct sk_buff *skb)
if (tunnel != NULL) {
struct pcpu_tstats *tstats;
+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
+ return -1;
+
tstats = this_cpu_ptr(tunnel->dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->rx_packets++;
tstats->rx_bytes += skb->len;
u64_stats_update_end(&tstats->syncp);
+ skb->mark = 0;
+ secpath_reset(skb);
skb->dev = tunnel->dev;
return 1;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding
2012-11-12 22:17 [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding Saurabh
@ 2012-11-14 23:54 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-14 23:54 UTC (permalink / raw)
To: saurabh.mohan; +Cc: netdev
From: Saurabh <saurabh.mohan@vyatta.com>
Date: Mon, 12 Nov 2012 14:17:31 -0800
>
>
> With the latest kernel there are two things that must be done post decryption
> so that the packet are forwarded.
> 1. Remove the mark from the packet. This will cause the packet to not match
> the ipsec-policy again. However doing this causes the post-decryption check to
> fail also and the packet will get dropped. (cat /proc/net/xfrm_stat).
> 2. Remove the sp association in the skbuff so that no policy check is done on
> the packet for VTI tunnels.
>
> Due to #2 above we must now do a security-policy check in the vti rcv path
> prior to resetting the mark in the skbuff.
>
> Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
> Reported-by: Ruben Herold <ruben@puettmann.net>
Please fix your email configuration so that the From: field
properly lists your full name, "Saurabh Mohan" instead of
just plain "Saurabh".
Otherwise the author of the commit will not be set properly
when I apply this.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding
@ 2012-11-15 2:08 Saurabh Mohan
2012-11-15 2:41 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Saurabh Mohan @ 2012-11-15 2:08 UTC (permalink / raw)
To: netdev
With the latest kernel there are two things that must be done post decryption
so that the packet are forwarded.
1. Remove the mark from the packet. This will cause the packet to not match
the ipsec-policy again. However doing this causes the post-decryption check to
fail also and the packet will get dropped. (cat /proc/net/xfrm_stat).
2. Remove the sp association in the skbuff so that no policy check is done on
the packet for VTI tunnels.
Due to #2 above we must now do a security-policy check in the vti rcv path
prior to resetting the mark in the skbuff.
Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
Reported-by: Ruben Herold <ruben@puettmann.net>
---
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 1831092..858fddf 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -338,12 +338,17 @@ static int vti_rcv(struct sk_buff *skb)
if (tunnel != NULL) {
struct pcpu_tstats *tstats;
+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
+ return -1;
+
tstats = this_cpu_ptr(tunnel->dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->rx_packets++;
tstats->rx_bytes += skb->len;
u64_stats_update_end(&tstats->syncp);
+ skb->mark = 0;
+ secpath_reset(skb);
skb->dev = tunnel->dev;
return 1;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding
2012-11-15 2:08 Saurabh Mohan
@ 2012-11-15 2:41 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-15 2:41 UTC (permalink / raw)
To: saurabh.mohan; +Cc: netdev
From: Saurabh Mohan <saurabh.mohan@vyatta.com>
Date: Wed, 14 Nov 2012 18:08:15 -0800
>
>
> With the latest kernel there are two things that must be done post decryption
> so that the packet are forwarded.
> 1. Remove the mark from the packet. This will cause the packet to not match
> the ipsec-policy again. However doing this causes the post-decryption check to
> fail also and the packet will get dropped. (cat /proc/net/xfrm_stat).
> 2. Remove the sp association in the skbuff so that no policy check is done on
> the packet for VTI tunnels.
>
> Due to #2 above we must now do a security-policy check in the vti rcv path
> prior to resetting the mark in the skbuff.
>
> Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
> Reported-by: Ruben Herold <ruben@puettmann.net>
Applied, and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-15 2:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 22:17 [PATCH] ipv4/ip_vti.c: VTI fix post-decryption forwarding Saurabh
2012-11-14 23:54 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2012-11-15 2:08 Saurabh Mohan
2012-11-15 2:41 ` 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).