[SCTP]: Implement the receive and verification of AUTH chunk
[safe/jmp/linux-2.6] / include / net / sctp / structs.h
index 7435528..47e54f8 100644 (file)
@@ -64,6 +64,7 @@
 #include <linux/skbuff.h>      /* We need sk_buff_head. */
 #include <linux/workqueue.h>   /* We need tq_struct.    */
 #include <linux/sctp.h>                /* We need sctp* header structs.  */
+#include <net/sctp/auth.h>     /* We need auth specific structs */
 
 /* A convenience structure for handling sockaddr structures.
  * We should wean ourselves off this.
@@ -87,6 +88,7 @@ struct sctp_bind_addr;
 struct sctp_ulpq;
 struct sctp_ep_common;
 struct sctp_ssnmap;
+struct crypto_hash;
 
 
 #include <net/sctp/tsnmap.h>
@@ -127,9 +129,9 @@ extern struct sctp_globals {
         * RTO.Alpha                - 1/8  (3 when converted to right shifts.)
         * RTO.Beta                 - 1/4  (2 when converted to right shifts.)
         */
-       __u32 rto_initial;
-       __u32 rto_min;
-       __u32 rto_max;
+       unsigned int rto_initial;
+       unsigned int rto_min;
+       unsigned int rto_max;
 
        /* Note: rto_alpha and rto_beta are really defined as inverse
         * powers of two to facilitate integer operations.
@@ -140,12 +142,18 @@ extern struct sctp_globals {
        /* Max.Burst                - 4 */
        int max_burst;
 
-       /* Valid.Cookie.Life        - 60  seconds  */
-       int valid_cookie_life;
-
        /* Whether Cookie Preservative is enabled(1) or not(0) */
        int cookie_preserve_enable;
 
+       /* Valid.Cookie.Life        - 60  seconds  */
+       unsigned int valid_cookie_life;
+
+       /* Delayed SACK timeout  200ms default*/
+       unsigned int sack_timeout;
+
+       /* HB.interval              - 30 seconds  */
+       unsigned int hb_interval;
+
        /* Association.Max.Retrans  - 10 attempts
         * Path.Max.Retrans         - 5  attempts (per destination address)
         * Max.Init.Retransmits     - 8  attempts
@@ -161,11 +169,12 @@ extern struct sctp_globals {
         */
        int sndbuf_policy;
 
-       /* Delayed SACK timeout  200ms default*/
-       int sack_timeout;
-
-       /* HB.interval              - 30 seconds  */
-       int hb_interval;
+       /*
+        * Policy for preforming sctp/socket accounting
+        * 0   - do socket level accounting, all assocs share sk_rcvbuf
+        * 1   - do sctp accounting, each asoc may use sk_rcvbuf bytes
+        */
+       int rcvbuf_policy;
 
        /* The following variables are implementation specific.  */
 
@@ -193,19 +202,24 @@ extern struct sctp_globals {
        struct sctp_bind_hashbucket *port_hashtable;
 
        /* This is the global local address list.
-        * We actively maintain this complete list of interfaces on
-        * the system by catching routing events.
+        * We actively maintain this complete list of addresses on
+        * the system by catching address add/delete events.
         *
         * It is a list of sctp_sockaddr_entry.
         */
        struct list_head local_addr_list;
-       spinlock_t local_addr_lock;
+
+       /* Lock that protects the local_addr_list writers */
+       spinlock_t addr_list_lock;
        
        /* Flag to indicate if addip is enabled. */
        int addip_enable;
 
        /* Flag to indicate if PR-SCTP is enabled. */
        int prsctp_enable;
+
+       /* Flag to idicate if SCTP-AUTH is enabled */
+       int auth_enable;
 } sctp_globals;
 
 #define sctp_rto_initial               (sctp_globals.rto_initial)
