diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:15:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:15:16 -0500 |
commit | 673c09be457bb23aa0eaaa79804cbb342210d195 (patch) | |
tree | 9948d1859bbcd07316f5cea239b86845d6061570 /include/net/xfrm.h | |
parent | d62ddc21b674b5ac1466091ff3fbf7baa53bc92c (diff) |
netns xfrm: add struct xfrm_state::xs_net
To avoid unnecessary complications with passing netns around.
* set once, very early after allocating
* once set, never changes
For a while create every xfrm_state in init_net.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 9107d6f5c297..9da89039832c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -130,6 +130,9 @@ struct xfrm_state_walk { | |||
130 | /* Full description of state of transformer. */ | 130 | /* Full description of state of transformer. */ |
131 | struct xfrm_state | 131 | struct xfrm_state |
132 | { | 132 | { |
133 | #ifdef CONFIG_NET_NS | ||
134 | struct net *xs_net; | ||
135 | #endif | ||
133 | union { | 136 | union { |
134 | struct hlist_node gclist; | 137 | struct hlist_node gclist; |
135 | struct hlist_node bydst; | 138 | struct hlist_node bydst; |
@@ -223,6 +226,11 @@ struct xfrm_state | |||
223 | void *data; | 226 | void *data; |
224 | }; | 227 | }; |
225 | 228 | ||
229 | static inline struct net *xs_net(struct xfrm_state *x) | ||
230 | { | ||
231 | return read_pnet(&x->xs_net); | ||
232 | } | ||
233 | |||
226 | /* xflags - make enum if more show up */ | 234 | /* xflags - make enum if more show up */ |
227 | #define XFRM_TIME_DEFER 1 | 235 | #define XFRM_TIME_DEFER 1 |
228 | 236 | ||
@@ -1296,7 +1304,7 @@ extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); | |||
1296 | extern int xfrm_state_walk(struct xfrm_state_walk *walk, | 1304 | extern int xfrm_state_walk(struct xfrm_state_walk *walk, |
1297 | int (*func)(struct xfrm_state *, int, void*), void *); | 1305 | int (*func)(struct xfrm_state *, int, void*), void *); |
1298 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); | 1306 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); |
1299 | extern struct xfrm_state *xfrm_state_alloc(void); | 1307 | extern struct xfrm_state *xfrm_state_alloc(struct net *net); |
1300 | extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | 1308 | extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, |
1301 | struct flowi *fl, struct xfrm_tmpl *tmpl, | 1309 | struct flowi *fl, struct xfrm_tmpl *tmpl, |
1302 | struct xfrm_policy *pol, int *err, | 1310 | struct xfrm_policy *pol, int *err, |