diff options
author | Masahide NAKAMURA <nakam@linux-ipv6.org> | 2006-08-23 20:57:28 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:06:36 -0400 |
commit | aee5adb4307c4c63a4dc5f3b49984d76f8a71b5b (patch) | |
tree | b2daac197259c535d66749617ede6f8479b355a4 | |
parent | eb2971b68a7d17a7d0fa2c7fc6fbc4bfe41cd694 (diff) |
[XFRM] STATE: Add a hook to find offset to be inserted header in outbound.
On current kernel, ip6_find_1stfragopt() is used by IPv6 IPsec to find
offset to be inserted header in outbound for transport mode. (BTW, no
usage may be needed for IPv4 case.) Mobile IPv6 requires another
logic for routing header and destination options header
respectively. This patch is common platform for the offset and adopts
it to IPsec.
Based on MIPL2 kernel patch.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/xfrm.h | 3 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 3 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 3 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 1 | ||||
-rw-r--r-- | net/ipv6/ipv6_syms.c | 1 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_transport.c | 2 | ||||
-rw-r--r-- | net/ipv6/xfrm6_output.c | 6 |
7 files changed, 16 insertions, 3 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index d9c40e713184..eed48f832ce1 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -265,6 +265,7 @@ struct xfrm_type | |||
265 | void (*destructor)(struct xfrm_state *); | 265 | void (*destructor)(struct xfrm_state *); |
266 | int (*input)(struct xfrm_state *, struct sk_buff *skb); | 266 | int (*input)(struct xfrm_state *, struct sk_buff *skb); |
267 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 267 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
268 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | ||
268 | /* Estimate maximal size of result of transformation of a dgram */ | 269 | /* Estimate maximal size of result of transformation of a dgram */ |
269 | u32 (*get_max_size)(struct xfrm_state *, int size); | 270 | u32 (*get_max_size)(struct xfrm_state *, int size); |
270 | }; | 271 | }; |
@@ -960,6 +961,8 @@ extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | |||
960 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 961 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
961 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 962 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
962 | extern int xfrm6_output(struct sk_buff *skb); | 963 | extern int xfrm6_output(struct sk_buff *skb); |
964 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | ||
965 | u8 **prevhdr); | ||
963 | 966 | ||
964 | #ifdef CONFIG_XFRM | 967 | #ifdef CONFIG_XFRM |
965 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); | 968 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 60954fc7eb36..6c0aa51319a5 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -435,7 +435,8 @@ static struct xfrm_type ah6_type = | |||
435 | .init_state = ah6_init_state, | 435 | .init_state = ah6_init_state, |
436 | .destructor = ah6_destroy, | 436 | .destructor = ah6_destroy, |
437 | .input = ah6_input, | 437 | .input = ah6_input, |
438 | .output = ah6_output | 438 | .output = ah6_output, |
439 | .hdr_offset = xfrm6_find_1stfragopt, | ||
439 | }; | 440 | }; |
440 | 441 | ||
441 | static struct inet6_protocol ah6_protocol = { | 442 | static struct inet6_protocol ah6_protocol = { |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 2b8e52e1d0ab..ae50b9511151 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -379,7 +379,8 @@ static struct xfrm_type esp6_type = | |||
379 | .destructor = esp6_destroy, | 379 | .destructor = esp6_destroy, |
380 | .get_max_size = esp6_get_max_size, | 380 | .get_max_size = esp6_get_max_size, |
381 | .input = esp6_input, | 381 | .input = esp6_input, |
382 | .output = esp6_output | 382 | .output = esp6_output, |
383 | .hdr_offset = xfrm6_find_1stfragopt, | ||
383 | }; | 384 | }; |
384 | 385 | ||
385 | static struct inet6_protocol esp6_protocol = { | 386 | static struct inet6_protocol esp6_protocol = { |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 19eba8d9f851..ad9c6e824e62 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -461,6 +461,7 @@ static struct xfrm_type ipcomp6_type = | |||
461 | .destructor = ipcomp6_destroy, | 461 | .destructor = ipcomp6_destroy, |
462 | .input = ipcomp6_input, | 462 | .input = ipcomp6_input, |
463 | .output = ipcomp6_output, | 463 | .output = ipcomp6_output, |
464 | .hdr_offset = xfrm6_find_1stfragopt, | ||
464 | }; | 465 | }; |
465 | 466 | ||
466 | static struct inet6_protocol ipcomp6_protocol = | 467 | static struct inet6_protocol ipcomp6_protocol = |
diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c index dd4d1ce77769..e1a741612888 100644 --- a/net/ipv6/ipv6_syms.c +++ b/net/ipv6/ipv6_syms.c | |||
@@ -31,6 +31,7 @@ EXPORT_SYMBOL(ipv6_chk_addr); | |||
31 | EXPORT_SYMBOL(in6_dev_finish_destroy); | 31 | EXPORT_SYMBOL(in6_dev_finish_destroy); |
32 | #ifdef CONFIG_XFRM | 32 | #ifdef CONFIG_XFRM |
33 | EXPORT_SYMBOL(xfrm6_rcv); | 33 | EXPORT_SYMBOL(xfrm6_rcv); |
34 | EXPORT_SYMBOL(xfrm6_find_1stfragopt); | ||
34 | #endif | 35 | #endif |
35 | EXPORT_SYMBOL(rt6_lookup); | 36 | EXPORT_SYMBOL(rt6_lookup); |
36 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); | 37 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); |
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c index 711d713e36d8..a5dce216024d 100644 --- a/net/ipv6/xfrm6_mode_transport.c +++ b/net/ipv6/xfrm6_mode_transport.c | |||
@@ -35,7 +35,7 @@ static int xfrm6_transport_output(struct sk_buff *skb) | |||
35 | skb_push(skb, x->props.header_len); | 35 | skb_push(skb, x->props.header_len); |
36 | iph = skb->nh.ipv6h; | 36 | iph = skb->nh.ipv6h; |
37 | 37 | ||
38 | hdr_len = ip6_find_1stfragopt(skb, &prevhdr); | 38 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); |
39 | skb->nh.raw = prevhdr - x->props.header_len; | 39 | skb->nh.raw = prevhdr - x->props.header_len; |
40 | skb->h.raw = skb->data + hdr_len; | 40 | skb->h.raw = skb->data + hdr_len; |
41 | memmove(skb->data, iph, hdr_len); | 41 | memmove(skb->data, iph, hdr_len); |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 26f18869f77b..b4628fbf8ff5 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -17,6 +17,12 @@ | |||
17 | #include <net/ipv6.h> | 17 | #include <net/ipv6.h> |
18 | #include <net/xfrm.h> | 18 | #include <net/xfrm.h> |
19 | 19 | ||
20 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | ||
21 | u8 **prevhdr) | ||
22 | { | ||
23 | return ip6_find_1stfragopt(skb, prevhdr); | ||
24 | } | ||
25 | |||
20 | static int xfrm6_tunnel_check_size(struct sk_buff *skb) | 26 | static int xfrm6_tunnel_check_size(struct sk_buff *skb) |
21 | { | 27 | { |
22 | int mtu, ret = 0; | 28 | int mtu, ret = 0; |