summaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-12-04 07:54:12 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-28 23:55:49 +0100
commit2fcb45b6b87914f072314e5b5d9c196f45984683 (patch)
treee5a6cc4101a8b2693799fde9f47abaf480ae2dfc /net/xfrm
parent[UDP]: Counter increment should be in USER mode for recvmsg (diff)
downloadlinux-2fcb45b6b87914f072314e5b5d9c196f45984683.tar.xz
linux-2fcb45b6b87914f072314e5b5d9c196f45984683.zip
[IPSEC]: Use the correct family for input state lookup
When merging the input paths of IPsec I accidentally left a hard-coded AF_INET for the state lookup call. This broke IPv6 obviously. This patch fixes by getting the input callers to specify the family through skb->cb. Credit goes to Kazunori Miyazawa for diagnosing this and providing an initial patch. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_input.c5
1 files changed, 4 insertions, 1 deletions
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)
__be32 seq;
struct xfrm_state *x;
xfrm_address_t *daddr;
+ unsigned int family;
int decaps = 0;
int async = 0;
@@ -127,6 +128,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
daddr = (xfrm_address_t *)(skb_network_header(skb) +
XFRM_SPI_SKB_CB(skb)->daddroff);
+ family = XFRM_SPI_SKB_CB(skb)->family;
seq = 0;
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)
if (skb->sp->len == XFRM_MAX_DEPTH)
goto drop;
- x = xfrm_state_lookup(daddr, spi, nexthdr, AF_INET);
+ x = xfrm_state_lookup(daddr, spi, nexthdr, family);
if (x == NULL)
goto drop;
@@ -198,6 +200,7 @@ resume:
* transport mode so the outer address is identical.
*/
daddr = &x->id.daddr;
+ family = x->outer_mode->afinfo->family;
err = xfrm_parse_spi(skb, nexthdr, &spi, &seq);
if (err < 0)