diff options
author | Kazunori MIYAZAWA <kazunori@miyazawa.org> | 2008-03-24 14:51:51 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-24 14:51:51 -0700 |
commit | df9dcb4588aca9cc243cf1f3f454361a84e1cbdb (patch) | |
tree | 53dabed7cffee752109808cbea2f812e0a6d7faf /include | |
parent | fa86d322d89995fef1bfb5cc768b89d8c22ea0d9 (diff) | |
download | op-kernel-dev-df9dcb4588aca9cc243cf1f3f454361a84e1cbdb.zip op-kernel-dev-df9dcb4588aca9cc243cf1f3f454361a84e1cbdb.tar.gz |
[IPSEC]: Fix inter address family IPsec tunnel handling.
Signed-off-by: Kazunori MIYAZAWA <kazunori@miyazawa.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/xfrm.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 619c53b..4e6f956 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -204,6 +204,7 @@ struct xfrm_state * transformer. */ const struct xfrm_type *type; struct xfrm_mode *inner_mode; + struct xfrm_mode *inner_mode_iaf; struct xfrm_mode *outer_mode; /* Security context */ @@ -387,6 +388,27 @@ enum { extern int xfrm_register_mode(struct xfrm_mode *mode, int family); extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); +static inline int xfrm_af2proto(unsigned int family) +{ + switch(family) { + case AF_INET: + return IPPROTO_IPIP; + case AF_INET6: + return IPPROTO_IPV6; + default: + return 0; + } +} + +static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto) +{ + if ((ipproto == IPPROTO_IPIP && x->props.family == AF_INET) || + (ipproto == IPPROTO_IPV6 && x->props.family == AF_INET6)) + return x->inner_mode; + else + return x->inner_mode_iaf; +} + struct xfrm_tmpl { /* id in template is interpreted as: @@ -1253,6 +1275,7 @@ extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); extern int xfrm_output_resume(struct sk_buff *skb, int err); extern int xfrm_output(struct sk_buff *skb); +extern int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); extern int xfrm4_extract_header(struct sk_buff *skb); extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, |