aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/xfrm.h1
-rw-r--r--net/ipv4/xfrm4_input.c1
-rw-r--r--net/ipv6/xfrm6_input.c1
-rw-r--r--net/xfrm/xfrm_input.c5
4 files changed, 7 insertions, 1 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ecc02e9bde32..182f10b29d88 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -534,6 +534,7 @@ struct xfrm_spi_skb_cb {
534 } header; 534 } header;
535 535
536 unsigned int daddroff; 536 unsigned int daddroff;
537 unsigned int family;
537}; 538};
538 539
539#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) 540#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0]))
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 0c377a66b8b5..33f990d56c91 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -39,6 +39,7 @@ drop:
39int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, 39int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
40 int encap_type) 40 int encap_type)
41{ 41{
42 XFRM_SPI_SKB_CB(skb)->family = AF_INET;
42 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); 43 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
43 return xfrm_input(skb, nexthdr, spi, encap_type); 44 return xfrm_input(skb, nexthdr, spi, encap_type);
44} 45}
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index e2c3efd2579d..74f3aacebb5e 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -23,6 +23,7 @@ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb)
23 23
24int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 24int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
25{ 25{
26 XFRM_SPI_SKB_CB(skb)->family = AF_INET6;
26 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); 27 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr);
27 return xfrm_input(skb, nexthdr, spi, 0); 28 return xfrm_input(skb, nexthdr, spi, 0);
28} 29}
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 96f42c1d2e8e..8b2b1b59133e 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -102,6 +102,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
102 __be32 seq; 102 __be32 seq;
103 struct xfrm_state *x; 103 struct xfrm_state *x;
104 xfrm_address_t *daddr; 104 xfrm_address_t *daddr;
105 unsigned int family;
105 int decaps = 0; 106 int decaps = 0;
106 int async = 0; 107 int async = 0;
107 108
@@ -127,6 +128,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
127 128
128 daddr = (xfrm_address_t *)(skb_network_header(skb) + 129 daddr = (xfrm_address_t *)(skb_network_header(skb) +
129 XFRM_SPI_SKB_CB(skb)->daddroff); 130 XFRM_SPI_SKB_CB(skb)->daddroff);
131 family = XFRM_SPI_SKB_CB(skb)->family;
130 132
131 seq = 0; 133 seq = 0;
132 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) 134 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0)
@@ -136,7 +138,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
136 if (skb->sp->len == XFRM_MAX_DEPTH) 138 if (skb->sp->len == XFRM_MAX_DEPTH)
137 goto drop; 139 goto drop;
138 140
139 x = xfrm_state_lookup(daddr, spi, nexthdr, AF_INET); 141 x = xfrm_state_lookup(daddr, spi, nexthdr, family);
140 if (x == NULL) 142 if (x == NULL)
141 goto drop; 143 goto drop;
142 144
@@ -198,6 +200,7 @@ resume:
198 * transport mode so the outer address is identical. 200 * transport mode so the outer address is identical.
199 */ 201 */
200 daddr = &x->id.daddr; 202 daddr = &x->id.daddr;
203 family = x->outer_mode->afinfo->family;
201 204
202 err = xfrm_parse_spi(skb, nexthdr, &spi, &seq); 205 err = xfrm_parse_spi(skb, nexthdr, &spi, &seq);
203 if (err < 0) 206 if (err < 0)