@@ -218,6 +232,7 @@ extern struct sctp_globals {
 #define sctp_cookie_preserve_enable    (sctp_globals.cookie_preserve_enable)
 #define sctp_max_retrans_association   (sctp_globals.max_retrans_association)
 #define sctp_sndbuf_policy             (sctp_globals.sndbuf_policy)
+#define sctp_rcvbuf_policy             (sctp_globals.rcvbuf_policy)
 #define sctp_max_retrans_path          (sctp_globals.max_retrans_path)
 #define sctp_max_retrans_init          (sctp_globals.max_retrans_init)
 #define sctp_sack_timeout              (sctp_globals.sack_timeout)
@@ -234,9 +249,10 @@ extern struct sctp_globals {
 #define sctp_port_alloc_lock           (sctp_globals.port_alloc_lock)
 #define sctp_port_hashtable            (sctp_globals.port_hashtable)
 #define sctp_local_addr_list           (sctp_globals.local_addr_list)
-#define sctp_local_addr_lock           (sctp_globals.local_addr_lock)
+#define sctp_local_addr_lock           (sctp_globals.addr_list_lock)
 #define sctp_addip_enable              (sctp_globals.addip_enable)
 #define sctp_prsctp_enable             (sctp_globals.prsctp_enable)
+#define sctp_auth_enable               (sctp_globals.auth_enable)
 
 /* SCTP Socket type: UDP or TCP style. */
 typedef enum {
@@ -256,7 +272,7 @@ struct sctp_sock {
        struct sctp_pf *pf;
 
        /* Access to HMAC transform. */
-       struct crypto_tfm *hmac;
+       struct crypto_hash *hmac;
 
        /* What is our base endpointer? */
        struct sctp_endpoint *ep;
@@ -268,6 +284,26 @@ struct sctp_sock {
        __u16 default_flags;
        __u32 default_context;
        __u32 default_timetolive;
+       __u32 default_rcv_context;
+       int max_burst;
+
+       /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+        * the destination address every heartbeat interval. This value
+        * will be inherited by all new associations.
+        */
+       __u32 hbinterval;
+
+       /* This is the max_retrans value for new associations. */
+       __u16 pathmaxrxt;
+
+       /* The initial Path MTU to use for new associations. */
+       __u32 pathmtu;
+
+       /* The default SACK delay timeout for new associations. */
+       __u32 sackdelay;
+
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
 
        struct sctp_initmsg initmsg;
        struct sctp_rtoinfo rtoinfo;
@@ -278,10 +314,12 @@ struct sctp_sock {
        __u32 autoclose;
        __u8 nodelay;
        __u8 disable_fragments;
-       __u8 pd_mode;
        __u8 v4mapped;
-       __u32 adaption_ind;
+       __u8 frag_interleave;
+       __u32 adaptation_ind;
+       __u32 pd_point;
 
+       atomic_t pd_mode;
        /* Receive to here while partial delivery is in effect. */
        struct sk_buff_head pd_lobby;
 };
@@ -362,8 +400,11 @@ struct sctp_cookie {
        /* Padding for future use */
        __u8 padding;           
 
-       __u32 adaption_ind;     
+       __u32 adaptation_ind;
 
+       __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH];
+       __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2];
+       __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS];
 
        /* This is a shim for my peer's INIT packet, followed by
         * a copy of the raw address list of the association.
@@ -379,14 +420,16 @@ struct sctp_cookie {
 /* The format of our cookie that we send to our peer. */
 struct sctp_signed_cookie {
        __u8 signature[SCTP_SECRET_SIZE];
+       __u32 __pad;            /* force sctp_cookie alignment to 64 bits */
        struct sctp_cookie c;
-};
+} __attribute__((packed));
 
 /* This is another convenience type to allocate memory for address
  * params for the maximum size and pass such structures around
  * internally.
  */
 union sctp_addr_param {
+       struct sctp_paramhdr p;
        struct sctp_ipv4addr_param v4;
        struct sctp_ipv6addr_param v6;
 };
@@ -404,7 +447,11 @@ union sctp_params {
        struct sctp_ipv4addr_param *v4;
        struct sctp_ipv6addr_param *v6;
        union sctp_addr_param *addr;
-       struct sctp_adaption_ind_param *aind;
+       struct sctp_adaptation_ind_param *aind;
+       struct sctp_supported_ext_param *ext;
+       struct sctp_random_param *random;
+       struct sctp_chunks_param *chunks;
+       struct sctp_hmac_algo_param *hmac_algo;
 };
 
 /* RFC 2960.  Section 3.3.5 Heartbeat.
@@ -418,6 +465,7 @@ typedef struct sctp_sender_hb_info {
        struct sctp_paramhdr param_hdr;
        union sctp_addr daddr;
        unsigned long sent_at;
+       __u64 hb_nonce;
 } __attribute__((packed)) sctp_sender_hb_info_t;
 
 /*
@@ -445,7 +493,8 @@ struct sctp_ssnmap {
        int malloced;
 };
 
-struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp);
+struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
+                                   gfp_t gfp);
 void sctp_ssnmap_free(struct sctp_ssnmap *map);
 void sctp_ssnmap_clear(struct sctp_ssnmap *map);
 
@@ -486,6 +535,16 @@ struct sctp_af {
                                         int optname,
                                         char __user *optval,
                                         int __user *optlen);
+       int             (*compat_setsockopt)    (struct sock *sk,
+                                        int level,
+                                        int optname,
+                                        char __user *optval,
+                                        int optlen);
+       int             (*compat_getsockopt)    (struct sock *sk,
+                                        int level,
+                                        int optname,
+                                        char __user *optval,
+                                        int __user *optlen);
        struct dst_entry *(*get_dst)    (struct sctp_association *asoc,
                                         union sctp_addr *daddr,
                                         union sctp_addr *saddr);
@@ -497,7 +556,7 @@ struct sctp_af {
                                          struct net_device *);
        void            (*dst_saddr)    (union sctp_addr *saddr,
                                         struct dst_entry *dst,
-                                        unsigned short port);
+                                        __be16 port);
        int             (*cmp_addr)     (const union sctp_addr *addr1,
                                         const union sctp_addr *addr2);
        void            (*addr_copy)    (union sctp_addr *dst,
@@ -513,13 +572,14 @@ struct sctp_af {
                                         struct sock *sk);
        void            (*from_addr_param) (union sctp_addr *,
                                            union sctp_addr_param *,
-                                           __u16 port, int iif);       
+                                           __be16 port, int iif);
        int             (*to_addr_param) (const union sctp_addr *,
                                          union sctp_addr_param *); 
        int             (*addr_valid)   (union sctp_addr *,
-                                        struct sctp_sock *);
+                                        struct sctp_sock *,
+                                        const struct sk_buff *);
        sctp_scope_t    (*scope) (union sctp_addr *);
-       void            (*inaddr_any)   (union sctp_addr *, unsigned short);
+       void            (*inaddr_any)   (union sctp_addr *, __be16);
        int             (*is_any)       (const union sctp_addr *);
        int             (*available)    (union sctp_addr *,
                                         struct sctp_sock *);
@@ -546,7 +606,7 @@ struct sctp_pf {
                          struct sctp_sock *);
        int  (*bind_verify) (struct sctp_sock *, union sctp_addr *);
        int  (*send_verify) (struct sctp_sock *, union sctp_addr *);
-       int  (*supported_addrs)(const struct sctp_sock *, __u16 *);
+       int  (*supported_addrs)(const struct sctp_sock *, __be16 *);
        struct sock *(*create_accept_sk) (struct sock *sk,
                                          struct sctp_association *asoc);
        void (*addr_v4map) (struct sctp_sock *, union sctp_addr *);
@@ -630,6 +690,7 @@ struct sctp_chunk {
                struct sctp_errhdr *err_hdr;
                struct sctp_addiphdr *addip_hdr;
                struct sctp_fwdtsn_hdr *fwdtsn_hdr;
+               struct sctp_authhdr *auth_hdr;
        } subh;
 
        __u8 *chunk_end;
@@ -663,6 +724,13 @@ struct sctp_chunk {
         */
        struct sctp_transport *transport;
 
+       /* SCTP-AUTH:  For the special case inbound processing of COOKIE-ECHO
+        * we need save a pointer to the AUTH chunk, since the SCTP-AUTH
+        * spec violates the principle premis that all chunks are processed
+        * in order.
+        */
+       struct sk_buff *auth_chunk;
+
        __u8 rtt_in_progress;   /* Is this chunk used for RTT calculation? */
        __u8 resent;            /* Has this chunk ever been retransmitted. */
        __u8 has_tsn;           /* Does this chunk have a TSN yet? */
@@ -672,8 +740,10 @@ struct sctp_chunk {
        __u8 ecn_ce_done;       /* Have we processed the ECN CE bit? */
        __u8 pdiscard;          /* Discard the whole packet now? */
        __u8 tsn_gap_acked;     /* Is this chunk acked by a GAP ACK? */
-       __u8 fast_retransmit;    /* Is this chunk fast retransmitted? */
+       __s8 fast_retransmit;    /* Is this chunk fast retransmitted? */
        __u8 tsn_missing_report; /* Data chunk missing counter. */
+       __u8 data_accepted;     /* At least 1 chunk in this packet accepted */
+       __u8 auth;              /* IN: was auth'ed | OUT: needs auth */
 };
 
 void sctp_chunk_hold(struct sctp_chunk *);
@@ -690,13 +760,12 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
 const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
 
 /* This is a structure for holding either an IPv6 or an IPv4 address.  */
-/* sin_family -- AF_INET or AF_INET6
- * sin_port -- ordinary port number
- * sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
- */
 struct sctp_sockaddr_entry {
        struct list_head list;
+       struct rcu_head rcu;
        union sctp_addr a;
+       __u8 use_as_src;
+       __u8 valid;
 };
 
 typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *);
@@ -724,16 +793,25 @@ struct sctp_packet {
         */
        struct sctp_transport *transport;
 
+       /* pointer to the auth chunk for this packet */
+       struct sctp_chunk *auth;
+
        /* This packet contains a COOKIE-ECHO chunk. */
-       char has_cookie_echo;
+       __u8 has_cookie_echo;
+
+       /* This packet contains a SACK chunk. */
+       __u8 has_sack;
 
-       /* This packet containsa SACK chunk. */
-       char has_sack;
+       /* This packet contains an AUTH chunk */
+       __u8 has_auth;
+
+       /* This packet contains at least 1 DATA chunk */
+       __u8 has_data;
 
        /* SCTP cannot fragment this packet. So let ip fragment it. */
-       char ipfragok;
+       __u8 ipfragok;
 
-       int malloced;
+       __u8 malloced;
 };
 
 struct sctp_packet *sctp_packet_init(struct sctp_packet *,
@@ -800,7 +878,7 @@ struct sctp_transport {
        __u32 rtt;              /* This is the most recent RTT.  */
 
        /* RTO         : The current retransmission timeout value.  */
-       __u32 rto;
+       unsigned long rto;
 
        /* RTTVAR      : The current RTT variation.  */
        __u32 rttvar;
@@ -836,9 +914,6 @@ struct sctp_transport {
        /* Data that has been sent, but not acknowledged. */
        __u32 flight_size;
 
-       /* PMTU       : The current known path MTU.  */
-       __u32 pmtu;
-
        /* Destination */
        struct dst_entry *dst;
        /* Source address. */
@@ -853,7 +928,10 @@ struct sctp_transport {
        /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
         * the destination address every heartbeat interval.
         */
-       int hb_interval;
+       unsigned long hbinterval;
+
+       /* SACK delay timeout */
+       unsigned long sackdelay;
 
        /* When was the last time (in jiffies) that we heard from this
         * transport?  We use this to pick new active and retran paths.
@@ -865,6 +943,21 @@ struct sctp_transport {
         */
        unsigned long last_time_ecne_reduced;
 
+       /* This is the max_retrans value for the transport and will
+        * be initialized from the assocs value.  This can be changed
+        * using SCTP_SET_PEER_ADDR_PARAMS socket option.
+        */
+       __u16 pathmaxrxt;
+
+       /* is the Path MTU update pending on this tranport */
+       __u8 pmtu_pending;
+
+       /* PMTU       : The current known path MTU.  */
+       __u32 pathmtu;
+
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
+
        /* The number of times INIT has been sent on this transport. */
        int init_sent_count;
 
@@ -873,22 +966,11 @@ struct sctp_transport {
         */
        int state;
 
-       /* hb_allowed  : The current heartbeat state of this destination,
-        *             :  i.e. ALLOW-HB, NO-HEARTBEAT, etc.
-        */
-       int hb_allowed;
-
        /* These are the error stats for this destination.  */
 
        /* Error count : The current error count for this destination.  */
        unsigned short error_count;
 
-       /* This is the max_retrans value for the transport and will
-        * be initialized to proto.max_retrans.path.  This can be changed
-        * using SCTP_SET_PEER_ADDR_PARAMS socket option.
-        */
-       int max_retrans;
-
        /* Per         : A timer used by each destination.
         * Destination :
         * Timer       :
@@ -943,9 +1025,13 @@ struct sctp_transport {
                 */
                char cacc_saw_newack;
        } cacc;
+
+       /* 64-bit random number sent with heartbeat. */
+       __u64 hb_nonce;
 };
 
-struct sctp_transport *sctp_transport_new(const union sctp_addr *, int);
+struct sctp_transport *sctp_transport_new(const union sctp_addr *,
+                                         gfp_t);
 void sctp_transport_set_owner(struct sctp_transport *,
                              struct sctp_association *);
 void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
@@ -959,6 +1045,8 @@ void sctp_transport_update_rto(struct sctp_transport *, __u32);
 void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
 void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
 unsigned long sctp_transport_timeout(struct sctp_transport *);
+void sctp_transport_reset(struct sctp_transport *);
+void sctp_transport_update_pmtu(struct sctp_transport *, u32);
 
 
 /* This is the structure we use to queue packets as they come into
@@ -986,7 +1074,8 @@ void sctp_inq_init(struct sctp_inq *);
 void sctp_inq_free(struct sctp_inq *);
 void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet);
 struct sctp_chunk *sctp_inq_pop(struct sctp_inq *);
-void sctp_inq_set_th_handler(struct sctp_inq *, void (*)(void *), void *);
+struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *);
+void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t);
 
 /* This is the structure we use to hold outbound chunks.  You push
  * chunks in and they automatically pop out the other end as bundled
@@ -1093,10 +1182,13 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
 void sctp_bind_addr_free(struct sctp_bind_addr *);
 int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
                        const struct sctp_bind_addr *src,
-                       sctp_scope_t scope, int gfp,int flags);
+                       sctp_scope_t scope, gfp_t gfp,
+                       int flags);
 int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
-                      int gfp);
-int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
+                      __u8 use_as_src, gfp_t gfp);
+int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
+                       void fastcall (*rcu_call)(struct rcu_head *,
+                                         void (*func)(struct rcu_head *)));
 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
                         struct sctp_sock *);
 union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr  *bp,
@@ -1104,9 +1196,10 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr    *bp,
                                        int                     addrcnt,
                                        struct sctp_sock        *opt);
 union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
-                                        int *addrs_len, int gfp);
+                                        int *addrs_len,
+                                        gfp_t gfp);
 int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
-                          __u16 port, int gfp);
+                          __u16 port, gfp_t gfp);
 
 sctp_scope_t sctp_scope(const union sctp_addr *);
 int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
@@ -1166,9 +1259,6 @@ struct sctp_ep_common {
         * bind_addr.address_list is our set of local IP addresses.
         */
        struct sctp_bind_addr bind_addr;
-
-       /* Protection during address list comparisons. */
-       rwlock_t   addr_lock;
 };
 
 
@@ -1218,11 +1308,34 @@ struct sctp_endpoint {
        int last_key;
        int key_changed_at;
 
-       /* Default timeouts.  */
-       int timeouts[SCTP_NUM_TIMEOUT_TYPES];
-
+       /* digest:  This is a digest of the sctp cookie.  This field is
+        *          only used on the receive path when we try to validate
+        *          that the cookie has not been tampered with.  We put
+        *          this here so we pre-allocate this once and can re-use
+        *          on every receive.
+        */
+       __u8 *digest;
        /* sendbuf acct. policy.        */
        __u32 sndbuf_policy;
+
+       /* rcvbuf acct. policy. */
+       __u32 rcvbuf_policy;
+
+       /* SCTP AUTH: array of the HMACs that will be allocated
+        * we need this per association so that we don't serialize
+        */
+       struct crypto_hash **auth_hmacs;
+
+       /* SCTP-AUTH: hmacs for the endpoint encoded into parameter */
+        struct sctp_hmac_algo_param *auth_hmacs_list;
+
+       /* SCTP-AUTH: chunks to authenticate encoded into parameter */
+       struct sctp_chunks_param *auth_chunk_list;
+
+       /* SCTP-AUTH: endpoint shared keys */
+       struct list_head endpoint_shared_keys;
+       __u16 active_key_id;
 };
 
 /* Recover the outter endpoint structure. */
@@ -1235,7 +1348,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
 }
 
 /* These are function signatures for manipulating endpoints.  */
-struct sctp_endpoint *sctp_endpoint_new(struct sock *, int);
+struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
 void sctp_endpoint_free(struct sctp_endpoint *);
 void sctp_endpoint_put(struct sctp_endpoint *);
 void sctp_endpoint_hold(struct sctp_endpoint *);
@@ -1256,10 +1369,17 @@ int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t,
                     struct sctp_chunk **err_chunk);
 int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
                      const union sctp_addr *peer,
-                     sctp_init_chunk_t *init, int gfp);
+                     sctp_init_chunk_t *init, gfp_t gfp);
 __u32 sctp_generate_tag(const struct sctp_endpoint *);
 __u32 sctp_generate_tsn(const struct sctp_endpoint *);
 
