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 45332acac022..345a15084557 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1347,6 +1347,18 @@ struct xfrm_algo_desc { | |||
1347 | struct sadb_alg desc; | 1347 | struct sadb_alg desc; |
1348 | }; | 1348 | }; |
1349 | 1349 | ||
1350 | /* XFRM protocol handlers. */ | ||
1351 | struct xfrm4_protocol { | ||
1352 | int (*handler)(struct sk_buff *skb); | ||
1353 | int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi, | ||
1354 | int encap_type); | ||
1355 | int (*cb_handler)(struct sk_buff *skb, int err); | ||
1356 | int (*err_handler)(struct sk_buff *skb, u32 info); | ||
1357 | |||
1358 | struct xfrm4_protocol __rcu *next; | ||
1359 | int priority; | ||
1360 | }; | ||
1361 | |||
1350 | /* XFRM tunnel handlers. */ | 1362 | /* XFRM tunnel handlers. */ |
1351 | struct xfrm_tunnel { | 1363 | struct xfrm_tunnel { |
1352 | int (*handler)(struct sk_buff *skb); | 1364 | int (*handler)(struct sk_buff *skb); |
@@ -1498,13 +1510,18 @@ int xfrm4_rcv(struct sk_buff *skb); | |||
1498 | 1510 | ||
1499 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | 1511 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) |
1500 | { | 1512 | { |
1501 | return xfrm4_rcv_encap(skb, nexthdr, spi, 0); | 1513 | XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
1514 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); | ||
1515 | return xfrm_input(skb, nexthdr, spi, 0); | ||
1502 | } | 1516 | } |
1503 | 1517 | ||
1504 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1518 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1505 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1519 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1506 | int xfrm4_output(struct sk_buff *skb); | 1520 | int xfrm4_output(struct sk_buff *skb); |
1507 | int xfrm4_output_finish(struct sk_buff *skb); | 1521 | int xfrm4_output_finish(struct sk_buff *skb); |
1522 | int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); | ||
1523 | int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); | ||
1524 | int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol); | ||
1508 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); | 1525 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); |
1509 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); | 1526 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); |
1510 | void xfrm4_local_error(struct sk_buff *skb, u32 mtu); | 1527 | void xfrm4_local_error(struct sk_buff *skb, u32 mtu); |
@@ -1752,4 +1769,16 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) | |||
1752 | return ret; | 1769 | return ret; |
1753 | } | 1770 | } |
1754 | 1771 | ||
1772 | static inline int xfrm_rcv_cb(struct sk_buff *skb, unsigned int family, | ||
1773 | u8 protocol, int err) | ||
1774 | { | ||
1775 | switch(family) { | ||
1776 | #ifdef CONFIG_INET | ||
1777 | case AF_INET: | ||
1778 | return xfrm4_rcv_cb(skb, protocol, err); | ||
1779 | #endif | ||
1780 | } | ||
1781 | return 0; | ||
1782 | } | ||
1783 | |||
1755 | #endif /* _NET_XFRM_H */ | 1784 | #endif /* _NET_XFRM_H */ |