netfilter: ctnetlink: add zone support
[safe/jmp/linux-2.6] / include / linux / xfrm.h
index 15ca89e..29e04be 100644 (file)
@@ -10,8 +10,7 @@
 /* Structure to encapsulate addresses. I do not want to use
  * "standard" structure. My apologies.
  */
-typedef union
-{
+typedef union {
        __be32          a4;
        __be32          a6[4];
 } xfrm_address_t;
@@ -20,8 +19,7 @@ typedef union
  * the state by (spi,daddr,ah/esp) or to store information about
  * spi, protocol and tunnel address on output.
  */
-struct xfrm_id
-{
+struct xfrm_id {
        xfrm_address_t  daddr;
        __be32          spi;
        __u8            proto;
@@ -45,8 +43,7 @@ struct xfrm_sec_ctx {
 
 /* Selector, used as selector both on policy rules (SPD) and SAs. */
 
-struct xfrm_selector
-{
+struct xfrm_selector {
        xfrm_address_t  daddr;
        xfrm_address_t  saddr;
        __be16  dport;
@@ -58,13 +55,12 @@ struct xfrm_selector
        __u8    prefixlen_s;
        __u8    proto;
        int     ifindex;
-       uid_t   user;
+       __kernel_uid32_t        user;
 };
 
 #define XFRM_INF (~(__u64)0)
 
-struct xfrm_lifetime_cfg
-{
+struct xfrm_lifetime_cfg {
        __u64   soft_byte_limit;
        __u64   hard_byte_limit;
        __u64   soft_packet_limit;
@@ -75,25 +71,37 @@ struct xfrm_lifetime_cfg
        __u64   hard_use_expires_seconds;
 };
 
-struct xfrm_lifetime_cur
-{
+struct xfrm_lifetime_cur {
        __u64   bytes;
        __u64   packets;
        __u64   add_time;
        __u64   use_time;
 };
 
-struct xfrm_replay_state
-{
+struct xfrm_replay_state {
        __u32   oseq;
        __u32   seq;
        __u32   bitmap;
 };
 
 struct xfrm_algo {
-       char    alg_name[64];
-       int     alg_key_len;    /* in bits */
-       char    alg_key[0];
+       char            alg_name[64];
+       unsigned int    alg_key_len;    /* in bits */
+       char            alg_key[0];
+};
+
+struct xfrm_algo_auth {
+       char            alg_name[64];
+       unsigned int    alg_key_len;    /* in bits */
+       unsigned int    alg_trunc_len;  /* in bits */
+       char            alg_key[0];
+};
+
+struct xfrm_algo_aead {
+       char            alg_name[64];
+       unsigned int    alg_key_len;    /* in bits */
+       unsigned int    alg_icv_len;    /* in bits */
+       char            alg_key[0];
 };
 
 struct xfrm_stats {
@@ -102,23 +110,22 @@ struct xfrm_stats {
        __u32   integrity_failed;
 };
 
-enum
-{
+enum {
        XFRM_POLICY_TYPE_MAIN   = 0,
        XFRM_POLICY_TYPE_SUB    = 1,
-       XFRM_POLICY_TYPE_MAX    = 2
+       XFRM_POLICY_TYPE_MAX    = 2,
+       XFRM_POLICY_TYPE_ANY    = 255
 };
 
-enum
-{
+enum {
        XFRM_POLICY_IN  = 0,
        XFRM_POLICY_OUT = 1,
        XFRM_POLICY_FWD = 2,
+       XFRM_POLICY_MASK = 3,
        XFRM_POLICY_MAX = 3
 };
 
-enum
-{
+enum {
        XFRM_SHARE_ANY,         /* No limitations */
        XFRM_SHARE_SESSION,     /* For this session only */
        XFRM_SHARE_USER,        /* For this user only */
@@ -181,6 +188,18 @@ enum {
        XFRM_MSG_MIGRATE,
 #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
 
+       XFRM_MSG_NEWSADINFO,
+#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
+       XFRM_MSG_GETSADINFO,
+#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
+
+       XFRM_MSG_NEWSPDINFO,
+#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
+       XFRM_MSG_GETSPDINFO,
+#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
+
+       XFRM_MSG_MAPPING,
+#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
        __XFRM_MSG_MAX
 };
 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -260,11 +279,51 @@ enum xfrm_attr_type_t {
        XFRMA_LASTUSED,
        XFRMA_POLICY_TYPE,      /* struct xfrm_userpolicy_type */
        XFRMA_MIGRATE,
+       XFRMA_ALG_AEAD,         /* struct xfrm_algo_aead */
+       XFRMA_KMADDRESS,        /* struct xfrm_user_kmaddress */
+       XFRMA_ALG_AUTH_TRUNC,   /* struct xfrm_algo_auth */
        __XFRMA_MAX
 
 #define XFRMA_MAX (__XFRMA_MAX - 1)
 };
 
+enum xfrm_sadattr_type_t {
+       XFRMA_SAD_UNSPEC,
+       XFRMA_SAD_CNT,
+       XFRMA_SAD_HINFO,
+       __XFRMA_SAD_MAX
+
+#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
+};
+
+struct xfrmu_sadhinfo {
+       __u32 sadhcnt; /* current hash bkts */
+       __u32 sadhmcnt; /* max allowed hash bkts */
+};
+
+enum xfrm_spdattr_type_t {
+       XFRMA_SPD_UNSPEC,
+       XFRMA_SPD_INFO,
+       XFRMA_SPD_HINFO,
+       __XFRMA_SPD_MAX
+
+#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
+};
+
+struct xfrmu_spdinfo {
+       __u32 incnt;
+       __u32 outcnt;
+       __u32 fwdcnt;
+       __u32 inscnt;
+       __u32 outscnt;
+       __u32 fwdscnt;
+};
+
+struct xfrmu_spdhinfo {
+       __u32 spdhcnt;
+       __u32 spdhmcnt;
+};
+
 struct xfrm_usersa_info {
        struct xfrm_selector            sel;
        struct xfrm_id                  id;
@@ -282,6 +341,8 @@ struct xfrm_usersa_info {
 #define XFRM_STATE_DECAP_DSCP  2
 #define XFRM_STATE_NOPMTUDISC  4
 #define XFRM_STATE_WILDRECV    8
+#define XFRM_STATE_ICMP                16
+#define XFRM_STATE_AF_UNSPEC   32
 };
 
 struct xfrm_usersa_id {
@@ -316,6 +377,8 @@ struct xfrm_userpolicy_info {
 #define XFRM_POLICY_BLOCK      1
        __u8                            flags;
 #define XFRM_POLICY_LOCALOK    1       /* Allow user to override global policy */
+       /* Automatically expand selector to include matching ICMP payloads. */
+#define XFRM_POLICY_ICMP       2
        __u8                            share;
 };
 
@@ -355,6 +418,15 @@ struct xfrm_user_report {
        struct xfrm_selector            sel;
 };
 
+/* Used by MIGRATE to pass addresses IKE should use to perform
+ * SA negotiation with the peer */
+struct xfrm_user_kmaddress {
+       xfrm_address_t                  local;
+       xfrm_address_t                  remote;
+       __u32                           reserved;
+       __u16                           family;
+};
+
 struct xfrm_user_migrate {
        xfrm_address_t                  old_daddr;
        xfrm_address_t                  old_saddr;
@@ -368,6 +440,15 @@ struct xfrm_user_migrate {
        __u16                           new_family;
 };
 
+struct xfrm_user_mapping {
+       struct xfrm_usersa_id           id;
+       __u32                           reqid;
+       xfrm_address_t                  old_saddr;
+       xfrm_address_t                  new_saddr;
+       __be16                          old_sport;
+       __be16                          new_sport;
+};
+
 #ifndef __KERNEL__
 /* backwards compatibility for userspace */
 #define XFRMGRP_ACQUIRE                1
@@ -394,6 +475,8 @@ enum xfrm_nlgroups {
 #define XFRMNLGRP_REPORT       XFRMNLGRP_REPORT
        XFRMNLGRP_MIGRATE,
 #define XFRMNLGRP_MIGRATE      XFRMNLGRP_MIGRATE
+       XFRMNLGRP_MAPPING,
+#define XFRMNLGRP_MAPPING      XFRMNLGRP_MAPPING
        __XFRMNLGRP_MAX
 };
 #define XFRMNLGRP_MAX  (__XFRMNLGRP_MAX - 1)