aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h31
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. */
1351struct 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. */
1351struct xfrm_tunnel { 1363struct 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
1499static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1511static 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
1504int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1518int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1505int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1519int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1506int xfrm4_output(struct sk_buff *skb); 1520int xfrm4_output(struct sk_buff *skb);
1507int xfrm4_output_finish(struct sk_buff *skb); 1521int xfrm4_output_finish(struct sk_buff *skb);
1522int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1523int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
1524int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
1508int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1525int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1509int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1526int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1510void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1527void 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
1772static 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 */