+struct sctp_inithdr_host {
+       __u32 init_tag;
+       __u32 a_rwnd;
+       __u16 num_outbound_streams;
+       __u16 num_inbound_streams;
+       __u32 initial_tsn;
+};
 
 /* RFC2960
  *
@@ -1422,15 +1542,16 @@ struct sctp_association {
                __u8    hostname_address;/* Peer understands DNS addresses? */
                __u8    asconf_capable;  /* Does peer support ADDIP? */
                __u8    prsctp_capable;  /* Can peer do PR-SCTP? */
+               __u8    auth_capable;    /* Is peer doing SCTP-AUTH? */
 
-               __u32   adaption_ind;    /* Adaption Code point. */
+               __u32   adaptation_ind;  /* Adaptation Code point. */
 
                /* This mask is used to disable sending the ASCONF chunk
                 * with specified parameter to peer.
                 */
-               __u16 addip_disabled_mask;
+               __be16 addip_disabled_mask;
 
-               struct sctp_inithdr i;
+               struct sctp_inithdr_host i;
                int cookie_len;
                void *cookie;
 
@@ -1439,6 +1560,14 @@ struct sctp_association {
                 * Initial TSN Value minus 1
                 */
                __u32 addip_serial;
+
+               /* SCTP-AUTH: We need to know pears random number, hmac list
+                * and authenticated chunk list.  All that is part of the
+                * cookie and these are just pointers to those locations
+                */
+               sctp_random_param_t *peer_random;
+               sctp_chunks_param_t *peer_chunks;
+               sctp_hmac_algo_param_t *peer_hmacs;
        } peer;
 
        /* State       : A state variable indicating what state the
@@ -1468,9 +1597,9 @@ struct sctp_association {
         * These values will be initialized by system defaults, but can
         * be modified via the SCTP_RTOINFO socket option.
         */
