diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-04 01:54:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:49 -0500 |
commit | 2fcb45b6b87914f072314e5b5d9c196f45984683 (patch) | |
tree | e5a6cc4101a8b2693799fde9f47abaf480ae2dfc /net/xfrm/xfrm_input.c | |
parent | bbca17680f82b1ba3122d41e8bc675aebf6d1cf2 (diff) |
[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/xfrm_input.c')
-rw-r--r-- | net/xfrm/xfrm_input.c | 5 |
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) | |||
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) |