Loading include/net/sctp/sctp.h +10 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,16 @@ int sctp_assocs_proc_init(void); void sctp_assocs_proc_exit(void); /* * Module global variables */ /* * sctp/protocol.c */ extern struct kmem_cache *sctp_chunk_cachep __read_mostly; extern struct kmem_cache *sctp_bucket_cachep __read_mostly; /* * Section: Macros, externs, and inlines */ Loading net/sctp/input.c +1 −1 Original line number Diff line number Diff line Loading @@ -590,7 +590,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) * Return 0 - If further processing is needed. * Return 1 - If the packet can be discarded right away. */ int sctp_rcv_ootb(struct sk_buff *skb) static int sctp_rcv_ootb(struct sk_buff *skb) { sctp_chunkhdr_t *ch; __u8 *ch_end; Loading net/sctp/ipv6.c +2 −0 Original line number Diff line number Diff line Loading @@ -641,6 +641,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, newsctp6sk = (struct sctp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; newinet = inet_sk(newsk); newnp = inet6_sk(newsk); Loading net/sctp/sm_make_chunk.c +0 −6 Original line number Diff line number Diff line Loading @@ -65,8 +65,6 @@ #include <net/sctp/sctp.h> #include <net/sctp/sm.h> extern struct kmem_cache *sctp_chunk_cachep; SCTP_STATIC struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc, __u8 type, __u8 flags, int paylen); Loading Loading @@ -115,15 +113,12 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, const void *payload, size_t paylen) { sctp_errhdr_t err; int padlen; __u16 len; /* Cause code constants are now defined in network order. */ err.cause = cause_code; len = sizeof(sctp_errhdr_t) + paylen; padlen = len % 4; err.length = htons(len); len += padlen; chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); sctp_addto_chunk(chunk, paylen, payload); } Loading Loading @@ -1454,7 +1449,6 @@ struct sctp_association *sctp_unpack_cookie( do_gettimeofday(&tv); if (!asoc && tv_lt(bear_cookie->expiration, tv)) { __u16 len; /* * Section 3.3.10.3 Stale Cookie Error (3) * Loading net/sctp/sm_statefuns.c +78 −25 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, const struct sctp_association *asoc, struct sctp_transport *transport); static sctp_disposition_t sctp_sf_abort_violation( const struct sctp_association *asoc, void *arg, sctp_cmd_seq_t *commands, const __u8 *payload, const size_t paylen); static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, const struct sctp_association *asoc, Loading @@ -104,6 +111,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen( void *arg, sctp_cmd_seq_t *commands); static sctp_disposition_t sctp_sf_violation_ctsn( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands); /* Small helper function that checks if the chunk length * is of the appropriate length. The 'required_length' argument * is set to be the size of a specific chunk we are testing. Loading Loading @@ -2880,6 +2894,13 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(const struct sctp_endpoint *ep, return SCTP_DISPOSITION_DISCARD; } /* If Cumulative TSN Ack beyond the max tsn currently * send, terminating the association and respond to the * sender with an ABORT. */ if (!TSN_lt(ctsn, asoc->next_tsn)) return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands); /* Return this SACK for further processing. */ sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh)); Loading Loading @@ -3691,40 +3712,21 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep, return SCTP_DISPOSITION_VIOLATION; } /* * Handle a protocol violation when the chunk length is invalid. * "Invalid" length is identified as smaller then the minimal length a * given chunk can be. For example, a SACK chunk has invalid length * if it's length is set to be smaller then the size of sctp_sack_chunk_t. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. * * Section: Not specified * Verification Tag: Nothing to do * Inputs * (endpoint, asoc, chunk) * * Outputs * (reply_msg, msg_up, counters) * * Generate an ABORT chunk and terminate the association. * Common function to handle a protocol violation. */ static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, static sctp_disposition_t sctp_sf_abort_violation( const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands, const __u8 *payload, const size_t paylen) { struct sctp_chunk *chunk = arg; struct sctp_chunk *abort = NULL; char err_str[]="The following chunk had invalid length:"; /* Make the abort chunk. */ abort = sctp_make_abort_violation(asoc, chunk, err_str, sizeof(err_str)); abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); if (!abort) goto nomem; Loading Loading @@ -3756,6 +3758,57 @@ static sctp_disposition_t sctp_sf_violation_chunklen( return SCTP_DISPOSITION_NOMEM; } /* * Handle a protocol violation when the chunk length is invalid. * "Invalid" length is identified as smaller then the minimal length a * given chunk can be. For example, a SACK chunk has invalid length * if it's length is set to be smaller then the size of sctp_sack_chunk_t. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. * * Section: Not specified * Verification Tag: Nothing to do * Inputs * (endpoint, asoc, chunk) * * Outputs * (reply_msg, msg_up, counters) * * Generate an ABORT chunk and terminate the association. */ static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { char err_str[]="The following chunk had invalid length:"; return sctp_sf_abort_violation(asoc, arg, commands, err_str, sizeof(err_str)); } /* Handle a protocol violation when the peer trying to advance the * cumulative tsn ack to a point beyond the max tsn currently sent. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. */ static sctp_disposition_t sctp_sf_violation_ctsn( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:"; return sctp_sf_abort_violation(asoc, arg, commands, err_str, sizeof(err_str)); } /*************************************************************************** * These are the state functions for handling primitive (Section 10) events. ***************************************************************************/ Loading Loading
include/net/sctp/sctp.h +10 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,16 @@ int sctp_assocs_proc_init(void); void sctp_assocs_proc_exit(void); /* * Module global variables */ /* * sctp/protocol.c */ extern struct kmem_cache *sctp_chunk_cachep __read_mostly; extern struct kmem_cache *sctp_bucket_cachep __read_mostly; /* * Section: Macros, externs, and inlines */ Loading
net/sctp/input.c +1 −1 Original line number Diff line number Diff line Loading @@ -590,7 +590,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) * Return 0 - If further processing is needed. * Return 1 - If the packet can be discarded right away. */ int sctp_rcv_ootb(struct sk_buff *skb) static int sctp_rcv_ootb(struct sk_buff *skb) { sctp_chunkhdr_t *ch; __u8 *ch_end; Loading
net/sctp/ipv6.c +2 −0 Original line number Diff line number Diff line Loading @@ -641,6 +641,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, newsctp6sk = (struct sctp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; newinet = inet_sk(newsk); newnp = inet6_sk(newsk); Loading
net/sctp/sm_make_chunk.c +0 −6 Original line number Diff line number Diff line Loading @@ -65,8 +65,6 @@ #include <net/sctp/sctp.h> #include <net/sctp/sm.h> extern struct kmem_cache *sctp_chunk_cachep; SCTP_STATIC struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc, __u8 type, __u8 flags, int paylen); Loading Loading @@ -115,15 +113,12 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, const void *payload, size_t paylen) { sctp_errhdr_t err; int padlen; __u16 len; /* Cause code constants are now defined in network order. */ err.cause = cause_code; len = sizeof(sctp_errhdr_t) + paylen; padlen = len % 4; err.length = htons(len); len += padlen; chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); sctp_addto_chunk(chunk, paylen, payload); } Loading Loading @@ -1454,7 +1449,6 @@ struct sctp_association *sctp_unpack_cookie( do_gettimeofday(&tv); if (!asoc && tv_lt(bear_cookie->expiration, tv)) { __u16 len; /* * Section 3.3.10.3 Stale Cookie Error (3) * Loading
net/sctp/sm_statefuns.c +78 −25 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, const struct sctp_association *asoc, struct sctp_transport *transport); static sctp_disposition_t sctp_sf_abort_violation( const struct sctp_association *asoc, void *arg, sctp_cmd_seq_t *commands, const __u8 *payload, const size_t paylen); static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, const struct sctp_association *asoc, Loading @@ -104,6 +111,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen( void *arg, sctp_cmd_seq_t *commands); static sctp_disposition_t sctp_sf_violation_ctsn( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands); /* Small helper function that checks if the chunk length * is of the appropriate length. The 'required_length' argument * is set to be the size of a specific chunk we are testing. Loading Loading @@ -2880,6 +2894,13 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(const struct sctp_endpoint *ep, return SCTP_DISPOSITION_DISCARD; } /* If Cumulative TSN Ack beyond the max tsn currently * send, terminating the association and respond to the * sender with an ABORT. */ if (!TSN_lt(ctsn, asoc->next_tsn)) return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands); /* Return this SACK for further processing. */ sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh)); Loading Loading @@ -3691,40 +3712,21 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep, return SCTP_DISPOSITION_VIOLATION; } /* * Handle a protocol violation when the chunk length is invalid. * "Invalid" length is identified as smaller then the minimal length a * given chunk can be. For example, a SACK chunk has invalid length * if it's length is set to be smaller then the size of sctp_sack_chunk_t. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. * * Section: Not specified * Verification Tag: Nothing to do * Inputs * (endpoint, asoc, chunk) * * Outputs * (reply_msg, msg_up, counters) * * Generate an ABORT chunk and terminate the association. * Common function to handle a protocol violation. */ static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, static sctp_disposition_t sctp_sf_abort_violation( const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) sctp_cmd_seq_t *commands, const __u8 *payload, const size_t paylen) { struct sctp_chunk *chunk = arg; struct sctp_chunk *abort = NULL; char err_str[]="The following chunk had invalid length:"; /* Make the abort chunk. */ abort = sctp_make_abort_violation(asoc, chunk, err_str, sizeof(err_str)); abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); if (!abort) goto nomem; Loading Loading @@ -3756,6 +3758,57 @@ static sctp_disposition_t sctp_sf_violation_chunklen( return SCTP_DISPOSITION_NOMEM; } /* * Handle a protocol violation when the chunk length is invalid. * "Invalid" length is identified as smaller then the minimal length a * given chunk can be. For example, a SACK chunk has invalid length * if it's length is set to be smaller then the size of sctp_sack_chunk_t. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. * * Section: Not specified * Verification Tag: Nothing to do * Inputs * (endpoint, asoc, chunk) * * Outputs * (reply_msg, msg_up, counters) * * Generate an ABORT chunk and terminate the association. */ static sctp_disposition_t sctp_sf_violation_chunklen( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { char err_str[]="The following chunk had invalid length:"; return sctp_sf_abort_violation(asoc, arg, commands, err_str, sizeof(err_str)); } /* Handle a protocol violation when the peer trying to advance the * cumulative tsn ack to a point beyond the max tsn currently sent. * * We inform the other end by sending an ABORT with a Protocol Violation * error code. */ static sctp_disposition_t sctp_sf_violation_ctsn( const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:"; return sctp_sf_abort_violation(asoc, arg, commands, err_str, sizeof(err_str)); } /*************************************************************************** * These are the state functions for handling primitive (Section 10) events. ***************************************************************************/ Loading