-       __u32 rto_initial;
-       __u32 rto_max;
-       __u32 rto_min;
+       unsigned long rto_initial;
+       unsigned long rto_max;
+       unsigned long rto_min;
 
        /* Maximum number of new data packets that can be sent in a burst.  */
        int max_burst;
@@ -1488,9 +1617,35 @@ struct sctp_association {
        __u16 init_retries;
 
        /* The largest timeout or RTO value to use in attempting an INIT */
-       __u16 max_init_timeo;
+       unsigned long max_init_timeo;
+
+       /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+        * the destination address every heartbeat interval. This value
+        * will be inherited by all new transports.
+        */
+       unsigned long hbinterval;
 
-       int timeouts[SCTP_NUM_TIMEOUT_TYPES];
+       /* This is the max_retrans value for new transports in the
+        * association.
+        */
+       __u16 pathmaxrxt;
+
+       /* Flag that path mtu update is pending */
+       __u8   pmtu_pending;
+
+       /* Association : The smallest PMTU discovered for all of the
+        * PMTU        : peer's transport addresses.
+        */
+       __u32 pathmtu;
+
+       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       __u32 param_flags;
+
+       /* SACK delay timeout */
+       unsigned long sackdelay;
+
+
+       unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
        struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
 
        /* Transport to which SHUTDOWN chunk was last sent.  */
@@ -1549,16 +1704,16 @@ struct sctp_association {
         */
        int sndbuf_used;
 
+       /* This is the amount of memory that this association has allocated
+        * in the receive path at any given time.
+        */
+       atomic_t rmem_alloc;
+
        /* This is the wait queue head for send requests waiting on
         * the association sndbuf space.
         */
        wait_queue_head_t       wait;
 
-       /* Association : The smallest PMTU discovered for all of the
-        * PMTU        : peer's transport addresses.
-        */
-       __u32 pmtu;
-
        /* The message size at which SCTP fragmentation will occur. */
        __u32 frag_point;
 
@@ -1575,6 +1730,9 @@ struct sctp_association {
        __u32 default_context;
        __u32 default_timetolive;
 
+       /* Default receive parameters */
+       __u32 default_rcv_context;
+
        /* This tracks outbound ssn for a given stream.  */
        struct sctp_ssnmap *ssnmap;
 
@@ -1595,7 +1753,10 @@ struct sctp_association {
        /* How many duplicated TSNs have we seen?  */
        int numduptsns;
 
-       /* Number of seconds of idle time before an association is closed.  */
+       /* Number of seconds of idle time before an association is closed.
+        * In the association context, this is really used as a boolean
+        * since the real timeout is stored in the timeouts array
+        */
        __u32 autoclose;
 
        /* These are to support
@@ -1690,6 +1851,24 @@ struct sctp_association {
         */
        __u32 addip_serial;
 
+       /* SCTP AUTH: list of the endpoint shared keys.  These
+        * keys are provided out of band by the user applicaton
+        * and can't change during the lifetime of the association
+        */
+       struct list_head endpoint_shared_keys;
+
+       /* SCTP AUTH:
+        * The current generated assocaition shared key (secret)
+        */
+       struct sctp_auth_bytes *asoc_shared_key;
+
+       /* SCTP AUTH: hmac id of the first peer requested algorithm
+        * that we support.
+        */
+       __u16 default_hmac_id;
+
+       __u16 active_key_id;
+
        /* Need to send an ECNE Chunk? */
        char need_ecne;
 
@@ -1719,7 +1898,7 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
 
 struct sctp_association *
 sctp_association_new(const struct sctp_endpoint *, const struct sock *,
-                    sctp_scope_t scope, int gfp);
+                    sctp_scope_t scope, gfp_t gfp);
 void sctp_association_free(struct sctp_association *);
 void sctp_association_put(struct sctp_association *);
 void sctp_association_hold(struct sctp_association *);
@@ -1735,7 +1914,7 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
                            const union sctp_addr *laddr);
 struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
                                     const union sctp_addr *address,
-                                    const int gfp,
+                                    const gfp_t gfp,
                                     const int peer_state);
 void sctp_assoc_del_peer(struct sctp_association *asoc,
                         const union sctp_addr *addr);
@@ -1759,9 +1938,12 @@ void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned);
 void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned);
 void sctp_assoc_set_primary(struct sctp_association *,
                            struct sctp_transport *);
-int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, int);
+int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
+                                    gfp_t);
 int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
-                                        struct sctp_cookie*, int gfp);
+                                        struct sctp_cookie*,
+                                        gfp_t gfp);
+int sctp_assoc_set_id(struct sctp_association *, gfp_t);
 
 int sctp_cmp_addr_exact(const union sctp_addr *ss1,
                        const union sctp_addr *ss2);