Skip to content

Commit b294200

Browse files
Saurabh Mohandavem330
Saurabh Mohan
authored andcommitted
ipv4/ip_vti.c: VTI fix post-decryption forwarding
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1ba56fb commit b294200

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/ipv4/ip_vti.c

+5
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,17 @@ static int vti_rcv(struct sk_buff *skb)
338338
if (tunnel != NULL) {
339339
struct pcpu_tstats *tstats;
340340

341+
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
342+
return -1;
343+
341344
tstats = this_cpu_ptr(tunnel->dev->tstats);
342345
u64_stats_update_begin(&tstats->syncp);
343346
tstats->rx_packets++;
344347
tstats->rx_bytes += skb->len;
345348
u64_stats_update_end(&tstats->syncp);
346349

350+
skb->mark = 0;
351+
secpath_reset(skb);
347352
skb->dev = tunnel->dev;
348353
return 1;
349354
}

0 commit comments

Comments
 (0)