|
@@ -528,7 +528,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net,
|
|
|
(struct sctp_init_chunk *)chunk->chunk_hdr, chunk,
|
|
|
&err_chunk)) {
|
|
|
|
|
|
- sctp_error_t error = SCTP_ERROR_NO_RESOURCE;
|
|
|
+ enum sctp_error error = SCTP_ERROR_NO_RESOURCE;
|
|
|
|
|
|
/* This chunk contains fatal error. It is to be discarded.
|
|
|
* Send an ABORT, with causes. If there are no causes,
|
|
@@ -1233,7 +1233,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa,
|
|
|
union sctp_addr_param *addrparm;
|
|
|
struct sctp_errhdr *errhdr;
|
|
|
struct sctp_endpoint *ep;
|
|
|
- char buffer[sizeof(struct sctp_errhdr)+sizeof(union sctp_addr_param)];
|
|
|
+ char buffer[sizeof(*errhdr) + sizeof(*addrparm)];
|
|
|
struct sctp_af *af = sctp_get_af_specific(ssa->v4.sin_family);
|
|
|
|
|
|
/* Build the error on the stack. We are way to malloc crazy
|
|
@@ -1244,7 +1244,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa,
|
|
|
|
|
|
/* Copy into a parm format. */
|
|
|
len = af->to_addr_param(ssa, addrparm);
|
|
|
- len += sizeof(sctp_errhdr_t);
|
|
|
+ len += sizeof(*errhdr);
|
|
|
|
|
|
errhdr->cause = SCTP_ERROR_RESTART;
|
|
|
errhdr->length = htons(len);
|
|
@@ -2270,7 +2270,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_err(struct net *net,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
- sctp_errhdr_t *err;
|
|
|
+ struct sctp_errhdr *err;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
@@ -2278,7 +2278,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_err(struct net *net,
|
|
|
/* Make sure that the ERROR chunk has a valid length.
|
|
|
* The parameter walking depends on this as well.
|
|
|
*/
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_operr_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
@@ -2337,7 +2337,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net,
|
|
|
struct sctp_chunk *chunk = arg, *reply;
|
|
|
struct sctp_cookie_preserve_param bht;
|
|
|
struct sctp_bind_addr *bp;
|
|
|
- sctp_errhdr_t *err;
|
|
|
+ struct sctp_errhdr *err;
|
|
|
u32 stale;
|
|
|
|
|
|
if (attempts > asoc->max_init_attempts) {
|
|
@@ -2348,7 +2348,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net,
|
|
|
return SCTP_DISPOSITION_DELETE_TCB;
|
|
|
}
|
|
|
|
|
|
- err = (sctp_errhdr_t *)(chunk->skb->data);
|
|
|
+ err = (struct sctp_errhdr *)(chunk->skb->data);
|
|
|
|
|
|
/* When calculating the time extension, an implementation
|
|
|
* SHOULD use the RTT information measured based on the
|
|
@@ -2364,7 +2364,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net,
|
|
|
* to give ample time to retransmit the new cookie and thus
|
|
|
* yield a higher probability of success on the reattempt.
|
|
|
*/
|
|
|
- stale = ntohl(*(__be32 *)((u8 *)err + sizeof(sctp_errhdr_t)));
|
|
|
+ stale = ntohl(*(__be32 *)((u8 *)err + sizeof(*err)));
|
|
|
stale = (stale * 2) / 1000;
|
|
|
|
|
|
bht.param_hdr.type = SCTP_PARAM_COOKIE_PRESERVATIVE;
|
|
@@ -2499,13 +2499,14 @@ static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net,
|
|
|
/* See if we have an error cause code in the chunk. */
|
|
|
len = ntohs(chunk->chunk_hdr->length);
|
|
|
if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) {
|
|
|
+ struct sctp_errhdr *err;
|
|
|
|
|
|
- sctp_errhdr_t *err;
|
|
|
sctp_walk_errors(err, chunk->chunk_hdr);
|
|
|
if ((void *)err != (void *)chunk->chunk_end)
|
|
|
- return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
+ return sctp_sf_pdiscard(net, ep, asoc, type, arg,
|
|
|
+ commands);
|
|
|
|
|
|
- error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
|
|
|
+ error = ((struct sctp_errhdr *)chunk->skb->data)->cause;
|
|
|
}
|
|
|
|
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
|
|
@@ -2552,7 +2553,7 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(struct net *net,
|
|
|
/* See if we have an error cause code in the chunk. */
|
|
|
len = ntohs(chunk->chunk_hdr->length);
|
|
|
if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
|
|
|
- error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
|
|
|
+ error = ((struct sctp_errhdr *)chunk->skb->data)->cause;
|
|
|
|
|
|
return sctp_stop_t1_and_abort(net, commands, error, ECONNREFUSED, asoc,
|
|
|
chunk->transport);
|
|
@@ -2656,8 +2657,8 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(struct net *net,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
- sctp_shutdownhdr_t *sdh;
|
|
|
sctp_disposition_t disposition;
|
|
|
+ struct sctp_shutdownhdr *sdh;
|
|
|
struct sctp_ulpevent *ev;
|
|
|
__u32 ctsn;
|
|
|
|
|
@@ -2665,14 +2666,13 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(struct net *net,
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
|
|
/* Make sure that the SHUTDOWN chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(chunk,
|
|
|
- sizeof(struct sctp_shutdown_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
/* Convert the elaborate header. */
|
|
|
- sdh = (sctp_shutdownhdr_t *)chunk->skb->data;
|
|
|
- skb_pull(chunk->skb, sizeof(sctp_shutdownhdr_t));
|
|
|
+ sdh = (struct sctp_shutdownhdr *)chunk->skb->data;
|
|
|
+ skb_pull(chunk->skb, sizeof(*sdh));
|
|
|
chunk->subh.shutdown_hdr = sdh;
|
|
|
ctsn = ntohl(sdh->cum_tsn_ack);
|
|
|
|
|
@@ -2746,19 +2746,18 @@ sctp_disposition_t sctp_sf_do_9_2_shut_ctsn(struct net *net,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
- sctp_shutdownhdr_t *sdh;
|
|
|
+ struct sctp_shutdownhdr *sdh;
|
|
|
__u32 ctsn;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
|
|
/* Make sure that the SHUTDOWN chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(chunk,
|
|
|
- sizeof(struct sctp_shutdown_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
- sdh = (sctp_shutdownhdr_t *)chunk->skb->data;
|
|
|
+ sdh = (struct sctp_shutdownhdr *)chunk->skb->data;
|
|
|
ctsn = ntohl(sdh->cum_tsn_ack);
|
|
|
|
|
|
if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
|
|
@@ -2863,19 +2862,19 @@ sctp_disposition_t sctp_sf_do_ecn_cwr(struct net *net,
|
|
|
void *arg,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
- sctp_cwrhdr_t *cwr;
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
+ struct sctp_cwrhdr *cwr;
|
|
|
u32 lowest_tsn;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_ecne_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
- cwr = (sctp_cwrhdr_t *) chunk->skb->data;
|
|
|
- skb_pull(chunk->skb, sizeof(sctp_cwrhdr_t));
|
|
|
+ cwr = (struct sctp_cwrhdr *)chunk->skb->data;
|
|
|
+ skb_pull(chunk->skb, sizeof(*cwr));
|
|
|
|
|
|
lowest_tsn = ntohl(cwr->lowest_tsn);
|
|
|
|
|
@@ -2919,18 +2918,18 @@ sctp_disposition_t sctp_sf_do_ecne(struct net *net,
|
|
|
void *arg,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
- sctp_ecnehdr_t *ecne;
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
+ struct sctp_ecnehdr *ecne;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_ecne_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_ecne_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
- ecne = (sctp_ecnehdr_t *) chunk->skb->data;
|
|
|
- skb_pull(chunk->skb, sizeof(sctp_ecnehdr_t));
|
|
|
+ ecne = (struct sctp_ecnehdr *)chunk->skb->data;
|
|
|
+ skb_pull(chunk->skb, sizeof(*ecne));
|
|
|
|
|
|
/* If this is a newer ECNE than the last CWR packet we sent out */
|
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_ECN_ECNE,
|
|
@@ -3312,13 +3311,13 @@ sctp_disposition_t sctp_sf_operr_notify(struct net *net,
|
|
|
sctp_cmd_seq_t *commands)
|
|
|
{
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
- sctp_errhdr_t *err;
|
|
|
+ struct sctp_errhdr *err;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
|
|
/* Make sure that the ERROR chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_operr_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_operr_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
sctp_walk_errors(err, chunk->chunk_hdr);
|
|
@@ -3435,7 +3434,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
struct sk_buff *skb = chunk->skb;
|
|
|
struct sctp_chunkhdr *ch;
|
|
|
- sctp_errhdr_t *err;
|
|
|
+ struct sctp_errhdr *err;
|
|
|
__u8 *ch_end;
|
|
|
int ootb_shut_ack = 0;
|
|
|
int ootb_cookie_ack = 0;
|
|
@@ -3614,7 +3613,7 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net,
|
|
|
struct sctp_chunk *chunk = arg;
|
|
|
struct sctp_chunk *asconf_ack = NULL;
|
|
|
struct sctp_paramhdr *err_param = NULL;
|
|
|
- sctp_addiphdr_t *hdr;
|
|
|
+ struct sctp_addiphdr *hdr;
|
|
|
__u32 serial;
|
|
|
|
|
|
if (!sctp_vtag_verify(chunk, asoc)) {
|
|
@@ -3630,14 +3629,15 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net,
|
|
|
* described in [I-D.ietf-tsvwg-sctp-auth].
|
|
|
*/
|
|
|
if (!net->sctp.addip_noauth && !chunk->auth)
|
|
|
- return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
|
|
|
+ return sctp_sf_discard_chunk(net, ep, asoc, type, arg,
|
|
|
+ commands);
|
|
|
|
|
|
/* Make sure that the ASCONF ADDIP chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_addip_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_addip_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
- hdr = (sctp_addiphdr_t *)chunk->skb->data;
|
|
|
+ hdr = (struct sctp_addiphdr *)chunk->skb->data;
|
|
|
serial = ntohl(hdr->serial);
|
|
|
|
|
|
/* Verify the ASCONF chunk before processing it. */
|
|
@@ -3731,7 +3731,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
|
|
|
struct sctp_chunk *last_asconf = asoc->addip_last_asconf;
|
|
|
struct sctp_chunk *abort;
|
|
|
struct sctp_paramhdr *err_param = NULL;
|
|
|
- sctp_addiphdr_t *addip_hdr;
|
|
|
+ struct sctp_addiphdr *addip_hdr;
|
|
|
__u32 sent_serial, rcvd_serial;
|
|
|
|
|
|
if (!sctp_vtag_verify(asconf_ack, asoc)) {
|
|
@@ -3747,14 +3747,16 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
|
|
|
* described in [I-D.ietf-tsvwg-sctp-auth].
|
|
|
*/
|
|
|
if (!net->sctp.addip_noauth && !asconf_ack->auth)
|
|
|
- return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
|
|
|
+ return sctp_sf_discard_chunk(net, ep, asoc, type, arg,
|
|
|
+ commands);
|
|
|
|
|
|
/* Make sure that the ADDIP chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(asconf_ack, sizeof(sctp_addip_chunk_t)))
|
|
|
+ if (!sctp_chunk_length_valid(asconf_ack,
|
|
|
+ sizeof(struct sctp_addip_chunk)))
|
|
|
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
commands);
|
|
|
|
|
|
- addip_hdr = (sctp_addiphdr_t *)asconf_ack->skb->data;
|
|
|
+ addip_hdr = (struct sctp_addiphdr *)asconf_ack->skb->data;
|
|
|
rcvd_serial = ntohl(addip_hdr->serial);
|
|
|
|
|
|
/* Verify the ASCONF-ACK chunk before processing it. */
|
|
@@ -3763,7 +3765,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
|
|
|
(void *)err_param, commands);
|
|
|
|
|
|
if (last_asconf) {
|
|
|
- addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr;
|
|
|
+ addip_hdr = (struct sctp_addiphdr *)last_asconf->subh.addip_hdr;
|
|
|
sent_serial = ntohl(addip_hdr->serial);
|
|
|
} else {
|
|
|
sent_serial = asoc->addip_serial - 1;
|
|
@@ -3778,7 +3780,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
|
|
|
if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) &&
|
|
|
!(asoc->addip_last_asconf)) {
|
|
|
abort = sctp_make_abort(asoc, asconf_ack,
|
|
|
- sizeof(sctp_errhdr_t));
|
|
|
+ sizeof(struct sctp_errhdr));
|
|
|
if (abort) {
|
|
|
sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0);
|
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
|
|
@@ -3814,7 +3816,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
|
|
|
}
|
|
|
|
|
|
abort = sctp_make_abort(asoc, asconf_ack,
|
|
|
- sizeof(sctp_errhdr_t));
|
|
|
+ sizeof(struct sctp_errhdr));
|
|
|
if (abort) {
|
|
|
sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0);
|
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
|
|
@@ -4091,7 +4093,7 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
|
|
|
/* Pull in the auth header, so we can do some more verification */
|
|
|
auth_hdr = (struct sctp_authhdr *)chunk->skb->data;
|
|
|
chunk->subh.auth_hdr = auth_hdr;
|
|
|
- skb_pull(chunk->skb, sizeof(struct sctp_authhdr));
|
|
|
+ skb_pull(chunk->skb, sizeof(*auth_hdr));
|
|
|
|
|
|
/* Make sure that we support the HMAC algorithm from the auth
|
|
|
* chunk.
|
|
@@ -4110,7 +4112,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
|
|
|
/* Make sure that the length of the signature matches what
|
|
|
* we expect.
|
|
|
*/
|
|
|
- sig_len = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_auth_chunk_t);
|
|
|
+ sig_len = ntohs(chunk->chunk_hdr->length) -
|
|
|
+ sizeof(struct sctp_auth_chunk);
|
|
|
hmac = sctp_auth_get_hmac(ntohs(auth_hdr->hmac_id));
|
|
|
if (sig_len != hmac->hmac_len)
|
|
|
return SCTP_IERROR_PROTO_VIOLATION;
|
|
@@ -4132,8 +4135,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
|
|
|
memset(digest, 0, sig_len);
|
|
|
|
|
|
sctp_auth_calculate_hmac(asoc, chunk->skb,
|
|
|
- (struct sctp_auth_chunk *)chunk->chunk_hdr,
|
|
|
- GFP_ATOMIC);
|
|
|
+ (struct sctp_auth_chunk *)chunk->chunk_hdr,
|
|
|
+ GFP_ATOMIC);
|
|
|
|
|
|
/* Discard the packet if the digests do not match */
|
|
|
if (memcmp(save_digest, digest, sig_len)) {
|
|
@@ -5419,12 +5422,14 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown_ack(
|
|
|
*/
|
|
|
if (chunk) {
|
|
|
if (!sctp_vtag_verify(chunk, asoc))
|
|
|
- return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
+ return sctp_sf_pdiscard(net, ep, asoc, type, arg,
|
|
|
+ commands);
|
|
|
|
|
|
/* Make sure that the SHUTDOWN chunk has a valid length. */
|
|
|
- if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk_t)))
|
|
|
- return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
|
|
- commands);
|
|
|
+ if (!sctp_chunk_length_valid(
|
|
|
+ chunk, sizeof(struct sctp_shutdown_chunk)))
|
|
|
+ return sctp_sf_violation_chunklen(net, ep, asoc, type,
|
|
|
+ arg, commands);
|
|
|
}
|
|
|
|
|
|
/* If it has no more outstanding DATA chunks, the SHUTDOWN receiver
|