]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _NET_XFRM_H |
2 | #define _NET_XFRM_H | |
3 | ||
aabc9761 | 4 | #include <linux/compiler.h> |
14c85021 | 5 | #include <linux/in.h> |
1da177e4 LT |
6 | #include <linux/xfrm.h> |
7 | #include <linux/spinlock.h> | |
8 | #include <linux/list.h> | |
9 | #include <linux/skbuff.h> | |
14c85021 | 10 | #include <linux/socket.h> |
1da177e4 LT |
11 | #include <linux/pfkeyv2.h> |
12 | #include <linux/in6.h> | |
4a3e2f71 | 13 | #include <linux/mutex.h> |
1da177e4 LT |
14 | |
15 | #include <net/sock.h> | |
16 | #include <net/dst.h> | |
17 | #include <net/route.h> | |
18 | #include <net/ipv6.h> | |
19 | #include <net/ip6_fib.h> | |
20 | ||
21 | #define XFRM_ALIGN8(len) (((len) + 7) & ~7) | |
b59f45d0 HX |
22 | #define MODULE_ALIAS_XFRM_MODE(family, encap) \ |
23 | MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) | |
1da177e4 | 24 | |
f8cd5488 JHS |
25 | extern struct sock *xfrm_nl; |
26 | extern u32 sysctl_xfrm_aevent_etime; | |
27 | extern u32 sysctl_xfrm_aevent_rseqth; | |
28 | ||
4a3e2f71 | 29 | extern struct mutex xfrm_cfg_mutex; |
1da177e4 LT |
30 | |
31 | /* Organization of SPD aka "XFRM rules" | |
32 | ------------------------------------ | |
33 | ||
34 | Basic objects: | |
35 | - policy rule, struct xfrm_policy (=SPD entry) | |
36 | - bundle of transformations, struct dst_entry == struct xfrm_dst (=SA bundle) | |
37 | - instance of a transformer, struct xfrm_state (=SA) | |
38 | - template to clone xfrm_state, struct xfrm_tmpl | |
39 | ||
40 | SPD is plain linear list of xfrm_policy rules, ordered by priority. | |
41 | (To be compatible with existing pfkeyv2 implementations, | |
42 | many rules with priority of 0x7fffffff are allowed to exist and | |
43 | such rules are ordered in an unpredictable way, thanks to bsd folks.) | |
44 | ||
45 | Lookup is plain linear search until the first match with selector. | |
46 | ||
47 | If "action" is "block", then we prohibit the flow, otherwise: | |
48 | if "xfrms_nr" is zero, the flow passes untransformed. Otherwise, | |
49 | policy entry has list of up to XFRM_MAX_DEPTH transformations, | |
50 | described by templates xfrm_tmpl. Each template is resolved | |
51 | to a complete xfrm_state (see below) and we pack bundle of transformations | |
52 | to a dst_entry returned to requestor. | |
53 | ||
54 | dst -. xfrm .-> xfrm_state #1 | |
55 | |---. child .-> dst -. xfrm .-> xfrm_state #2 | |
56 | |---. child .-> dst -. xfrm .-> xfrm_state #3 | |
57 | |---. child .-> NULL | |
58 | ||
59 | Bundles are cached at xrfm_policy struct (field ->bundles). | |
60 | ||
61 | ||
62 | Resolution of xrfm_tmpl | |
63 | ----------------------- | |
64 | Template contains: | |
65 | 1. ->mode Mode: transport or tunnel | |
66 | 2. ->id.proto Protocol: AH/ESP/IPCOMP | |
67 | 3. ->id.daddr Remote tunnel endpoint, ignored for transport mode. | |
68 | Q: allow to resolve security gateway? | |
69 | 4. ->id.spi If not zero, static SPI. | |
70 | 5. ->saddr Local tunnel endpoint, ignored for transport mode. | |
71 | 6. ->algos List of allowed algos. Plain bitmask now. | |
72 | Q: ealgos, aalgos, calgos. What a mess... | |
73 | 7. ->share Sharing mode. | |
74 | Q: how to implement private sharing mode? To add struct sock* to | |
75 | flow id? | |
76 | ||
77 | Having this template we search through SAD searching for entries | |
78 | with appropriate mode/proto/algo, permitted by selector. | |
79 | If no appropriate entry found, it is requested from key manager. | |
80 | ||
81 | PROBLEMS: | |
82 | Q: How to find all the bundles referring to a physical path for | |
83 | PMTU discovery? Seems, dst should contain list of all parents... | |
84 | and enter to infinite locking hierarchy disaster. | |
85 | No! It is easier, we will not search for them, let them find us. | |
86 | We add genid to each dst plus pointer to genid of raw IP route, | |
87 | pmtu disc will update pmtu on raw IP route and increase its genid. | |
88 | dst_check() will see this for top level and trigger resyncing | |
89 | metrics. Plus, it will be made via sk->sk_dst_cache. Solved. | |
90 | */ | |
91 | ||
92 | /* Full description of state of transformer. */ | |
93 | struct xfrm_state | |
94 | { | |
95 | /* Note: bydst is re-used during gc */ | |
96 | struct list_head bydst; | |
97 | struct list_head byspi; | |
98 | ||
99 | atomic_t refcnt; | |
100 | spinlock_t lock; | |
101 | ||
102 | struct xfrm_id id; | |
103 | struct xfrm_selector sel; | |
104 | ||
105 | /* Key manger bits */ | |
106 | struct { | |
107 | u8 state; | |
108 | u8 dying; | |
109 | u32 seq; | |
110 | } km; | |
111 | ||
112 | /* Parameters of this state. */ | |
113 | struct { | |
114 | u32 reqid; | |
115 | u8 mode; | |
116 | u8 replay_window; | |
117 | u8 aalgo, ealgo, calgo; | |
118 | u8 flags; | |
119 | u16 family; | |
120 | xfrm_address_t saddr; | |
121 | int header_len; | |
122 | int trailer_len; | |
123 | } props; | |
124 | ||
125 | struct xfrm_lifetime_cfg lft; | |
126 | ||
127 | /* Data for transformer */ | |
128 | struct xfrm_algo *aalg; | |
129 | struct xfrm_algo *ealg; | |
130 | struct xfrm_algo *calg; | |
131 | ||
132 | /* Data for encapsulator */ | |
133 | struct xfrm_encap_tmpl *encap; | |
134 | ||
135 | /* IPComp needs an IPIP tunnel for handling uncompressed packets */ | |
136 | struct xfrm_state *tunnel; | |
137 | ||
138 | /* If a tunnel, number of users + 1 */ | |
139 | atomic_t tunnel_users; | |
140 | ||
141 | /* State for replay detection */ | |
142 | struct xfrm_replay_state replay; | |
143 | ||
f8cd5488 JHS |
144 | /* Replay detection state at the time we sent the last notification */ |
145 | struct xfrm_replay_state preplay; | |
146 | ||
2717096a JHS |
147 | /* internal flag that only holds state for delayed aevent at the |
148 | * moment | |
149 | */ | |
150 | u32 xflags; | |
151 | ||
f8cd5488 JHS |
152 | /* Replay detection notification settings */ |
153 | u32 replay_maxage; | |
154 | u32 replay_maxdiff; | |
155 | ||
156 | /* Replay detection notification timer */ | |
157 | struct timer_list rtimer; | |
158 | ||
1da177e4 LT |
159 | /* Statistics */ |
160 | struct xfrm_stats stats; | |
161 | ||
162 | struct xfrm_lifetime_cur curlft; | |
163 | struct timer_list timer; | |
164 | ||
165 | /* Reference to data common to all the instances of this | |
166 | * transformer. */ | |
167 | struct xfrm_type *type; | |
b59f45d0 | 168 | struct xfrm_mode *mode; |
1da177e4 | 169 | |
df71837d TJ |
170 | /* Security context */ |
171 | struct xfrm_sec_ctx *security; | |
172 | ||
1da177e4 LT |
173 | /* Private data of this transformer, format is opaque, |
174 | * interpreted by xfrm_type methods. */ | |
175 | void *data; | |
176 | }; | |
177 | ||
2717096a JHS |
178 | /* xflags - make enum if more show up */ |
179 | #define XFRM_TIME_DEFER 1 | |
180 | ||
1da177e4 LT |
181 | enum { |
182 | XFRM_STATE_VOID, | |
183 | XFRM_STATE_ACQ, | |
184 | XFRM_STATE_VALID, | |
185 | XFRM_STATE_ERROR, | |
186 | XFRM_STATE_EXPIRED, | |
187 | XFRM_STATE_DEAD | |
188 | }; | |
189 | ||
26b15dad JHS |
190 | /* callback structure passed from either netlink or pfkey */ |
191 | struct km_event | |
192 | { | |
bf08867f HX |
193 | union { |
194 | u32 hard; | |
195 | u32 proto; | |
196 | u32 byid; | |
f8cd5488 | 197 | u32 aevent; |
bf08867f HX |
198 | } data; |
199 | ||
26b15dad JHS |
200 | u32 seq; |
201 | u32 pid; | |
202 | u32 event; | |
203 | }; | |
204 | ||
1da177e4 LT |
205 | struct xfrm_type; |
206 | struct xfrm_dst; | |
207 | struct xfrm_policy_afinfo { | |
208 | unsigned short family; | |
73654d61 | 209 | struct xfrm_type *type_map[IPPROTO_MAX]; |
b59f45d0 | 210 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
1da177e4 LT |
211 | struct dst_ops *dst_ops; |
212 | void (*garbage_collect)(void); | |
213 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | |
214 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | |
215 | int (*bundle_create)(struct xfrm_policy *policy, | |
216 | struct xfrm_state **xfrm, | |
217 | int nx, | |
218 | struct flowi *fl, | |
219 | struct dst_entry **dst_p); | |
220 | void (*decode_session)(struct sk_buff *skb, | |
221 | struct flowi *fl); | |
222 | }; | |
223 | ||
224 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | |
225 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); | |
26b15dad JHS |
226 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); |
227 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); | |
1da177e4 LT |
228 | #define XFRM_ACQ_EXPIRES 30 |
229 | ||
230 | struct xfrm_tmpl; | |
980ebd25 | 231 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); |
53bc6b4d JHS |
232 | extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid); |
233 | extern int __xfrm_state_delete(struct xfrm_state *x); | |
234 | ||
1da177e4 LT |
235 | struct xfrm_state_afinfo { |
236 | unsigned short family; | |
1da177e4 LT |
237 | struct list_head *state_bydst; |
238 | struct list_head *state_byspi; | |
d094cd83 | 239 | int (*init_flags)(struct xfrm_state *x); |
1da177e4 LT |
240 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, |
241 | struct xfrm_tmpl *tmpl, | |
242 | xfrm_address_t *daddr, xfrm_address_t *saddr); | |
243 | struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto); | |
244 | struct xfrm_state *(*find_acq)(u8 mode, u32 reqid, u8 proto, | |
245 | xfrm_address_t *daddr, xfrm_address_t *saddr, | |
246 | int create); | |
247 | }; | |
248 | ||
249 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); | |
250 | extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); | |
251 | ||
252 | extern void xfrm_state_delete_tunnel(struct xfrm_state *x); | |
253 | ||
1da177e4 LT |
254 | struct xfrm_type |
255 | { | |
256 | char *description; | |
257 | struct module *owner; | |
258 | __u8 proto; | |
259 | ||
72cb6962 | 260 | int (*init_state)(struct xfrm_state *x); |
1da177e4 | 261 | void (*destructor)(struct xfrm_state *); |
e695633e | 262 | int (*input)(struct xfrm_state *, struct sk_buff *skb); |
1da177e4 LT |
263 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
264 | /* Estimate maximal size of result of transformation of a dgram */ | |
265 | u32 (*get_max_size)(struct xfrm_state *, int size); | |
266 | }; | |
267 | ||
1da177e4 LT |
268 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); |
269 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); | |
270 | extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); | |
271 | extern void xfrm_put_type(struct xfrm_type *type); | |
272 | ||
b59f45d0 HX |
273 | struct xfrm_mode { |
274 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | |
275 | int (*output)(struct sk_buff *skb); | |
276 | ||
277 | struct module *owner; | |
278 | unsigned int encap; | |
279 | }; | |
280 | ||
281 | extern int xfrm_register_mode(struct xfrm_mode *mode, int family); | |
282 | extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); | |
283 | extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family); | |
284 | extern void xfrm_put_mode(struct xfrm_mode *mode); | |
285 | ||
1da177e4 LT |
286 | struct xfrm_tmpl |
287 | { | |
288 | /* id in template is interpreted as: | |
289 | * daddr - destination of tunnel, may be zero for transport mode. | |
290 | * spi - zero to acquire spi. Not zero if spi is static, then | |
291 | * daddr must be fixed too. | |
292 | * proto - AH/ESP/IPCOMP | |
293 | */ | |
294 | struct xfrm_id id; | |
295 | ||
296 | /* Source address of tunnel. Ignored, if it is not a tunnel. */ | |
297 | xfrm_address_t saddr; | |
298 | ||
299 | __u32 reqid; | |
300 | ||
301 | /* Mode: transport/tunnel */ | |
302 | __u8 mode; | |
303 | ||
304 | /* Sharing mode: unique, this session only, this user only etc. */ | |
305 | __u8 share; | |
306 | ||
307 | /* May skip this transfomration if no SA is found */ | |
308 | __u8 optional; | |
309 | ||
310 | /* Bit mask of algos allowed for acquisition */ | |
311 | __u32 aalgos; | |
312 | __u32 ealgos; | |
313 | __u32 calgos; | |
314 | }; | |
315 | ||
316 | #define XFRM_MAX_DEPTH 4 | |
317 | ||
318 | struct xfrm_policy | |
319 | { | |
320 | struct xfrm_policy *next; | |
321 | struct list_head list; | |
322 | ||
323 | /* This lock only affects elements except for entry. */ | |
324 | rwlock_t lock; | |
325 | atomic_t refcnt; | |
326 | struct timer_list timer; | |
327 | ||
328 | u32 priority; | |
329 | u32 index; | |
330 | struct xfrm_selector selector; | |
331 | struct xfrm_lifetime_cfg lft; | |
332 | struct xfrm_lifetime_cur curlft; | |
333 | struct dst_entry *bundles; | |
334 | __u16 family; | |
335 | __u8 action; | |
336 | __u8 flags; | |
337 | __u8 dead; | |
338 | __u8 xfrm_nr; | |
df71837d | 339 | struct xfrm_sec_ctx *security; |
1da177e4 LT |
340 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; |
341 | }; | |
342 | ||
f8cd5488 JHS |
343 | #define XFRM_KM_TIMEOUT 30 |
344 | /* which seqno */ | |
345 | #define XFRM_REPLAY_SEQ 1 | |
346 | #define XFRM_REPLAY_OSEQ 2 | |
347 | #define XFRM_REPLAY_SEQ_MASK 3 | |
348 | /* what happened */ | |
349 | #define XFRM_REPLAY_UPDATE XFRM_AE_CR | |
350 | #define XFRM_REPLAY_TIMEOUT XFRM_AE_CE | |
351 | ||
352 | /* default aevent timeout in units of 100ms */ | |
353 | #define XFRM_AE_ETIME 10 | |
354 | /* Async Event timer multiplier */ | |
355 | #define XFRM_AE_ETH_M 10 | |
356 | /* default seq threshold size */ | |
357 | #define XFRM_AE_SEQT_SIZE 2 | |
1da177e4 LT |
358 | |
359 | struct xfrm_mgr | |
360 | { | |
361 | struct list_head list; | |
362 | char *id; | |
26b15dad | 363 | int (*notify)(struct xfrm_state *x, struct km_event *c); |
1da177e4 | 364 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); |
cb969f07 | 365 | struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); |
1da177e4 | 366 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
26b15dad | 367 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); |
1da177e4 LT |
368 | }; |
369 | ||
370 | extern int xfrm_register_km(struct xfrm_mgr *km); | |
371 | extern int xfrm_unregister_km(struct xfrm_mgr *km); | |
372 | ||
373 | ||
374 | extern struct xfrm_policy *xfrm_policy_list[XFRM_POLICY_MAX*2]; | |
375 | ||
376 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | |
377 | { | |
378 | if (likely(policy != NULL)) | |
379 | atomic_inc(&policy->refcnt); | |
380 | } | |
381 | ||
382 | extern void __xfrm_policy_destroy(struct xfrm_policy *policy); | |
383 | ||
384 | static inline void xfrm_pol_put(struct xfrm_policy *policy) | |
385 | { | |
386 | if (atomic_dec_and_test(&policy->refcnt)) | |
387 | __xfrm_policy_destroy(policy); | |
388 | } | |
389 | ||
390 | #define XFRM_DST_HSIZE 1024 | |
391 | ||
392 | static __inline__ | |
393 | unsigned __xfrm4_dst_hash(xfrm_address_t *addr) | |
394 | { | |
395 | unsigned h; | |
396 | h = ntohl(addr->a4); | |
397 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | |
398 | return h; | |
399 | } | |
400 | ||
401 | static __inline__ | |
402 | unsigned __xfrm6_dst_hash(xfrm_address_t *addr) | |
403 | { | |
404 | unsigned h; | |
405 | h = ntohl(addr->a6[2]^addr->a6[3]); | |
406 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | |
407 | return h; | |
408 | } | |
409 | ||
410 | static __inline__ | |
411 | unsigned xfrm_dst_hash(xfrm_address_t *addr, unsigned short family) | |
412 | { | |
413 | switch (family) { | |
414 | case AF_INET: | |
415 | return __xfrm4_dst_hash(addr); | |
416 | case AF_INET6: | |
417 | return __xfrm6_dst_hash(addr); | |
418 | } | |
419 | return 0; | |
420 | } | |
421 | ||
422 | static __inline__ | |
423 | unsigned __xfrm4_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | |
424 | { | |
425 | unsigned h; | |
426 | h = ntohl(addr->a4^spi^proto); | |
427 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | |
428 | return h; | |
429 | } | |
430 | ||
431 | static __inline__ | |
432 | unsigned __xfrm6_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | |
433 | { | |
434 | unsigned h; | |
435 | h = ntohl(addr->a6[2]^addr->a6[3]^spi^proto); | |
436 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | |
437 | return h; | |
438 | } | |
439 | ||
440 | static __inline__ | |
441 | unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short family) | |
442 | { | |
443 | switch (family) { | |
444 | case AF_INET: | |
445 | return __xfrm4_spi_hash(addr, spi, proto); | |
446 | case AF_INET6: | |
447 | return __xfrm6_spi_hash(addr, spi, proto); | |
448 | } | |
449 | return 0; /*XXX*/ | |
450 | } | |
451 | ||
452 | extern void __xfrm_state_destroy(struct xfrm_state *); | |
453 | ||
21380b81 HX |
454 | static inline void __xfrm_state_put(struct xfrm_state *x) |
455 | { | |
456 | atomic_dec(&x->refcnt); | |
457 | } | |
458 | ||
1da177e4 LT |
459 | static inline void xfrm_state_put(struct xfrm_state *x) |
460 | { | |
461 | if (atomic_dec_and_test(&x->refcnt)) | |
462 | __xfrm_state_destroy(x); | |
463 | } | |
464 | ||
465 | static inline void xfrm_state_hold(struct xfrm_state *x) | |
466 | { | |
467 | atomic_inc(&x->refcnt); | |
468 | } | |
469 | ||
470 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |
471 | { | |
472 | __u32 *a1 = token1; | |
473 | __u32 *a2 = token2; | |
474 | int pdw; | |
475 | int pbi; | |
476 | ||
477 | pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ | |
478 | pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ | |
479 | ||
480 | if (pdw) | |
481 | if (memcmp(a1, a2, pdw << 2)) | |
482 | return 0; | |
483 | ||
484 | if (pbi) { | |
485 | __u32 mask; | |
486 | ||
487 | mask = htonl((0xffffffff) << (32 - pbi)); | |
488 | ||
489 | if ((a1[pdw] ^ a2[pdw]) & mask) | |
490 | return 0; | |
491 | } | |
492 | ||
493 | return 1; | |
494 | } | |
495 | ||
496 | static __inline__ | |
497 | u16 xfrm_flowi_sport(struct flowi *fl) | |
498 | { | |
499 | u16 port; | |
500 | switch(fl->proto) { | |
501 | case IPPROTO_TCP: | |
502 | case IPPROTO_UDP: | |
503 | case IPPROTO_SCTP: | |
504 | port = fl->fl_ip_sport; | |
505 | break; | |
506 | case IPPROTO_ICMP: | |
507 | case IPPROTO_ICMPV6: | |
508 | port = htons(fl->fl_icmp_type); | |
509 | break; | |
510 | default: | |
511 | port = 0; /*XXX*/ | |
512 | } | |
513 | return port; | |
514 | } | |
515 | ||
516 | static __inline__ | |
517 | u16 xfrm_flowi_dport(struct flowi *fl) | |
518 | { | |
519 | u16 port; | |
520 | switch(fl->proto) { | |
521 | case IPPROTO_TCP: | |
522 | case IPPROTO_UDP: | |
523 | case IPPROTO_SCTP: | |
524 | port = fl->fl_ip_dport; | |
525 | break; | |
526 | case IPPROTO_ICMP: | |
527 | case IPPROTO_ICMPV6: | |
528 | port = htons(fl->fl_icmp_code); | |
529 | break; | |
530 | default: | |
531 | port = 0; /*XXX*/ | |
532 | } | |
533 | return port; | |
534 | } | |
535 | ||
536 | static inline int | |
537 | __xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) | |
538 | { | |
539 | return addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) && | |
540 | addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) && | |
541 | !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) && | |
542 | !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) && | |
543 | (fl->proto == sel->proto || !sel->proto) && | |
544 | (fl->oif == sel->ifindex || !sel->ifindex); | |
545 | } | |
546 | ||
547 | static inline int | |
548 | __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl) | |
549 | { | |
550 | return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) && | |
551 | addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) && | |
552 | !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) && | |
553 | !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) && | |
554 | (fl->proto == sel->proto || !sel->proto) && | |
555 | (fl->oif == sel->ifindex || !sel->ifindex); | |
556 | } | |
557 | ||
558 | static inline int | |
559 | xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | |
560 | unsigned short family) | |
561 | { | |
562 | switch (family) { | |
563 | case AF_INET: | |
564 | return __xfrm4_selector_match(sel, fl); | |
565 | case AF_INET6: | |
566 | return __xfrm6_selector_match(sel, fl); | |
567 | } | |
568 | return 0; | |
569 | } | |
570 | ||
df71837d TJ |
571 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
572 | /* If neither has a context --> match | |
573 | * Otherwise, both must have a context and the sids, doi, alg must match | |
574 | */ | |
575 | static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) | |
576 | { | |
577 | return ((!s1 && !s2) || | |
578 | (s1 && s2 && | |
579 | (s1->ctx_sid == s2->ctx_sid) && | |
580 | (s1->ctx_doi == s2->ctx_doi) && | |
581 | (s1->ctx_alg == s2->ctx_alg))); | |
582 | } | |
583 | #else | |
584 | static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) | |
585 | { | |
586 | return 1; | |
587 | } | |
588 | #endif | |
589 | ||
1da177e4 LT |
590 | /* A struct encoding bundle of transformations to apply to some set of flow. |
591 | * | |
592 | * dst->child points to the next element of bundle. | |
593 | * dst->xfrm points to an instanse of transformer. | |
594 | * | |
595 | * Due to unfortunate limitations of current routing cache, which we | |
596 | * have no time to fix, it mirrors struct rtable and bound to the same | |
597 | * routing key, including saddr,daddr. However, we can have many of | |
598 | * bundles differing by session id. All the bundles grow from a parent | |
599 | * policy rule. | |
600 | */ | |
601 | struct xfrm_dst | |
602 | { | |
603 | union { | |
604 | struct xfrm_dst *next; | |
605 | struct dst_entry dst; | |
606 | struct rtable rt; | |
607 | struct rt6_info rt6; | |
608 | } u; | |
609 | struct dst_entry *route; | |
610 | u32 route_mtu_cached; | |
611 | u32 child_mtu_cached; | |
92d63dec HY |
612 | u32 route_cookie; |
613 | u32 path_cookie; | |
1da177e4 LT |
614 | }; |
615 | ||
aabc9761 HX |
616 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) |
617 | { | |
618 | dst_release(xdst->route); | |
619 | if (likely(xdst->u.dst.xfrm)) | |
620 | xfrm_state_put(xdst->u.dst.xfrm); | |
621 | } | |
622 | ||
623 | extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); | |
624 | ||
1da177e4 LT |
625 | struct sec_path |
626 | { | |
627 | atomic_t refcnt; | |
628 | int len; | |
dbe5b4aa | 629 | struct xfrm_state *xvec[XFRM_MAX_DEPTH]; |
1da177e4 LT |
630 | }; |
631 | ||
632 | static inline struct sec_path * | |
633 | secpath_get(struct sec_path *sp) | |
634 | { | |
635 | if (sp) | |
636 | atomic_inc(&sp->refcnt); | |
637 | return sp; | |
638 | } | |
639 | ||
640 | extern void __secpath_destroy(struct sec_path *sp); | |
641 | ||
642 | static inline void | |
643 | secpath_put(struct sec_path *sp) | |
644 | { | |
645 | if (sp && atomic_dec_and_test(&sp->refcnt)) | |
646 | __secpath_destroy(sp); | |
647 | } | |
648 | ||
649 | extern struct sec_path *secpath_dup(struct sec_path *src); | |
650 | ||
651 | static inline void | |
652 | secpath_reset(struct sk_buff *skb) | |
653 | { | |
654 | #ifdef CONFIG_XFRM | |
655 | secpath_put(skb->sp); | |
656 | skb->sp = NULL; | |
657 | #endif | |
658 | } | |
659 | ||
660 | static inline int | |
661 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | |
662 | { | |
663 | return (tmpl->saddr.a4 && | |
664 | tmpl->saddr.a4 != x->props.saddr.a4); | |
665 | } | |
666 | ||
667 | static inline int | |
668 | __xfrm6_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | |
669 | { | |
670 | return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && | |
671 | ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); | |
672 | } | |
673 | ||
674 | static inline int | |
675 | xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) | |
676 | { | |
677 | switch (family) { | |
678 | case AF_INET: | |
679 | return __xfrm4_state_addr_cmp(tmpl, x); | |
680 | case AF_INET6: | |
681 | return __xfrm6_state_addr_cmp(tmpl, x); | |
682 | } | |
683 | return !0; | |
684 | } | |
685 | ||
686 | #ifdef CONFIG_XFRM | |
687 | ||
688 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); | |
689 | ||
690 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | |
691 | { | |
692 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) | |
693 | return __xfrm_policy_check(sk, dir, skb, family); | |
694 | ||
695 | return (!xfrm_policy_list[dir] && !skb->sp) || | |
696 | (skb->dst->flags & DST_NOPOLICY) || | |
697 | __xfrm_policy_check(sk, dir, skb, family); | |
698 | } | |
699 | ||
700 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | |
701 | { | |
702 | return xfrm_policy_check(sk, dir, skb, AF_INET); | |
703 | } | |
704 | ||
705 | static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | |
706 | { | |
707 | return xfrm_policy_check(sk, dir, skb, AF_INET6); | |
708 | } | |
709 | ||
3e3850e9 | 710 | extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family); |
1da177e4 LT |
711 | extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); |
712 | ||
713 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |
714 | { | |
715 | return !xfrm_policy_list[XFRM_POLICY_OUT] || | |
716 | (skb->dst->flags & DST_NOXFRM) || | |
717 | __xfrm_route_forward(skb, family); | |
718 | } | |
719 | ||
720 | static inline int xfrm4_route_forward(struct sk_buff *skb) | |
721 | { | |
722 | return xfrm_route_forward(skb, AF_INET); | |
723 | } | |
724 | ||
725 | static inline int xfrm6_route_forward(struct sk_buff *skb) | |
726 | { | |
727 | return xfrm_route_forward(skb, AF_INET6); | |
728 | } | |
729 | ||
730 | extern int __xfrm_sk_clone_policy(struct sock *sk); | |
731 | ||
732 | static inline int xfrm_sk_clone_policy(struct sock *sk) | |
733 | { | |
734 | if (unlikely(sk->sk_policy[0] || sk->sk_policy[1])) | |
735 | return __xfrm_sk_clone_policy(sk); | |
736 | return 0; | |
737 | } | |
738 | ||
4666faab | 739 | extern int xfrm_policy_delete(struct xfrm_policy *pol, int dir); |
1da177e4 LT |
740 | |
741 | static inline void xfrm_sk_free_policy(struct sock *sk) | |
742 | { | |
743 | if (unlikely(sk->sk_policy[0] != NULL)) { | |
744 | xfrm_policy_delete(sk->sk_policy[0], XFRM_POLICY_MAX); | |
745 | sk->sk_policy[0] = NULL; | |
746 | } | |
747 | if (unlikely(sk->sk_policy[1] != NULL)) { | |
748 | xfrm_policy_delete(sk->sk_policy[1], XFRM_POLICY_MAX+1); | |
749 | sk->sk_policy[1] = NULL; | |
750 | } | |
751 | } | |
752 | ||
753 | #else | |
754 | ||
755 | static inline void xfrm_sk_free_policy(struct sock *sk) {} | |
756 | static inline int xfrm_sk_clone_policy(struct sock *sk) { return 0; } | |
757 | static inline int xfrm6_route_forward(struct sk_buff *skb) { return 1; } | |
758 | static inline int xfrm4_route_forward(struct sk_buff *skb) { return 1; } | |
759 | static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | |
760 | { | |
761 | return 1; | |
762 | } | |
763 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | |
764 | { | |
765 | return 1; | |
766 | } | |
767 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | |
768 | { | |
769 | return 1; | |
770 | } | |
771 | #endif | |
772 | ||
773 | static __inline__ | |
774 | xfrm_address_t *xfrm_flowi_daddr(struct flowi *fl, unsigned short family) | |
775 | { | |
776 | switch (family){ | |
777 | case AF_INET: | |
778 | return (xfrm_address_t *)&fl->fl4_dst; | |
779 | case AF_INET6: | |
780 | return (xfrm_address_t *)&fl->fl6_dst; | |
781 | } | |
782 | return NULL; | |
783 | } | |
784 | ||
785 | static __inline__ | |
786 | xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family) | |
787 | { | |
788 | switch (family){ | |
789 | case AF_INET: | |
790 | return (xfrm_address_t *)&fl->fl4_src; | |
791 | case AF_INET6: | |
792 | return (xfrm_address_t *)&fl->fl6_src; | |
793 | } | |
794 | return NULL; | |
795 | } | |
796 | ||
797 | static __inline__ int | |
798 | __xfrm4_state_addr_check(struct xfrm_state *x, | |
799 | xfrm_address_t *daddr, xfrm_address_t *saddr) | |
800 | { | |
801 | if (daddr->a4 == x->id.daddr.a4 && | |
802 | (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4)) | |
803 | return 1; | |
804 | return 0; | |
805 | } | |
806 | ||
807 | static __inline__ int | |
808 | __xfrm6_state_addr_check(struct xfrm_state *x, | |
809 | xfrm_address_t *daddr, xfrm_address_t *saddr) | |
810 | { | |
811 | if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && | |
812 | (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| | |
813 | ipv6_addr_any((struct in6_addr *)saddr) || | |
814 | ipv6_addr_any((struct in6_addr *)&x->props.saddr))) | |
815 | return 1; | |
816 | return 0; | |
817 | } | |
818 | ||
819 | static __inline__ int | |
820 | xfrm_state_addr_check(struct xfrm_state *x, | |
821 | xfrm_address_t *daddr, xfrm_address_t *saddr, | |
822 | unsigned short family) | |
823 | { | |
824 | switch (family) { | |
825 | case AF_INET: | |
826 | return __xfrm4_state_addr_check(x, daddr, saddr); | |
827 | case AF_INET6: | |
828 | return __xfrm6_state_addr_check(x, daddr, saddr); | |
829 | } | |
830 | return 0; | |
831 | } | |
832 | ||
833 | static inline int xfrm_state_kern(struct xfrm_state *x) | |
834 | { | |
835 | return atomic_read(&x->tunnel_users); | |
836 | } | |
837 | ||
838 | /* | |
839 | * xfrm algorithm information | |
840 | */ | |
841 | struct xfrm_algo_auth_info { | |
842 | u16 icv_truncbits; | |
843 | u16 icv_fullbits; | |
844 | }; | |
845 | ||
846 | struct xfrm_algo_encr_info { | |
847 | u16 blockbits; | |
848 | u16 defkeybits; | |
849 | }; | |
850 | ||
851 | struct xfrm_algo_comp_info { | |
852 | u16 threshold; | |
853 | }; | |
854 | ||
855 | struct xfrm_algo_desc { | |
856 | char *name; | |
04ff1260 | 857 | char *compat; |
1da177e4 LT |
858 | u8 available:1; |
859 | union { | |
860 | struct xfrm_algo_auth_info auth; | |
861 | struct xfrm_algo_encr_info encr; | |
862 | struct xfrm_algo_comp_info comp; | |
863 | } uinfo; | |
864 | struct sadb_alg desc; | |
865 | }; | |
866 | ||
867 | /* XFRM tunnel handlers. */ | |
868 | struct xfrm_tunnel { | |
869 | int (*handler)(struct sk_buff *skb); | |
d2acc347 HX |
870 | int (*err_handler)(struct sk_buff *skb, __u32 info); |
871 | ||
872 | struct xfrm_tunnel *next; | |
873 | int priority; | |
1da177e4 LT |
874 | }; |
875 | ||
876 | struct xfrm6_tunnel { | |
d2acc347 HX |
877 | int (*handler)(struct sk_buff *skb); |
878 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, | |
879 | int type, int code, int offset, __u32 info); | |
880 | ||
881 | struct xfrm6_tunnel *next; | |
882 | int priority; | |
1da177e4 LT |
883 | }; |
884 | ||
885 | extern void xfrm_init(void); | |
886 | extern void xfrm4_init(void); | |
887 | extern void xfrm6_init(void); | |
888 | extern void xfrm6_fini(void); | |
889 | extern void xfrm_state_init(void); | |
890 | extern void xfrm4_state_init(void); | |
1da177e4 LT |
891 | extern void xfrm6_state_init(void); |
892 | extern void xfrm6_state_fini(void); | |
893 | ||
894 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); | |
895 | extern struct xfrm_state *xfrm_state_alloc(void); | |
896 | extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |
897 | struct flowi *fl, struct xfrm_tmpl *tmpl, | |
898 | struct xfrm_policy *pol, int *err, | |
899 | unsigned short family); | |
900 | extern int xfrm_state_check_expire(struct xfrm_state *x); | |
901 | extern void xfrm_state_insert(struct xfrm_state *x); | |
902 | extern int xfrm_state_add(struct xfrm_state *x); | |
903 | extern int xfrm_state_update(struct xfrm_state *x); | |
904 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); | |
905 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | |
26b15dad | 906 | extern int xfrm_state_delete(struct xfrm_state *x); |
1da177e4 LT |
907 | extern void xfrm_state_flush(u8 proto); |
908 | extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); | |
909 | extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); | |
f8cd5488 | 910 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
1da177e4 LT |
911 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); |
912 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | |
72cb6962 | 913 | extern int xfrm_init_state(struct xfrm_state *x); |
1da177e4 LT |
914 | extern int xfrm4_rcv(struct sk_buff *skb); |
915 | extern int xfrm4_output(struct sk_buff *skb); | |
916 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | |
917 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); | |
d2acc347 | 918 | extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); |
951dbc8a | 919 | extern int xfrm6_rcv(struct sk_buff **pskb); |
1da177e4 LT |
920 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); |
921 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); | |
922 | extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | |
923 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | |
924 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | |
925 | extern int xfrm6_output(struct sk_buff *skb); | |
926 | ||
927 | #ifdef CONFIG_XFRM | |
928 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); | |
929 | extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); | |
930 | extern int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family); | |
931 | #else | |
932 | static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) | |
933 | { | |
934 | return -ENOPROTOOPT; | |
935 | } | |
936 | ||
937 | static inline int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |
938 | { | |
939 | /* should not happen */ | |
940 | kfree_skb(skb); | |
941 | return 0; | |
942 | } | |
943 | static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family) | |
944 | { | |
945 | return -EINVAL; | |
946 | } | |
947 | #endif | |
948 | ||
dd0fc66f | 949 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
1da177e4 LT |
950 | extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); |
951 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | |
df71837d TJ |
952 | struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, |
953 | struct xfrm_sec_ctx *ctx, int delete); | |
1da177e4 LT |
954 | struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); |
955 | void xfrm_policy_flush(void); | |
956 | u32 xfrm_get_acqseq(void); | |
957 | void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | |
958 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | |
959 | xfrm_address_t *daddr, xfrm_address_t *saddr, | |
960 | int create, unsigned short family); | |
961 | extern void xfrm_policy_flush(void); | |
962 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | |
963 | extern int xfrm_flush_bundles(void); | |
399c180a | 964 | extern void xfrm_flush_all_bundles(void); |
1da177e4 LT |
965 | extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family); |
966 | extern void xfrm_init_pmtu(struct dst_entry *dst); | |
967 | ||
968 | extern wait_queue_head_t km_waitq; | |
969 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | |
6c5c8ca7 | 970 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); |
1da177e4 LT |
971 | |
972 | extern void xfrm_input_init(void); | |
973 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); | |
974 | ||
975 | extern void xfrm_probe_algs(void); | |
976 | extern int xfrm_count_auth_supported(void); | |
977 | extern int xfrm_count_enc_supported(void); | |
978 | extern struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx); | |
979 | extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx); | |
980 | extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); | |
981 | extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); | |
982 | extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); | |
983 | extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); | |
984 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); | |
985 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); | |
986 | ||
07d4ee58 | 987 | struct hash_desc; |
9409f38a | 988 | struct scatterlist; |
07d4ee58 HX |
989 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, |
990 | unsigned int); | |
1da177e4 | 991 | |
07d4ee58 HX |
992 | extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm, |
993 | int offset, int len, icv_update_fn_t icv_update); | |
1da177e4 LT |
994 | |
995 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | |
996 | int family) | |
997 | { | |
998 | switch (family) { | |
999 | default: | |
1000 | case AF_INET: | |
1001 | return a->a4 - b->a4; | |
1002 | case AF_INET6: | |
1003 | return ipv6_addr_cmp((struct in6_addr *)a, | |
1004 | (struct in6_addr *)b); | |
1005 | } | |
1006 | } | |
1007 | ||
77d8d7a6 HX |
1008 | static inline int xfrm_policy_id2dir(u32 index) |
1009 | { | |
1010 | return index & 7; | |
1011 | } | |
1012 | ||
f8cd5488 JHS |
1013 | static inline int xfrm_aevent_is_on(void) |
1014 | { | |
be33690d PM |
1015 | struct sock *nlsk; |
1016 | int ret = 0; | |
1017 | ||
1018 | rcu_read_lock(); | |
1019 | nlsk = rcu_dereference(xfrm_nl); | |
1020 | if (nlsk) | |
1021 | ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS); | |
1022 | rcu_read_unlock(); | |
1023 | return ret; | |
f8cd5488 JHS |
1024 | } |
1025 | ||
1026 | static inline void xfrm_aevent_doreplay(struct xfrm_state *x) | |
1027 | { | |
1028 | if (xfrm_aevent_is_on()) | |
1029 | xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); | |
1030 | } | |
1031 | ||
1032 | ||
1da177e4 | 1033 | #endif /* _NET_XFRM_H */ |