diff options
Diffstat (limited to 'net/xfrm/xfrm_input.c')
| -rw-r--r-- | net/xfrm/xfrm_input.c | 17 | 
1 files changed, 16 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 526c4feb3b50..b58286ecd156 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c  | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | #include <net/dst.h> | 13 | #include <net/dst.h> | 
| 14 | #include <net/ip.h> | 14 | #include <net/ip.h> | 
| 15 | #include <net/xfrm.h> | 15 | #include <net/xfrm.h> | 
| 16 | #include <net/ip_tunnels.h> | ||
| 17 | #include <net/ip6_tunnel.h> | ||
| 16 | 18 | ||
| 17 | static struct kmem_cache *secpath_cachep __read_mostly; | 19 | static struct kmem_cache *secpath_cachep __read_mostly; | 
| 18 | 20 | ||
| @@ -186,6 +188,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
| 186 | struct xfrm_state *x = NULL; | 188 | struct xfrm_state *x = NULL; | 
| 187 | xfrm_address_t *daddr; | 189 | xfrm_address_t *daddr; | 
| 188 | struct xfrm_mode *inner_mode; | 190 | struct xfrm_mode *inner_mode; | 
| 191 | u32 mark = skb->mark; | ||
| 189 | unsigned int family; | 192 | unsigned int family; | 
| 190 | int decaps = 0; | 193 | int decaps = 0; | 
| 191 | int async = 0; | 194 | int async = 0; | 
| @@ -203,6 +206,18 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
| 203 | XFRM_SPI_SKB_CB(skb)->daddroff); | 206 | XFRM_SPI_SKB_CB(skb)->daddroff); | 
| 204 | family = XFRM_SPI_SKB_CB(skb)->family; | 207 | family = XFRM_SPI_SKB_CB(skb)->family; | 
| 205 | 208 | ||
| 209 | /* if tunnel is present override skb->mark value with tunnel i_key */ | ||
| 210 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { | ||
| 211 | switch (family) { | ||
| 212 | case AF_INET: | ||
| 213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); | ||
| 214 | break; | ||
| 215 | case AF_INET6: | ||
| 216 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); | ||
| 217 | break; | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 206 | /* Allocate new secpath or COW existing one. */ | 221 | /* Allocate new secpath or COW existing one. */ | 
| 207 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { | 222 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { | 
| 208 | struct sec_path *sp; | 223 | struct sec_path *sp; | 
| @@ -229,7 +244,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
| 229 | goto drop; | 244 | goto drop; | 
| 230 | } | 245 | } | 
| 231 | 246 | ||
| 232 | x = xfrm_state_lookup(net, skb->mark, daddr, spi, nexthdr, family); | 247 | x = xfrm_state_lookup(net, mark, daddr, spi, nexthdr, family); | 
| 233 | if (x == NULL) { | 248 | if (x == NULL) { | 
| 234 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); | 249 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); | 
| 235 | xfrm_audit_state_notfound(skb, family, spi, seq); | 250 | xfrm_audit_state_notfound(skb, family, spi, seq); | 
