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.h91
1 files changed, 41 insertions, 50 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 4bb94992b5fa..11c890ad8ebb 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -117,12 +117,21 @@ extern struct mutex xfrm_cfg_mutex;
117 metrics. Plus, it will be made via sk->sk_dst_cache. Solved. 117 metrics. Plus, it will be made via sk->sk_dst_cache. Solved.
118 */ 118 */
119 119
120struct xfrm_state_walk {
121 struct list_head all;
122 u8 state;
123 union {
124 u8 dying;
125 u8 proto;
126 };
127 u32 seq;
128};
129
120/* Full description of state of transformer. */ 130/* Full description of state of transformer. */
121struct xfrm_state 131struct xfrm_state
122{ 132{
123 struct list_head all;
124 union { 133 union {
125 struct list_head gclist; 134 struct hlist_node gclist;
126 struct hlist_node bydst; 135 struct hlist_node bydst;
127 }; 136 };
128 struct hlist_node bysrc; 137 struct hlist_node bysrc;
@@ -136,12 +145,8 @@ struct xfrm_state
136 145
137 u32 genid; 146 u32 genid;
138 147
139 /* Key manger bits */ 148 /* Key manager bits */
140 struct { 149 struct xfrm_state_walk km;
141 u8 state;
142 u8 dying;
143 u32 seq;
144 } km;
145 150
146 /* Parameters of this state. */ 151 /* Parameters of this state. */
147 struct { 152 struct {
@@ -449,10 +454,20 @@ struct xfrm_tmpl
449 454
450#define XFRM_MAX_DEPTH 6 455#define XFRM_MAX_DEPTH 6
451 456
457struct xfrm_policy_walk_entry {
458 struct list_head all;
459 u8 dead;
460};
461
462struct xfrm_policy_walk {
463 struct xfrm_policy_walk_entry walk;
464 u8 type;
465 u32 seq;
466};
467
452struct xfrm_policy 468struct xfrm_policy
453{ 469{
454 struct xfrm_policy *next; 470 struct xfrm_policy *next;
455 struct list_head bytype;
456 struct hlist_node bydst; 471 struct hlist_node bydst;
457 struct hlist_node byidx; 472 struct hlist_node byidx;
458 473
@@ -467,17 +482,23 @@ struct xfrm_policy
467 struct xfrm_lifetime_cfg lft; 482 struct xfrm_lifetime_cfg lft;
468 struct xfrm_lifetime_cur curlft; 483 struct xfrm_lifetime_cur curlft;
469 struct dst_entry *bundles; 484 struct dst_entry *bundles;
470 u16 family; 485 struct xfrm_policy_walk_entry walk;
471 u8 type; 486 u8 type;
472 u8 action; 487 u8 action;
473 u8 flags; 488 u8 flags;
474 u8 dead;
475 u8 xfrm_nr; 489 u8 xfrm_nr;
476 /* XXX 1 byte hole, try to pack */ 490 u16 family;
477 struct xfrm_sec_ctx *security; 491 struct xfrm_sec_ctx *security;
478 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 492 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
479}; 493};
480 494
495struct xfrm_kmaddress {
496 xfrm_address_t local;
497 xfrm_address_t remote;
498 u32 reserved;
499 u16 family;
500};
501
481struct xfrm_migrate { 502struct xfrm_migrate {
482 xfrm_address_t old_daddr; 503 xfrm_address_t old_daddr;
483 xfrm_address_t old_saddr; 504 xfrm_address_t old_saddr;
@@ -517,7 +538,7 @@ struct xfrm_mgr
517 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 538 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
518 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 539 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
519 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 540 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
520 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles); 541 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
521}; 542};
522 543
523extern int xfrm_register_km(struct xfrm_mgr *km); 544extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -1245,18 +1266,6 @@ struct xfrm6_tunnel {
1245 int priority; 1266 int priority;
1246}; 1267};
1247 1268
1248struct xfrm_state_walk {
1249 struct xfrm_state *state;
1250 int count;
1251 u8 proto;
1252};
1253
1254struct xfrm_policy_walk {
1255 struct xfrm_policy *policy;
1256 int count;
1257 u8 type, cur_type;
1258};
1259
1260extern void xfrm_init(void); 1269extern void xfrm_init(void);
1261extern void xfrm4_init(void); 1270extern void xfrm4_init(void);
1262extern void xfrm_state_init(void); 1271extern void xfrm_state_init(void);
@@ -1281,13 +1290,7 @@ static inline void xfrm6_fini(void)
1281extern int xfrm_proc_init(void); 1290extern int xfrm_proc_init(void);
1282#endif 1291#endif
1283 1292
1284static inline void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto) 1293extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1285{
1286 walk->proto = proto;
1287 walk->state = NULL;
1288 walk->count = 0;
1289}
1290
1291extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1294extern int xfrm_state_walk(struct xfrm_state_walk *walk,
1292 int (*func)(struct xfrm_state *, int, void*), void *); 1295 int (*func)(struct xfrm_state *, int, void*), void *);
1293extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1296extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
@@ -1414,24 +1417,10 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1414 1417
1415struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1418struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
1416 1419
1417static inline void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type) 1420extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1418{
1419 walk->cur_type = XFRM_POLICY_TYPE_MAIN;
1420 walk->type = type;
1421 walk->policy = NULL;
1422 walk->count = 0;
1423}
1424
1425static inline void xfrm_policy_walk_done(struct xfrm_policy_walk *walk)
1426{
1427 if (walk->policy != NULL) {
1428 xfrm_pol_put(walk->policy);
1429 walk->policy = NULL;
1430 }
1431}
1432
1433extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, 1421extern int xfrm_policy_walk(struct xfrm_policy_walk *walk,
1434 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1422 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1423extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1435int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1424int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1436struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1425struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
1437 struct xfrm_selector *sel, 1426 struct xfrm_selector *sel,
@@ -1450,12 +1439,14 @@ extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1450 1439
1451#ifdef CONFIG_XFRM_MIGRATE 1440#ifdef CONFIG_XFRM_MIGRATE
1452extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1441extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1453 struct xfrm_migrate *m, int num_bundles); 1442 struct xfrm_migrate *m, int num_bundles,
1443 struct xfrm_kmaddress *k);
1454extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1444extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m);
1455extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1445extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x,
1456 struct xfrm_migrate *m); 1446 struct xfrm_migrate *m);
1457extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1447extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1458 struct xfrm_migrate *m, int num_bundles); 1448 struct xfrm_migrate *m, int num_bundles,
1449 struct xfrm_kmaddress *k);
1459#endif 1450#endif
1460 1451
1461extern wait_queue_head_t km_waitq; 1452extern wait_queue_head_t km_waitq;