From f9bd6fd63296a2466fefd60ce26f2712be666d98 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Tue, 17 Jan 2006 11:52:12 -0800 Subject: [PATCH] --- yaml --- r: 19025 b: refs/heads/master c: 9834a2bb4970547540222fcba04e0a37d04cb0a0 h: refs/heads/master i: 19023: 07ae480af4dee7228122c80af9451eee14f1b730 v: v3 --- [refs] | 2 +- trunk/include/net/sctp/structs.h | 3 ++- trunk/net/sctp/sm_make_chunk.c | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index d53cb0b6ea15..12c3974371de 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7a48f923b8b27bfaa5f7b2a449a6fe268724ddd5 +refs/heads/master: 9834a2bb4970547540222fcba04e0a37d04cb0a0 diff --git a/trunk/include/net/sctp/structs.h b/trunk/include/net/sctp/structs.h index f5c22d77feab..72aeae4a0067 100644 --- a/trunk/include/net/sctp/structs.h +++ b/trunk/include/net/sctp/structs.h @@ -405,8 +405,9 @@ 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 diff --git a/trunk/net/sctp/sm_make_chunk.c b/trunk/net/sctp/sm_make_chunk.c index 556c495c6922..4fe1d6c863b1 100644 --- a/trunk/net/sctp/sm_make_chunk.c +++ b/trunk/net/sctp/sm_make_chunk.c @@ -1275,7 +1275,12 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, unsigned int keylen; char *key; - headersize = sizeof(sctp_paramhdr_t) + SCTP_SECRET_SIZE; + /* Header size is static data prior to the actual cookie, including + * any padding. + */ + headersize = sizeof(sctp_paramhdr_t) + + (sizeof(struct sctp_signed_cookie) - + sizeof(struct sctp_cookie)); bodysize = sizeof(struct sctp_cookie) + ntohs(init_chunk->chunk_hdr->length) + addrs_len; @@ -1362,7 +1367,12 @@ struct sctp_association *sctp_unpack_cookie( struct sk_buff *skb = chunk->skb; struct timeval tv; - headersize = sizeof(sctp_chunkhdr_t) + SCTP_SECRET_SIZE; + /* Header size is static data prior to the actual cookie, including + * any padding. + */ + headersize = sizeof(sctp_chunkhdr_t) + + (sizeof(struct sctp_signed_cookie) - + sizeof(struct sctp_cookie)); bodysize = ntohs(chunk->chunk_hdr->length) - headersize; fixed_size = headersize + sizeof(struct sctp_cookie);