diff options
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 48630b266593..b98d2056f27f 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 | ||
120 | struct 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. */ |
121 | struct xfrm_state | 131 | struct 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 | ||
457 | struct xfrm_policy_walk_entry { | ||
458 | struct list_head all; | ||
459 | u8 dead; | ||
460 | }; | ||
461 | |||
462 | struct xfrm_policy_walk { | ||
463 | struct xfrm_policy_walk_entry walk; | ||
464 | u8 type; | ||
465 | u32 seq; | ||
466 | }; | ||
467 | |||
452 | struct xfrm_policy | 468 | struct 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,13 +482,12 @@ 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 | }; |
@@ -1245,20 +1259,6 @@ struct xfrm6_tunnel { | |||
1245 | int priority; | 1259 | int priority; |
1246 | }; | 1260 | }; |
1247 | 1261 | ||
1248 | struct xfrm_state_walk { | ||
1249 | struct list_head list; | ||
1250 | unsigned long genid; | ||
1251 | struct xfrm_state *state; | ||
1252 | int count; | ||
1253 | u8 proto; | ||
1254 | }; | ||
1255 | |||
1256 | struct xfrm_policy_walk { | ||
1257 | struct xfrm_policy *policy; | ||
1258 | int count; | ||
1259 | u8 type, cur_type; | ||
1260 | }; | ||
1261 | |||
1262 | extern void xfrm_init(void); | 1262 | extern void xfrm_init(void); |
1263 | extern void xfrm4_init(void); | 1263 | extern void xfrm4_init(void); |
1264 | extern void xfrm_state_init(void); | 1264 | extern void xfrm_state_init(void); |
@@ -1410,24 +1410,10 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) | |||
1410 | 1410 | ||
1411 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 1411 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
1412 | 1412 | ||
1413 | static inline void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type) | 1413 | extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); |
1414 | { | ||
1415 | walk->cur_type = XFRM_POLICY_TYPE_MAIN; | ||
1416 | walk->type = type; | ||
1417 | walk->policy = NULL; | ||
1418 | walk->count = 0; | ||
1419 | } | ||
1420 | |||
1421 | static inline void xfrm_policy_walk_done(struct xfrm_policy_walk *walk) | ||
1422 | { | ||
1423 | if (walk->policy != NULL) { | ||
1424 | xfrm_pol_put(walk->policy); | ||
1425 | walk->policy = NULL; | ||
1426 | } | ||
1427 | } | ||
1428 | |||
1429 | extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, | 1414 | extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, |
1430 | int (*func)(struct xfrm_policy *, int, int, void*), void *); | 1415 | int (*func)(struct xfrm_policy *, int, int, void*), void *); |
1416 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); | ||
1431 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 1417 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
1432 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | 1418 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, |
1433 | struct xfrm_selector *sel, | 1419 | struct xfrm_selector *sel, |