aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2011-03-07 19:05:43 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-13 23:22:28 -0400
commit9736acf395d3608583a7be70f62800b494fa103c (patch)
treeef7b50bb74a7e6a0d93f962cc7a4c98dd18c2caa /include
parenta5079d084f8be781aae8a635cab4b179cfea4ebd (diff)
xfrm: Add basic infrastructure to support IPsec extended sequence numbers
This patch adds the struct xfrm_replay_state_esn which will be used to support IPsec extended sequence numbers and anti replay windows bigger than 32 packets. Also we add a function that returns the actual size of the xfrm_replay_state_esn, a xfrm netlink atribute and a xfrm state flag for the use of extended sequence numbers. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/xfrm.h12
-rw-r--r--include/net/xfrm.h7
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b93d6f598085..22e61fdf75a2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,16 @@ struct xfrm_replay_state {
84 __u32 bitmap; 84 __u32 bitmap;
85}; 85};
86 86
87struct xfrm_replay_state_esn {
88 unsigned int bmp_len;
89 __u32 oseq;
90 __u32 seq;
91 __u32 oseq_hi;
92 __u32 seq_hi;
93 __u32 replay_window;
94 __u32 bmp[0];
95};
96
87struct xfrm_algo { 97struct xfrm_algo {
88 char alg_name[64]; 98 char alg_name[64];
89 unsigned int alg_key_len; /* in bits */ 99 unsigned int alg_key_len; /* in bits */
@@ -284,6 +294,7 @@ enum xfrm_attr_type_t {
284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 294 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
285 XFRMA_MARK, /* struct xfrm_mark */ 295 XFRMA_MARK, /* struct xfrm_mark */
286 XFRMA_TFCPAD, /* __u32 */ 296 XFRMA_TFCPAD, /* __u32 */
297 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
287 __XFRMA_MAX 298 __XFRMA_MAX
288 299
289#define XFRMA_MAX (__XFRMA_MAX - 1) 300#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -351,6 +362,7 @@ struct xfrm_usersa_info {
351#define XFRM_STATE_ICMP 16 362#define XFRM_STATE_ICMP 16
352#define XFRM_STATE_AF_UNSPEC 32 363#define XFRM_STATE_AF_UNSPEC 32
353#define XFRM_STATE_ALIGN4 64 364#define XFRM_STATE_ALIGN4 64
365#define XFRM_STATE_ESN 128
354}; 366};
355 367
356struct xfrm_usersa_id { 368struct xfrm_usersa_id {
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 8f8bd82606bf..7640822bc515 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -186,9 +186,11 @@ struct xfrm_state {
186 186
187 /* State for replay detection */ 187 /* State for replay detection */
188 struct xfrm_replay_state replay; 188 struct xfrm_replay_state replay;
189 struct xfrm_replay_state_esn *replay_esn;
189 190
190 /* Replay detection state at the time we sent the last notification */ 191 /* Replay detection state at the time we sent the last notification */
191 struct xfrm_replay_state preplay; 192 struct xfrm_replay_state preplay;
193 struct xfrm_replay_state_esn *preplay_esn;
192 194
193 /* internal flag that only holds state for delayed aevent at the 195 /* internal flag that only holds state for delayed aevent at the
194 * moment 196 * moment
@@ -1569,6 +1571,11 @@ static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg)
1569 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1571 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1570} 1572}
1571 1573
1574static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn)
1575{
1576 return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32);
1577}
1578
1572#ifdef CONFIG_XFRM_MIGRATE 1579#ifdef CONFIG_XFRM_MIGRATE
1573static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1580static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1574{ 1581{