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.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0e844845f3f4..688f6f5d3285 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -186,7 +186,8 @@ struct xfrm_state
186 /* Reference to data common to all the instances of this 186 /* Reference to data common to all the instances of this
187 * transformer. */ 187 * transformer. */
188 struct xfrm_type *type; 188 struct xfrm_type *type;
189 struct xfrm_mode *mode; 189 struct xfrm_mode *inner_mode;
190 struct xfrm_mode *outer_mode;
190 191
191 /* Security context */ 192 /* Security context */
192 struct xfrm_sec_ctx *security; 193 struct xfrm_sec_ctx *security;
@@ -228,8 +229,6 @@ struct xfrm_type;
228struct xfrm_dst; 229struct xfrm_dst;
229struct xfrm_policy_afinfo { 230struct xfrm_policy_afinfo {
230 unsigned short family; 231 unsigned short family;
231 struct xfrm_type *type_map[IPPROTO_MAX];
232 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
233 struct dst_ops *dst_ops; 232 struct dst_ops *dst_ops;
234 void (*garbage_collect)(void); 233 void (*garbage_collect)(void);
235 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 234 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
@@ -255,7 +254,10 @@ extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid);
255extern int __xfrm_state_delete(struct xfrm_state *x); 254extern int __xfrm_state_delete(struct xfrm_state *x);
256 255
257struct xfrm_state_afinfo { 256struct xfrm_state_afinfo {
258 unsigned short family; 257 unsigned int family;
258 struct module *owner;
259 struct xfrm_type *type_map[IPPROTO_MAX];
260 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
259 int (*init_flags)(struct xfrm_state *x); 261 int (*init_flags)(struct xfrm_state *x);
260 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 262 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
261 struct xfrm_tmpl *tmpl, 263 struct xfrm_tmpl *tmpl,
@@ -267,8 +269,6 @@ struct xfrm_state_afinfo {
267 269
268extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 270extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
269extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); 271extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
270extern struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family);
271extern void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
272 272
273extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 273extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
274 274
@@ -295,8 +295,6 @@ struct xfrm_type
295 295
296extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 296extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
297extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 297extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
298extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family);
299extern void xfrm_put_type(struct xfrm_type *type);
300 298
301struct xfrm_mode { 299struct xfrm_mode {
302 int (*input)(struct xfrm_state *x, struct sk_buff *skb); 300 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
@@ -314,14 +312,19 @@ struct xfrm_mode {
314 */ 312 */
315 int (*output)(struct xfrm_state *x,struct sk_buff *skb); 313 int (*output)(struct xfrm_state *x,struct sk_buff *skb);
316 314
315 struct xfrm_state_afinfo *afinfo;
317 struct module *owner; 316 struct module *owner;
318 unsigned int encap; 317 unsigned int encap;
318 int flags;
319};
320
321/* Flags for xfrm_mode. */
322enum {
323 XFRM_MODE_FLAG_TUNNEL = 1,
319}; 324};
320 325
321extern int xfrm_register_mode(struct xfrm_mode *mode, int family); 326extern int xfrm_register_mode(struct xfrm_mode *mode, int family);
322extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); 327extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
323extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family);
324extern void xfrm_put_mode(struct xfrm_mode *mode);
325 328
326struct xfrm_tmpl 329struct xfrm_tmpl
327{ 330{
@@ -1046,11 +1049,19 @@ extern void xfrm_replay_notify(struct xfrm_state *x, int event);
1046extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1049extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1047extern int xfrm_init_state(struct xfrm_state *x); 1050extern int xfrm_init_state(struct xfrm_state *x);
1048extern int xfrm_output(struct sk_buff *skb); 1051extern int xfrm_output(struct sk_buff *skb);
1052extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1053 int encap_type);
1049extern int xfrm4_rcv(struct sk_buff *skb); 1054extern int xfrm4_rcv(struct sk_buff *skb);
1055
1056static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1057{
1058 return xfrm4_rcv_encap(skb, nexthdr, spi, 0);
1059}
1060
1050extern int xfrm4_output(struct sk_buff *skb); 1061extern int xfrm4_output(struct sk_buff *skb);
1051extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1062extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1052extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1063extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1053extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); 1064extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
1054extern int xfrm6_rcv(struct sk_buff *skb); 1065extern int xfrm6_rcv(struct sk_buff *skb);
1055extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1066extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1056 xfrm_address_t *saddr, u8 proto); 1067 xfrm_address_t *saddr, u8 proto);