diff options
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index bed7d43932f6..b56b6a10fe5e 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -205,6 +205,7 @@ struct xfrm_state | |||
205 | * transformer. */ | 205 | * transformer. */ |
206 | const struct xfrm_type *type; | 206 | const struct xfrm_type *type; |
207 | struct xfrm_mode *inner_mode; | 207 | struct xfrm_mode *inner_mode; |
208 | struct xfrm_mode *inner_mode_iaf; | ||
208 | struct xfrm_mode *outer_mode; | 209 | struct xfrm_mode *outer_mode; |
209 | 210 | ||
210 | /* Security context */ | 211 | /* Security context */ |
@@ -388,6 +389,27 @@ enum { | |||
388 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); | 389 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); |
389 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); | 390 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); |
390 | 391 | ||
392 | static inline int xfrm_af2proto(unsigned int family) | ||
393 | { | ||
394 | switch(family) { | ||
395 | case AF_INET: | ||
396 | return IPPROTO_IPIP; | ||
397 | case AF_INET6: | ||
398 | return IPPROTO_IPV6; | ||
399 | default: | ||
400 | return 0; | ||
401 | } | ||
402 | } | ||
403 | |||
404 | static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto) | ||
405 | { | ||
406 | if ((ipproto == IPPROTO_IPIP && x->props.family == AF_INET) || | ||
407 | (ipproto == IPPROTO_IPV6 && x->props.family == AF_INET6)) | ||
408 | return x->inner_mode; | ||
409 | else | ||
410 | return x->inner_mode_iaf; | ||
411 | } | ||
412 | |||
391 | struct xfrm_tmpl | 413 | struct xfrm_tmpl |
392 | { | 414 | { |
393 | /* id in template is interpreted as: | 415 | /* id in template is interpreted as: |
@@ -532,6 +554,9 @@ struct xfrm_mode_skb_cb { | |||
532 | __be16 id; | 554 | __be16 id; |
533 | __be16 frag_off; | 555 | __be16 frag_off; |
534 | 556 | ||
557 | /* IP header length (excluding options or extension headers). */ | ||
558 | u8 ihl; | ||
559 | |||
535 | /* TOS for IPv4, class for IPv6. */ | 560 | /* TOS for IPv4, class for IPv6. */ |
536 | u8 tos; | 561 | u8 tos; |
537 | 562 | ||
@@ -541,6 +566,9 @@ struct xfrm_mode_skb_cb { | |||
541 | /* Protocol for IPv4, NH for IPv6. */ | 566 | /* Protocol for IPv4, NH for IPv6. */ |
542 | u8 protocol; | 567 | u8 protocol; |
543 | 568 | ||
569 | /* Option length for IPv4, zero for IPv6. */ | ||
570 | u8 optlen; | ||
571 | |||
544 | /* Used by IPv6 only, zero for IPv4. */ | 572 | /* Used by IPv6 only, zero for IPv4. */ |
545 | u8 flow_lbl[3]; | 573 | u8 flow_lbl[3]; |
546 | }; | 574 | }; |
@@ -1300,6 +1328,7 @@ extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, | |||
1300 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | 1328 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); |
1301 | extern int xfrm_output_resume(struct sk_buff *skb, int err); | 1329 | extern int xfrm_output_resume(struct sk_buff *skb, int err); |
1302 | extern int xfrm_output(struct sk_buff *skb); | 1330 | extern int xfrm_output(struct sk_buff *skb); |
1331 | extern int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1303 | extern int xfrm4_extract_header(struct sk_buff *skb); | 1332 | extern int xfrm4_extract_header(struct sk_buff *skb); |
1304 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); | 1333 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); |
1305 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, | 1334 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, |