aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ipip.c2
-rw-r--r--net/ipv4/netfilter.c12
-rw-r--r--net/ipv4/xfrm4_output.c1
4 files changed, 13 insertions, 4 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 65c3a91ed85e..de16e944777f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -832,7 +832,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
832 skb->h.raw = skb->nh.raw; 832 skb->h.raw = skb->nh.raw;
833 skb->nh.raw = skb_push(skb, gre_hlen); 833 skb->nh.raw = skb_push(skb, gre_hlen);
834 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 834 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
835 IPCB(skb)->flags &= ~IPSKB_XFRM_TUNNEL_SIZE; 835 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED);
836 dst_release(skb->dst); 836 dst_release(skb->dst);
837 skb->dst = &rt->u.dst; 837 skb->dst = &rt->u.dst;
838 838
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 078b59be91f4..bbd85f5ec985 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -621,7 +621,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
621 skb->h.raw = skb->nh.raw; 621 skb->h.raw = skb->nh.raw;
622 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 622 skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
623 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 623 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
624 IPCB(skb)->flags &= ~IPSKB_XFRM_TUNNEL_SIZE; 624 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE|IPSKB_XFRM_TRANSFORMED);
625 dst_release(skb->dst); 625 dst_release(skb->dst);
626 skb->dst = &rt->u.dst; 626 skb->dst = &rt->u.dst;
627 627
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index ae0779d82c5d..4c637a1cbd23 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -7,11 +7,13 @@
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#include <linux/netfilter_ipv4.h> 8#include <linux/netfilter_ipv4.h>
9 9
10#include <linux/ip.h>
10#include <linux/tcp.h> 11#include <linux/tcp.h>
11#include <linux/udp.h> 12#include <linux/udp.h>
12#include <linux/icmp.h> 13#include <linux/icmp.h>
13#include <net/route.h> 14#include <net/route.h>
14#include <linux/ip.h> 15#include <net/xfrm.h>
16#include <net/ip.h>
15 17
16/* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ 18/* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
17int ip_route_me_harder(struct sk_buff **pskb) 19int ip_route_me_harder(struct sk_buff **pskb)
@@ -33,7 +35,6 @@ int ip_route_me_harder(struct sk_buff **pskb)
33#ifdef CONFIG_IP_ROUTE_FWMARK 35#ifdef CONFIG_IP_ROUTE_FWMARK
34 fl.nl_u.ip4_u.fwmark = (*pskb)->nfmark; 36 fl.nl_u.ip4_u.fwmark = (*pskb)->nfmark;
35#endif 37#endif
36 fl.proto = iph->protocol;
37 if (ip_route_output_key(&rt, &fl) != 0) 38 if (ip_route_output_key(&rt, &fl) != 0)
38 return -1; 39 return -1;
39 40
@@ -60,6 +61,13 @@ int ip_route_me_harder(struct sk_buff **pskb)
60 if ((*pskb)->dst->error) 61 if ((*pskb)->dst->error)
61 return -1; 62 return -1;
62 63
64#ifdef CONFIG_XFRM
65 if (!(IPCB(*pskb)->flags & IPSKB_XFRM_TRANSFORMED) &&
66 xfrm_decode_session(*pskb, &fl, AF_INET) == 0)
67 if (xfrm_lookup(&(*pskb)->dst, &fl, (*pskb)->sk, 0))
68 return -1;
69#endif
70
63 /* Change in oif may mean change in hh_len. */ 71 /* Change in oif may mean change in hh_len. */
64 hh_len = (*pskb)->dst->dev->hard_header_len; 72 hh_len = (*pskb)->dst->dev->hard_header_len;
65 if (skb_headroom(*pskb) < hh_len) { 73 if (skb_headroom(*pskb) < hh_len) {
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 51fabb8f7c54..160c48800ab8 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -140,6 +140,7 @@ static int xfrm4_output_one(struct sk_buff *skb)
140 x = dst->xfrm; 140 x = dst->xfrm;
141 } while (x && !x->props.mode); 141 } while (x && !x->props.mode);
142 142
143 IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
143 err = 0; 144 err = 0;
144 145
145out_exit: 146out_exit: