diff options
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index eea7785cc757..0d255ae008b6 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -204,6 +204,7 @@ struct xfrm_state | |||
204 | * transformer. */ | 204 | * transformer. */ |
205 | const struct xfrm_type *type; | 205 | const struct xfrm_type *type; |
206 | struct xfrm_mode *inner_mode; | 206 | struct xfrm_mode *inner_mode; |
207 | struct xfrm_mode *inner_mode_iaf; | ||
207 | struct xfrm_mode *outer_mode; | 208 | struct xfrm_mode *outer_mode; |
208 | 209 | ||
209 | /* Security context */ | 210 | /* Security context */ |
@@ -277,7 +278,7 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
277 | struct xfrm_state_afinfo { | 278 | struct xfrm_state_afinfo { |
278 | unsigned int family; | 279 | unsigned int family; |
279 | unsigned int proto; | 280 | unsigned int proto; |
280 | unsigned int eth_proto; | 281 | __be16 eth_proto; |
281 | struct module *owner; | 282 | struct module *owner; |
282 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 283 | const struct xfrm_type *type_map[IPPROTO_MAX]; |
283 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 284 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
@@ -387,6 +388,27 @@ enum { | |||
387 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); | 388 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); |
388 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); | 389 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); |
389 | 390 | ||
391 | static inline int xfrm_af2proto(unsigned int family) | ||
392 | { | ||
393 | switch(family) { | ||
394 | case AF_INET: | ||
395 | return IPPROTO_IPIP; | ||
396 | case AF_INET6: | ||
397 | return IPPROTO_IPV6; | ||
398 | default: | ||
399 | return 0; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto) | ||
404 | { | ||
405 | if ((ipproto == IPPROTO_IPIP && x->props.family == AF_INET) || | ||
406 | (ipproto == IPPROTO_IPV6 && x->props.family == AF_INET6)) | ||
407 | return x->inner_mode; | ||
408 | else | ||
409 | return x->inner_mode_iaf; | ||
410 | } | ||
411 | |||
390 | struct xfrm_tmpl | 412 | struct xfrm_tmpl |
391 | { | 413 | { |
392 | /* id in template is interpreted as: | 414 | /* id in template is interpreted as: |
@@ -530,6 +552,9 @@ struct xfrm_mode_skb_cb { | |||
530 | __be16 id; | 552 | __be16 id; |
531 | __be16 frag_off; | 553 | __be16 frag_off; |
532 | 554 | ||
555 | /* IP header length (excluding options or extension headers). */ | ||
556 | u8 ihl; | ||
557 | |||
533 | /* TOS for IPv4, class for IPv6. */ | 558 | /* TOS for IPv4, class for IPv6. */ |
534 | u8 tos; | 559 | u8 tos; |
535 | 560 | ||
@@ -539,6 +564,9 @@ struct xfrm_mode_skb_cb { | |||
539 | /* Protocol for IPv4, NH for IPv6. */ | 564 | /* Protocol for IPv4, NH for IPv6. */ |
540 | u8 protocol; | 565 | u8 protocol; |
541 | 566 | ||
567 | /* Option length for IPv4, zero for IPv6. */ | ||
568 | u8 optlen; | ||
569 | |||
542 | /* Used by IPv6 only, zero for IPv4. */ | 570 | /* Used by IPv6 only, zero for IPv4. */ |
543 | u8 flow_lbl[3]; | 571 | u8 flow_lbl[3]; |
544 | }; | 572 | }; |
@@ -1253,6 +1281,7 @@ extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, | |||
1253 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | 1281 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); |
1254 | extern int xfrm_output_resume(struct sk_buff *skb, int err); | 1282 | extern int xfrm_output_resume(struct sk_buff *skb, int err); |
1255 | extern int xfrm_output(struct sk_buff *skb); | 1283 | extern int xfrm_output(struct sk_buff *skb); |
1284 | extern int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1256 | extern int xfrm4_extract_header(struct sk_buff *skb); | 1285 | extern int xfrm4_extract_header(struct sk_buff *skb); |
1257 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); | 1286 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); |
1258 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, | 1287 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, |