Commit 7e5988df authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-remove-typedefs-from-structures-part-1'

Xin Long says:

====================
sctp: remove typedefs from structures part 1

As we know, typedef is suggested not to use in kernel, even checkpatch.pl
also gives warnings about it. Now sctp is using it for many structures.

All this kind of typedef's using should be removed. As the 1st part, this
patchset is to remove it for 11 basic structures in linux/sctp.h. It is
also to fix some indents.

No any code's logic is changed in these patches, only cleaning up.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 13834451 01a992be
...@@ -57,12 +57,12 @@ ...@@ -57,12 +57,12 @@
#include <uapi/linux/sctp.h> #include <uapi/linux/sctp.h>
/* Section 3.1. SCTP Common Header Format */ /* Section 3.1. SCTP Common Header Format */
typedef struct sctphdr { struct sctphdr {
__be16 source; __be16 source;
__be16 dest; __be16 dest;
__be32 vtag; __be32 vtag;
__le32 checksum; __le32 checksum;
} sctp_sctphdr_t; };
static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
{ {
...@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) ...@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
} }
/* Section 3.2. Chunk Field Descriptions. */ /* Section 3.2. Chunk Field Descriptions. */
typedef struct sctp_chunkhdr { struct sctp_chunkhdr {
__u8 type; __u8 type;
__u8 flags; __u8 flags;
__be16 length; __be16 length;
} sctp_chunkhdr_t; };
/* Section 3.2. Chunk Type Values. /* Section 3.2. Chunk Type Values.
...@@ -82,7 +82,7 @@ typedef struct sctp_chunkhdr { ...@@ -82,7 +82,7 @@ typedef struct sctp_chunkhdr {
* Value field. It takes a value from 0 to 254. The value of 255 is * Value field. It takes a value from 0 to 254. The value of 255 is
* reserved for future use as an extension field. * reserved for future use as an extension field.
*/ */
typedef enum { enum sctp_cid {
SCTP_CID_DATA = 0, SCTP_CID_DATA = 0,
SCTP_CID_INIT = 1, SCTP_CID_INIT = 1,
SCTP_CID_INIT_ACK = 2, SCTP_CID_INIT_ACK = 2,
...@@ -109,7 +109,7 @@ typedef enum { ...@@ -109,7 +109,7 @@ typedef enum {
SCTP_CID_ASCONF = 0xC1, SCTP_CID_ASCONF = 0xC1,
SCTP_CID_ASCONF_ACK = 0x80, SCTP_CID_ASCONF_ACK = 0x80,
SCTP_CID_RECONF = 0x82, SCTP_CID_RECONF = 0x82,
} sctp_cid_t; /* enum */ }; /* enum */
/* Section 3.2 /* Section 3.2
...@@ -117,12 +117,12 @@ typedef enum { ...@@ -117,12 +117,12 @@ typedef enum {
* the action that must be taken if the processing endpoint does not * the action that must be taken if the processing endpoint does not
* recognize the Chunk Type. * recognize the Chunk Type.
*/ */
typedef enum { enum {
SCTP_CID_ACTION_DISCARD = 0x00, SCTP_CID_ACTION_DISCARD = 0x00,
SCTP_CID_ACTION_DISCARD_ERR = 0x40, SCTP_CID_ACTION_DISCARD_ERR = 0x40,
SCTP_CID_ACTION_SKIP = 0x80, SCTP_CID_ACTION_SKIP = 0x80,
SCTP_CID_ACTION_SKIP_ERR = 0xc0, SCTP_CID_ACTION_SKIP_ERR = 0xc0,
} sctp_cid_action_t; };
enum { SCTP_CID_ACTION_MASK = 0xc0, }; enum { SCTP_CID_ACTION_MASK = 0xc0, };
...@@ -162,12 +162,12 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 }; ...@@ -162,12 +162,12 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
* Section 3.2.1 Optional/Variable-length Parmaeter Format. * Section 3.2.1 Optional/Variable-length Parmaeter Format.
*/ */
typedef struct sctp_paramhdr { struct sctp_paramhdr {
__be16 type; __be16 type;
__be16 length; __be16 length;
} sctp_paramhdr_t; };
typedef enum { enum sctp_param {
/* RFC 2960 Section 3.3.5 */ /* RFC 2960 Section 3.3.5 */
SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1), SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1),
...@@ -207,7 +207,7 @@ typedef enum { ...@@ -207,7 +207,7 @@ typedef enum {
SCTP_PARAM_RESET_RESPONSE = cpu_to_be16(0x0010), SCTP_PARAM_RESET_RESPONSE = cpu_to_be16(0x0010),
SCTP_PARAM_RESET_ADD_OUT_STREAMS = cpu_to_be16(0x0011), SCTP_PARAM_RESET_ADD_OUT_STREAMS = cpu_to_be16(0x0011),
SCTP_PARAM_RESET_ADD_IN_STREAMS = cpu_to_be16(0x0012), SCTP_PARAM_RESET_ADD_IN_STREAMS = cpu_to_be16(0x0012),
} sctp_param_t; /* enum */ }; /* enum */
/* RFC 2960 Section 3.2.1 /* RFC 2960 Section 3.2.1
...@@ -216,29 +216,29 @@ typedef enum { ...@@ -216,29 +216,29 @@ typedef enum {
* not recognize the Parameter Type. * not recognize the Parameter Type.
* *
*/ */
typedef enum { enum {
SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000), SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000),
SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000), SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000), SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000),
SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000), SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000),
} sctp_param_action_t; };
enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), }; enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ /* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
typedef struct sctp_datahdr { struct sctp_datahdr {
__be32 tsn; __be32 tsn;
__be16 stream; __be16 stream;
__be16 ssn; __be16 ssn;
__be32 ppid; __be32 ppid;
__u8 payload[0]; __u8 payload[0];
} sctp_datahdr_t; };
typedef struct sctp_data_chunk { struct sctp_data_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_datahdr_t data_hdr; struct sctp_datahdr data_hdr;
} sctp_data_chunk_t; };
/* DATA Chuck Specific Flags */ /* DATA Chuck Specific Flags */
enum { enum {
...@@ -257,54 +257,54 @@ enum { SCTP_DATA_FRAG_MASK = 0x03, }; ...@@ -257,54 +257,54 @@ enum { SCTP_DATA_FRAG_MASK = 0x03, };
* This chunk is used to initiate a SCTP association between two * This chunk is used to initiate a SCTP association between two
* endpoints. * endpoints.
*/ */
typedef struct sctp_inithdr { struct sctp_inithdr {
__be32 init_tag; __be32 init_tag;
__be32 a_rwnd; __be32 a_rwnd;
__be16 num_outbound_streams; __be16 num_outbound_streams;
__be16 num_inbound_streams; __be16 num_inbound_streams;
__be32 initial_tsn; __be32 initial_tsn;
__u8 params[0]; __u8 params[0];
} sctp_inithdr_t; };
typedef struct sctp_init_chunk { struct sctp_init_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_inithdr_t init_hdr; struct sctp_inithdr init_hdr;
} sctp_init_chunk_t; };
/* Section 3.3.2.1. IPv4 Address Parameter (5) */ /* Section 3.3.2.1. IPv4 Address Parameter (5) */
typedef struct sctp_ipv4addr_param { typedef struct sctp_ipv4addr_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
struct in_addr addr; struct in_addr addr;
} sctp_ipv4addr_param_t; } sctp_ipv4addr_param_t;
/* Section 3.3.2.1. IPv6 Address Parameter (6) */ /* Section 3.3.2.1. IPv6 Address Parameter (6) */
typedef struct sctp_ipv6addr_param { typedef struct sctp_ipv6addr_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
struct in6_addr addr; struct in6_addr addr;
} sctp_ipv6addr_param_t; } sctp_ipv6addr_param_t;
/* Section 3.3.2.1 Cookie Preservative (9) */ /* Section 3.3.2.1 Cookie Preservative (9) */
typedef struct sctp_cookie_preserve_param { typedef struct sctp_cookie_preserve_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__be32 lifespan_increment; __be32 lifespan_increment;
} sctp_cookie_preserve_param_t; } sctp_cookie_preserve_param_t;
/* Section 3.3.2.1 Host Name Address (11) */ /* Section 3.3.2.1 Host Name Address (11) */
typedef struct sctp_hostname_param { typedef struct sctp_hostname_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
uint8_t hostname[0]; uint8_t hostname[0];
} sctp_hostname_param_t; } sctp_hostname_param_t;
/* Section 3.3.2.1 Supported Address Types (12) */ /* Section 3.3.2.1 Supported Address Types (12) */
typedef struct sctp_supported_addrs_param { typedef struct sctp_supported_addrs_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__be16 types[0]; __be16 types[0];
} sctp_supported_addrs_param_t; } sctp_supported_addrs_param_t;
/* Appendix A. ECN Capable (32768) */ /* Appendix A. ECN Capable (32768) */
typedef struct sctp_ecn_capable_param { typedef struct sctp_ecn_capable_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
} sctp_ecn_capable_param_t; } sctp_ecn_capable_param_t;
/* ADDIP Section 3.2.6 Adaptation Layer Indication */ /* ADDIP Section 3.2.6 Adaptation Layer Indication */
...@@ -321,19 +321,19 @@ typedef struct sctp_supported_ext_param { ...@@ -321,19 +321,19 @@ typedef struct sctp_supported_ext_param {
/* AUTH Section 3.1 Random */ /* AUTH Section 3.1 Random */
typedef struct sctp_random_param { typedef struct sctp_random_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u8 random_val[0]; __u8 random_val[0];
} sctp_random_param_t; } sctp_random_param_t;
/* AUTH Section 3.2 Chunk List */ /* AUTH Section 3.2 Chunk List */
typedef struct sctp_chunks_param { typedef struct sctp_chunks_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u8 chunks[0]; __u8 chunks[0];
} sctp_chunks_param_t; } sctp_chunks_param_t;
/* AUTH Section 3.3 HMAC Algorithm */ /* AUTH Section 3.3 HMAC Algorithm */
typedef struct sctp_hmac_algo_param { typedef struct sctp_hmac_algo_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__be16 hmac_ids[0]; __be16 hmac_ids[0];
} sctp_hmac_algo_param_t; } sctp_hmac_algo_param_t;
...@@ -341,18 +341,18 @@ typedef struct sctp_hmac_algo_param { ...@@ -341,18 +341,18 @@ typedef struct sctp_hmac_algo_param {
* The INIT ACK chunk is used to acknowledge the initiation of an SCTP * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
* association. * association.
*/ */
typedef sctp_init_chunk_t sctp_initack_chunk_t; typedef struct sctp_init_chunk sctp_initack_chunk_t;
/* Section 3.3.3.1 State Cookie (7) */ /* Section 3.3.3.1 State Cookie (7) */
typedef struct sctp_cookie_param { typedef struct sctp_cookie_param {
sctp_paramhdr_t p; struct sctp_paramhdr p;
__u8 body[0]; __u8 body[0];
} sctp_cookie_param_t; } sctp_cookie_param_t;
/* Section 3.3.3.1 Unrecognized Parameters (8) */ /* Section 3.3.3.1 Unrecognized Parameters (8) */
typedef struct sctp_unrecognized_param { typedef struct sctp_unrecognized_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
sctp_paramhdr_t unrecognized; struct sctp_paramhdr unrecognized;
} sctp_unrecognized_param_t; } sctp_unrecognized_param_t;
...@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr { ...@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr {
} sctp_sackhdr_t; } sctp_sackhdr_t;
typedef struct sctp_sack_chunk { typedef struct sctp_sack_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_sackhdr_t sack_hdr; sctp_sackhdr_t sack_hdr;
} sctp_sack_chunk_t; } sctp_sack_chunk_t;
...@@ -399,11 +399,11 @@ typedef struct sctp_sack_chunk { ...@@ -399,11 +399,11 @@ typedef struct sctp_sack_chunk {
*/ */
typedef struct sctp_heartbeathdr { typedef struct sctp_heartbeathdr {
sctp_paramhdr_t info; struct sctp_paramhdr info;
} sctp_heartbeathdr_t; } sctp_heartbeathdr_t;
typedef struct sctp_heartbeat_chunk { typedef struct sctp_heartbeat_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_heartbeathdr_t hb_hdr; sctp_heartbeathdr_t hb_hdr;
} sctp_heartbeat_chunk_t; } sctp_heartbeat_chunk_t;
...@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk { ...@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk {
* chunk descriptor. * chunk descriptor.
*/ */
typedef struct sctp_abort_chunk { typedef struct sctp_abort_chunk {
sctp_chunkhdr_t uh; struct sctp_chunkhdr uh;
} sctp_abort_chunk_t; } sctp_abort_chunk_t;
...@@ -425,8 +425,8 @@ typedef struct sctp_shutdownhdr { ...@@ -425,8 +425,8 @@ typedef struct sctp_shutdownhdr {
} sctp_shutdownhdr_t; } sctp_shutdownhdr_t;
struct sctp_shutdown_chunk_t { struct sctp_shutdown_chunk_t {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr; sctp_shutdownhdr_t shutdown_hdr;
}; };
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
...@@ -438,8 +438,8 @@ typedef struct sctp_errhdr { ...@@ -438,8 +438,8 @@ typedef struct sctp_errhdr {
} sctp_errhdr_t; } sctp_errhdr_t;
typedef struct sctp_operr_chunk { typedef struct sctp_operr_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_errhdr_t err_hdr; sctp_errhdr_t err_hdr;
} sctp_operr_chunk_t; } sctp_operr_chunk_t;
/* RFC 2960 3.3.10 - Operation Error /* RFC 2960 3.3.10 - Operation Error
...@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr { ...@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr {
} sctp_ecnehdr_t; } sctp_ecnehdr_t;
typedef struct sctp_ecne_chunk { typedef struct sctp_ecne_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_ecnehdr_t ence_hdr; sctp_ecnehdr_t ence_hdr;
} sctp_ecne_chunk_t; } sctp_ecne_chunk_t;
...@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr { ...@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr {
} sctp_cwrhdr_t; } sctp_cwrhdr_t;
typedef struct sctp_cwr_chunk { typedef struct sctp_cwr_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_cwrhdr_t cwr_hdr; sctp_cwrhdr_t cwr_hdr;
} sctp_cwr_chunk_t; } sctp_cwr_chunk_t;
...@@ -639,7 +639,7 @@ struct sctp_fwdtsn_chunk { ...@@ -639,7 +639,7 @@ struct sctp_fwdtsn_chunk {
* report status of ASCONF processing. * report status of ASCONF processing.
*/ */
typedef struct sctp_addip_param { typedef struct sctp_addip_param {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__be32 crr_id; __be32 crr_id;
} sctp_addip_param_t; } sctp_addip_param_t;
...@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr { ...@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr {
} sctp_addiphdr_t; } sctp_addiphdr_t;
typedef struct sctp_addip_chunk { typedef struct sctp_addip_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_addiphdr_t addip_hdr; sctp_addiphdr_t addip_hdr;
} sctp_addip_chunk_t; } sctp_addip_chunk_t;
...@@ -709,7 +709,7 @@ typedef struct sctp_authhdr { ...@@ -709,7 +709,7 @@ typedef struct sctp_authhdr {
} sctp_authhdr_t; } sctp_authhdr_t;
typedef struct sctp_auth_chunk { typedef struct sctp_auth_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_authhdr_t auth_hdr; sctp_authhdr_t auth_hdr;
} sctp_auth_chunk_t; } sctp_auth_chunk_t;
...@@ -719,12 +719,12 @@ struct sctp_infox { ...@@ -719,12 +719,12 @@ struct sctp_infox {
}; };
struct sctp_reconf_chunk { struct sctp_reconf_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
__u8 params[0]; __u8 params[0];
}; };
struct sctp_strreset_outreq { struct sctp_strreset_outreq {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 request_seq; __u32 request_seq;
__u32 response_seq; __u32 response_seq;
__u32 send_reset_at_tsn; __u32 send_reset_at_tsn;
...@@ -732,18 +732,18 @@ struct sctp_strreset_outreq { ...@@ -732,18 +732,18 @@ struct sctp_strreset_outreq {
}; };
struct sctp_strreset_inreq { struct sctp_strreset_inreq {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 request_seq; __u32 request_seq;
__u16 list_of_streams[0]; __u16 list_of_streams[0];
}; };
struct sctp_strreset_tsnreq { struct sctp_strreset_tsnreq {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 request_seq; __u32 request_seq;
}; };
struct sctp_strreset_addstrm { struct sctp_strreset_addstrm {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 request_seq; __u32 request_seq;
__u16 number_of_streams; __u16 number_of_streams;
__u16 reserved; __u16 reserved;
...@@ -760,13 +760,13 @@ enum { ...@@ -760,13 +760,13 @@ enum {
}; };
struct sctp_strreset_resp { struct sctp_strreset_resp {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 response_seq; __u32 response_seq;
__u32 result; __u32 result;
}; };
struct sctp_strreset_resptsn { struct sctp_strreset_resptsn {
sctp_paramhdr_t param_hdr; struct sctp_paramhdr param_hdr;
__u32 response_seq; __u32 response_seq;
__u32 result; __u32 result;
__u32 senders_next_tsn; __u32 senders_next_tsn;
......
...@@ -97,8 +97,10 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, ...@@ -97,8 +97,10 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
struct sctp_hmac_algo_param *hmacs); struct sctp_hmac_algo_param *hmacs);
int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
__be16 hmac_id); __be16 hmac_id);
int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); int sctp_auth_send_cid(enum sctp_cid chunk,
int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); const struct sctp_association *asoc);
int sctp_auth_recv_cid(enum sctp_cid chunk,
const struct sctp_association *asoc);
void sctp_auth_calculate_hmac(const struct sctp_association *asoc, void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
struct sk_buff *skb, struct sk_buff *skb,
struct sctp_auth_chunk *auth, gfp_t gfp); struct sctp_auth_chunk *auth, gfp_t gfp);
......
...@@ -132,7 +132,7 @@ typedef union { ...@@ -132,7 +132,7 @@ typedef union {
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_transport *transport; struct sctp_transport *transport;
struct sctp_bind_addr *bp; struct sctp_bind_addr *bp;
sctp_init_chunk_t *init; struct sctp_init_chunk *init;
struct sctp_ulpevent *ulpevent; struct sctp_ulpevent *ulpevent;
struct sctp_packet *packet; struct sctp_packet *packet;
sctp_sackhdr_t *sackh; sctp_sackhdr_t *sackh;
...@@ -173,7 +173,7 @@ SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) ...@@ -173,7 +173,7 @@ SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)
SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport) SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport)
SCTP_ARG_CONSTRUCTOR(BA, struct sctp_bind_addr *, bp) SCTP_ARG_CONSTRUCTOR(BA, struct sctp_bind_addr *, bp)
SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init) SCTP_ARG_CONSTRUCTOR(PEER_INIT, struct sctp_init_chunk *, init)
SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent) SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent)
SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet) SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet)
SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
......
...@@ -130,7 +130,7 @@ typedef enum { ...@@ -130,7 +130,7 @@ typedef enum {
*/ */
typedef union { typedef union {
sctp_cid_t chunk; enum sctp_cid chunk;
sctp_event_timeout_t timeout; sctp_event_timeout_t timeout;
sctp_event_other_t other; sctp_event_other_t other;
sctp_event_primitive_t primitive; sctp_event_primitive_t primitive;
...@@ -141,7 +141,7 @@ static inline sctp_subtype_t \ ...@@ -141,7 +141,7 @@ static inline sctp_subtype_t \
SCTP_ST_## _name (_type _arg) \ SCTP_ST_## _name (_type _arg) \
{ sctp_subtype_t _retval; _retval._elt = _arg; return _retval; } { sctp_subtype_t _retval; _retval._elt = _arg; return _retval; }
SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, sctp_cid_t, chunk) SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, enum sctp_cid, chunk)
SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout) SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout)
SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other)
SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive)
...@@ -152,7 +152,7 @@ SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) ...@@ -152,7 +152,7 @@ SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive)
/* Calculate the actual data size in a data chunk */ /* Calculate the actual data size in a data chunk */
#define SCTP_DATA_SNDSIZE(c) ((int)((unsigned long)(c->chunk_end)\ #define SCTP_DATA_SNDSIZE(c) ((int)((unsigned long)(c->chunk_end)\
- (unsigned long)(c->chunk_hdr)\ - (unsigned long)(c->chunk_hdr)\
- sizeof(sctp_data_chunk_t))) - sizeof(struct sctp_data_chunk)))
/* Internal error codes */ /* Internal error codes */
typedef enum { typedef enum {
......
...@@ -470,7 +470,7 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) ...@@ -470,7 +470,7 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
#define _sctp_walk_params(pos, chunk, end, member)\ #define _sctp_walk_params(pos, chunk, end, member)\
for (pos.v = chunk->member;\ for (pos.v = chunk->member;\
pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\
pos.v += SCTP_PAD4(ntohs(pos.p->length))) pos.v += SCTP_PAD4(ntohs(pos.p->length)))
#define sctp_walk_errors(err, chunk_hdr)\ #define sctp_walk_errors(err, chunk_hdr)\
...@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) ...@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
#define _sctp_walk_errors(err, chunk_hdr, end)\ #define _sctp_walk_errors(err, chunk_hdr, end)\
for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
sizeof(sctp_chunkhdr_t));\ sizeof(struct sctp_chunkhdr));\
(void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
ntohs(err->length) >= sizeof(sctp_errhdr_t); \ ntohs(err->length) >= sizeof(sctp_errhdr_t); \
err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
......
...@@ -325,19 +325,17 @@ void sctp_generate_heartbeat_event(unsigned long peer); ...@@ -325,19 +325,17 @@ void sctp_generate_heartbeat_event(unsigned long peer);
void sctp_generate_reconf_event(unsigned long peer); void sctp_generate_reconf_event(unsigned long peer);
void sctp_generate_proto_unreach_event(unsigned long peer); void sctp_generate_proto_unreach_event(unsigned long peer);
void sctp_ootb_pkt_free(struct sctp_packet *); void sctp_ootb_pkt_free(struct sctp_packet *packet);
struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *, struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *ep,
const struct sctp_association *, const struct sctp_association *asoc,
struct sctp_chunk *, struct sctp_chunk *chunk,
gfp_t gfp, int *err, gfp_t gfp, int *err,
struct sctp_chunk **err_chk_p); struct sctp_chunk **err_chk_p);
int sctp_addip_addr_config(struct sctp_association *, sctp_param_t,
struct sockaddr_storage*, int);
/* 3rd level prototypes */ /* 3rd level prototypes */
__u32 sctp_generate_tag(const struct sctp_endpoint *); __u32 sctp_generate_tag(const struct sctp_endpoint *ep);
__u32 sctp_generate_tsn(const struct sctp_endpoint *); __u32 sctp_generate_tsn(const struct sctp_endpoint *ep);
/* Extern declarations for major data structures. */ /* Extern declarations for major data structures. */
extern sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES]; extern sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES];
...@@ -349,7 +347,7 @@ static inline __u16 sctp_data_size(struct sctp_chunk *chunk) ...@@ -349,7 +347,7 @@ static inline __u16 sctp_data_size(struct sctp_chunk *chunk)
__u16 size; __u16 size;
size = ntohs(chunk->chunk_hdr->length); size = ntohs(chunk->chunk_hdr->length);
size -= sizeof(sctp_data_chunk_t); size -= sizeof(struct sctp_data_chunk);
return size; return size;
} }
......
...@@ -310,9 +310,10 @@ struct sctp_cookie { ...@@ -310,9 +310,10 @@ struct sctp_cookie {
__u32 adaptation_ind; __u32 adaptation_ind;
__u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; __u8 auth_random[sizeof(struct sctp_paramhdr) +
SCTP_AUTH_RANDOM_LENGTH];
__u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2]; __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2];
__u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; __u8 auth_chunks[sizeof(struct sctp_paramhdr) + SCTP_AUTH_MAX_CHUNKS];
/* This is a shim for my peer's INIT packet, followed by /* This is a shim for my peer's INIT packet, followed by
* a copy of the raw address list of the association. * a copy of the raw address list of the association.
...@@ -1297,11 +1298,11 @@ int sctp_has_association(struct net *net, const union sctp_addr *laddr, ...@@ -1297,11 +1298,11 @@ int sctp_has_association(struct net *net, const union sctp_addr *laddr,
int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
const struct sctp_association *asoc, const struct sctp_association *asoc,
sctp_cid_t, sctp_init_chunk_t *peer_init, enum sctp_cid cid, struct sctp_init_chunk *peer_init,
struct sctp_chunk *chunk, struct sctp_chunk **err_chunk); struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
const union sctp_addr *peer, const union sctp_addr *peer,
sctp_init_chunk_t *init, gfp_t gfp); struct sctp_init_chunk *init, gfp_t gfp);
__u32 sctp_generate_tag(const struct sctp_endpoint *); __u32 sctp_generate_tag(const struct sctp_endpoint *);
__u32 sctp_generate_tsn(const struct sctp_endpoint *); __u32 sctp_generate_tsn(const struct sctp_endpoint *);
......
...@@ -38,8 +38,8 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff, ...@@ -38,8 +38,8 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
break; break;
} }
case IPPROTO_SCTP: { case IPPROTO_SCTP: {
sctp_sctphdr_t _sh; struct sctphdr _sh;
const sctp_sctphdr_t *sh; const struct sctphdr *sh;
sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh); sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh);
if (!sh) if (!sh)
......
...@@ -1037,9 +1037,9 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, ...@@ -1037,9 +1037,9 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
*/ */
static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len)
{ {
sctp_chunkhdr_t *sch, schunk; struct sctp_chunkhdr *sch, schunk;
sch = skb_header_pointer(skb, nh_len + sizeof(sctp_sctphdr_t), sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr),
sizeof(schunk), &schunk); sizeof(schunk), &schunk);
if (sch == NULL) if (sch == NULL)
return 0; return 0;
if (sch->type == SCTP_CID_ABORT) if (sch->type == SCTP_CID_ABORT)
...@@ -1070,9 +1070,9 @@ static inline bool is_new_conn(const struct sk_buff *skb, ...@@ -1070,9 +1070,9 @@ static inline bool is_new_conn(const struct sk_buff *skb,
return th->syn; return th->syn;
} }
case IPPROTO_SCTP: { case IPPROTO_SCTP: {
sctp_chunkhdr_t *sch, schunk; struct sctp_chunkhdr *sch, schunk;
sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t), sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr),
sizeof(schunk), &schunk); sizeof(schunk), &schunk);
if (sch == NULL) if (sch == NULL)
return false; return false;
......
...@@ -15,16 +15,15 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, ...@@ -15,16 +15,15 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
struct ip_vs_iphdr *iph) struct ip_vs_iphdr *iph)
{ {
struct ip_vs_service *svc; struct ip_vs_service *svc;
sctp_chunkhdr_t _schunkh, *sch; struct sctp_chunkhdr _schunkh, *sch;
sctp_sctphdr_t *sh, _sctph; struct sctphdr *sh, _sctph;
__be16 _ports[2], *ports = NULL; __be16 _ports[2], *ports = NULL;
if (likely(!ip_vs_iph_icmp(iph))) { if (likely(!ip_vs_iph_icmp(iph))) {
sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph); sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
if (sh) { if (sh) {
sch = skb_header_pointer( sch = skb_header_pointer(skb, iph->len + sizeof(_sctph),
skb, iph->len + sizeof(sctp_sctphdr_t), sizeof(_schunkh), &_schunkh);
sizeof(_schunkh), &_schunkh);
if (sch && (sch->type == SCTP_CID_INIT || if (sch && (sch->type == SCTP_CID_INIT ||
sysctl_sloppy_sctp(ipvs))) sysctl_sloppy_sctp(ipvs)))
ports = &sh->source; ports = &sh->source;
...@@ -77,7 +76,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, ...@@ -77,7 +76,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
return 1; return 1;
} }
static void sctp_nat_csum(struct sk_buff *skb, sctp_sctphdr_t *sctph, static void sctp_nat_csum(struct sk_buff *skb, struct sctphdr *sctph,
unsigned int sctphoff) unsigned int sctphoff)
{ {
sctph->checksum = sctp_compute_cksum(skb, sctphoff); sctph->checksum = sctp_compute_cksum(skb, sctphoff);
...@@ -88,7 +87,7 @@ static int ...@@ -88,7 +87,7 @@ static int
sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
{ {
sctp_sctphdr_t *sctph; struct sctphdr *sctph;
unsigned int sctphoff = iph->len; unsigned int sctphoff = iph->len;
bool payload_csum = false; bool payload_csum = false;
...@@ -135,7 +134,7 @@ static int ...@@ -135,7 +134,7 @@ static int
sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
{ {
sctp_sctphdr_t *sctph; struct sctphdr *sctph;
unsigned int sctphoff = iph->len; unsigned int sctphoff = iph->len;
bool payload_csum = false; bool payload_csum = false;
...@@ -378,7 +377,7 @@ static inline void ...@@ -378,7 +377,7 @@ static inline void
set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
int direction, const struct sk_buff *skb) int direction, const struct sk_buff *skb)
{ {
sctp_chunkhdr_t _sctpch, *sch; struct sctp_chunkhdr _sctpch, *sch;
unsigned char chunk_type; unsigned char chunk_type;
int event, next_state; int event, next_state;
int ihl, cofs; int ihl, cofs;
...@@ -389,7 +388,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, ...@@ -389,7 +388,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
ihl = ip_hdrlen(skb); ihl = ip_hdrlen(skb);
#endif #endif
cofs = ihl + sizeof(sctp_sctphdr_t); cofs = ihl + sizeof(struct sctphdr);
sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch); sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch);
if (sch == NULL) if (sch == NULL)
return; return;
...@@ -410,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, ...@@ -410,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
(sch->type == SCTP_CID_COOKIE_ACK)) { (sch->type == SCTP_CID_COOKIE_ACK)) {
int clen = ntohs(sch->length); int clen = ntohs(sch->length);
if (clen >= sizeof(sctp_chunkhdr_t)) { if (clen >= sizeof(_sctpch)) {
sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4), sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4),
sizeof(_sctpch), &_sctpch); sizeof(_sctpch), &_sctpch);
if (sch && sch->type == SCTP_CID_ABORT) if (sch && sch->type == SCTP_CID_ABORT)
......
...@@ -190,7 +190,7 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) ...@@ -190,7 +190,7 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct)
} }
#define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \
for ((offset) = (dataoff) + sizeof(sctp_sctphdr_t), (count) = 0; \ for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \
(offset) < (skb)->len && \ (offset) < (skb)->len && \
((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \
(offset) += (ntohs((sch)->length) + 3) & ~3, (count)++) (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++)
...@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct, ...@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct,
unsigned long *map) unsigned long *map)
{ {
u_int32_t offset, count; u_int32_t offset, count;
sctp_chunkhdr_t _sch, *sch; struct sctp_chunkhdr _sch, *sch;
int flag; int flag;
flag = 0; flag = 0;
...@@ -395,9 +395,9 @@ static int sctp_packet(struct nf_conn *ct, ...@@ -395,9 +395,9 @@ static int sctp_packet(struct nf_conn *ct,
/* If it is an INIT or an INIT ACK note down the vtag */ /* If it is an INIT or an INIT ACK note down the vtag */
if (sch->type == SCTP_CID_INIT || if (sch->type == SCTP_CID_INIT ||
sch->type == SCTP_CID_INIT_ACK) { sch->type == SCTP_CID_INIT_ACK) {
sctp_inithdr_t _inithdr, *ih; struct sctp_inithdr _inithdr, *ih;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(_sch),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) if (ih == NULL)
goto out_unlock; goto out_unlock;
...@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb, ...@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb,
/* Copy the vtag into the state info */ /* Copy the vtag into the state info */
if (sch->type == SCTP_CID_INIT) { if (sch->type == SCTP_CID_INIT) {
if (sh->vtag == 0) { struct sctp_inithdr _inithdr, *ih;
sctp_inithdr_t _inithdr, *ih; /* Sec 8.5.1 (A) */
if (sh->vtag)
return false;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(_sch),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) if (!ih)
return false; return false;
pr_debug("Setting vtag %x for new conn\n", pr_debug("Setting vtag %x for new conn\n",
ih->init_tag); ih->init_tag);
ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ih->init_tag;
ih->init_tag;
} else {
/* Sec 8.5.1 (A) */
return false;
}
} else if (sch->type == SCTP_CID_HEARTBEAT) { } else if (sch->type == SCTP_CID_HEARTBEAT) {
pr_debug("Setting vtag %x for secondary conntrack\n", pr_debug("Setting vtag %x for secondary conntrack\n",
sh->vtag); sh->vtag);
......
...@@ -32,7 +32,7 @@ sctp_manip_pkt(struct sk_buff *skb, ...@@ -32,7 +32,7 @@ sctp_manip_pkt(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple, const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) enum nf_nat_manip_type maniptype)
{ {
sctp_sctphdr_t *hdr; struct sctphdr *hdr;
int hdrsize = 8; int hdrsize = 8;
/* This could be an inner header returned in imcp packet; in such /* This could be an inner header returned in imcp packet; in such
......
...@@ -42,8 +42,8 @@ match_packet(const struct sk_buff *skb, ...@@ -42,8 +42,8 @@ match_packet(const struct sk_buff *skb,
bool *hotdrop) bool *hotdrop)
{ {
u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)]; u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)];
const sctp_chunkhdr_t *sch; const struct sctp_chunkhdr *sch;
sctp_chunkhdr_t _sch; struct sctp_chunkhdr _sch;
int chunk_match_type = info->chunk_match_type; int chunk_match_type = info->chunk_match_type;
const struct xt_sctp_flag_info *flag_info = info->flag_info; const struct xt_sctp_flag_info *flag_info = info->flag_info;
int flag_count = info->flag_count; int flag_count = info->flag_count;
...@@ -118,8 +118,8 @@ static bool ...@@ -118,8 +118,8 @@ static bool
sctp_mt(const struct sk_buff *skb, struct xt_action_param *par) sctp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{ {
const struct xt_sctp_info *info = par->matchinfo; const struct xt_sctp_info *info = par->matchinfo;
const sctp_sctphdr_t *sh; const struct sctphdr *sh;
sctp_sctphdr_t _sh; struct sctphdr _sh;
if (par->fragoff != 0) { if (par->fragoff != 0) {
pr_debug("Dropping non-first fragment.. FIXME\n"); pr_debug("Dropping non-first fragment.. FIXME\n");
...@@ -136,13 +136,13 @@ sctp_mt(const struct sk_buff *skb, struct xt_action_param *par) ...@@ -136,13 +136,13 @@ sctp_mt(const struct sk_buff *skb, struct xt_action_param *par)
return SCCHECK(ntohs(sh->source) >= info->spts[0] return SCCHECK(ntohs(sh->source) >= info->spts[0]
&& ntohs(sh->source) <= info->spts[1], && ntohs(sh->source) <= info->spts[1],
XT_SCTP_SRC_PORTS, info->flags, info->invflags) XT_SCTP_SRC_PORTS, info->flags, info->invflags) &&
&& SCCHECK(ntohs(sh->dest) >= info->dpts[0] SCCHECK(ntohs(sh->dest) >= info->dpts[0]
&& ntohs(sh->dest) <= info->dpts[1], && ntohs(sh->dest) <= info->dpts[1],
XT_SCTP_DEST_PORTS, info->flags, info->invflags) XT_SCTP_DEST_PORTS, info->flags, info->invflags) &&
&& SCCHECK(match_packet(skb, par->thoff + sizeof(sctp_sctphdr_t), SCCHECK(match_packet(skb, par->thoff + sizeof(_sh),
info, &par->hotdrop), info, &par->hotdrop),
XT_SCTP_CHUNK_TYPES, info->flags, info->invflags); XT_SCTP_CHUNK_TYPES, info->flags, info->invflags);
} }
static int sctp_mt_check(const struct xt_mtchk_param *par) static int sctp_mt_check(const struct xt_mtchk_param *par)
......
...@@ -71,7 +71,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a ...@@ -71,7 +71,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
{ {
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
struct sctp_sock *sp; struct sctp_sock *sp;
sctp_paramhdr_t *p; struct sctp_paramhdr *p;
int i; int i;
/* Retrieve the SCTP per socket area. */ /* Retrieve the SCTP per socket area. */
...@@ -284,9 +284,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a ...@@ -284,9 +284,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
ntohs(ep->auth_chunk_list->param_hdr.length)); ntohs(ep->auth_chunk_list->param_hdr.length));
/* Get the AUTH random number for this association */ /* Get the AUTH random number for this association */
p = (sctp_paramhdr_t *)asoc->c.auth_random; p = (struct sctp_paramhdr *)asoc->c.auth_random;
p->type = SCTP_PARAM_RANDOM; p->type = SCTP_PARAM_RANDOM;
p->length = htons(sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH); p->length = htons(sizeof(*p) + SCTP_AUTH_RANDOM_LENGTH);
get_random_bytes(p+1, SCTP_AUTH_RANDOM_LENGTH); get_random_bytes(p+1, SCTP_AUTH_RANDOM_LENGTH);
return asoc; return asoc;
......
...@@ -538,7 +538,8 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc) ...@@ -538,7 +538,8 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
if (!hmacs) if (!hmacs)
return NULL; return NULL;
n_elt = (ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t)) >> 1; n_elt = (ntohs(hmacs->param_hdr.length) -
sizeof(struct sctp_paramhdr)) >> 1;
for (i = 0; i < n_elt; i++) { for (i = 0; i < n_elt; i++) {
id = ntohs(hmacs->hmac_ids[i]); id = ntohs(hmacs->hmac_ids[i]);
...@@ -589,7 +590,8 @@ int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, ...@@ -589,7 +590,8 @@ int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
return 0; return 0;
hmacs = (struct sctp_hmac_algo_param *)asoc->c.auth_hmacs; hmacs = (struct sctp_hmac_algo_param *)asoc->c.auth_hmacs;
n_elt = (ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t)) >> 1; n_elt = (ntohs(hmacs->param_hdr.length) -
sizeof(struct sctp_paramhdr)) >> 1;
return __sctp_auth_find_hmacid(hmacs->hmac_ids, n_elt, hmac_id); return __sctp_auth_find_hmacid(hmacs->hmac_ids, n_elt, hmac_id);
} }
...@@ -612,8 +614,8 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, ...@@ -612,8 +614,8 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
if (asoc->default_hmac_id) if (asoc->default_hmac_id)
return; return;
n_params = (ntohs(hmacs->param_hdr.length) n_params = (ntohs(hmacs->param_hdr.length) -
- sizeof(sctp_paramhdr_t)) >> 1; sizeof(struct sctp_paramhdr)) >> 1;
ep = asoc->ep; ep = asoc->ep;
for (i = 0; i < n_params; i++) { for (i = 0; i < n_params; i++) {
id = ntohs(hmacs->hmac_ids[i]); id = ntohs(hmacs->hmac_ids[i]);
...@@ -632,7 +634,7 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, ...@@ -632,7 +634,7 @@ void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
/* Check to see if the given chunk is supposed to be authenticated */ /* Check to see if the given chunk is supposed to be authenticated */
static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param) static int __sctp_auth_cid(enum sctp_cid chunk, struct sctp_chunks_param *param)
{ {
unsigned short len; unsigned short len;
int found = 0; int found = 0;
...@@ -641,7 +643,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param) ...@@ -641,7 +643,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
if (!param || param->param_hdr.length == 0) if (!param || param->param_hdr.length == 0)
return 0; return 0;
len = ntohs(param->param_hdr.length) - sizeof(sctp_paramhdr_t); len = ntohs(param->param_hdr.length) - sizeof(struct sctp_paramhdr);
/* SCTP-AUTH, Section 3.2 /* SCTP-AUTH, Section 3.2
* The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH * The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH
...@@ -668,7 +670,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param) ...@@ -668,7 +670,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
} }
/* Check if peer requested that this chunk is authenticated */ /* Check if peer requested that this chunk is authenticated */
int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) int sctp_auth_send_cid(enum sctp_cid chunk, const struct sctp_association *asoc)
{ {
if (!asoc) if (!asoc)
return 0; return 0;
...@@ -680,7 +682,7 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) ...@@ -680,7 +682,7 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
} }
/* Check if we requested that peer authenticate this chunk. */ /* Check if we requested that peer authenticate this chunk. */
int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc) int sctp_auth_recv_cid(enum sctp_cid chunk, const struct sctp_association *asoc)
{ {
if (!asoc) if (!asoc)
return 0; return 0;
...@@ -775,7 +777,7 @@ int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id) ...@@ -775,7 +777,7 @@ int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id)
/* Check if we can add this chunk to the array */ /* Check if we can add this chunk to the array */
param_len = ntohs(p->param_hdr.length); param_len = ntohs(p->param_hdr.length);
nchunks = param_len - sizeof(sctp_paramhdr_t); nchunks = param_len - sizeof(struct sctp_paramhdr);
if (nchunks == SCTP_NUM_CHUNK_TYPES) if (nchunks == SCTP_NUM_CHUNK_TYPES)
return -EINVAL; return -EINVAL;
...@@ -812,9 +814,11 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, ...@@ -812,9 +814,11 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
return -EINVAL; return -EINVAL;
for (i = 0; i < hmacs->shmac_num_idents; i++) for (i = 0; i < hmacs->shmac_num_idents; i++)
ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]); ep->auth_hmacs_list->hmac_ids[i] =
ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) + htons(hmacs->shmac_idents[i]);
hmacs->shmac_num_idents * sizeof(__u16)); ep->auth_hmacs_list->param_hdr.length =
htons(sizeof(struct sctp_paramhdr) +
hmacs->shmac_num_idents * sizeof(__u16));
return 0; return 0;
} }
......
...@@ -90,12 +90,13 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, ...@@ -90,12 +90,13 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
*/ */
auth_hmacs->param_hdr.type = SCTP_PARAM_HMAC_ALGO; auth_hmacs->param_hdr.type = SCTP_PARAM_HMAC_ALGO;
auth_hmacs->param_hdr.length = auth_hmacs->param_hdr.length =
htons(sizeof(sctp_paramhdr_t) + 2); htons(sizeof(struct sctp_paramhdr) + 2);
auth_hmacs->hmac_ids[0] = htons(SCTP_AUTH_HMAC_ID_SHA1); auth_hmacs->hmac_ids[0] = htons(SCTP_AUTH_HMAC_ID_SHA1);
/* Initialize the CHUNKS parameter */ /* Initialize the CHUNKS parameter */
auth_chunks->param_hdr.type = SCTP_PARAM_CHUNKS; auth_chunks->param_hdr.type = SCTP_PARAM_CHUNKS;
auth_chunks->param_hdr.length = htons(sizeof(sctp_paramhdr_t)); auth_chunks->param_hdr.length =
htons(sizeof(struct sctp_paramhdr));
/* If the Add-IP functionality is enabled, we must /* If the Add-IP functionality is enabled, we must
* authenticate, ASCONF and ASCONF-ACK chunks * authenticate, ASCONF and ASCONF-ACK chunks
...@@ -104,7 +105,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, ...@@ -104,7 +105,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
auth_chunks->chunks[0] = SCTP_CID_ASCONF; auth_chunks->chunks[0] = SCTP_CID_ASCONF;
auth_chunks->chunks[1] = SCTP_CID_ASCONF_ACK; auth_chunks->chunks[1] = SCTP_CID_ASCONF_ACK;
auth_chunks->param_hdr.length = auth_chunks->param_hdr.length =
htons(sizeof(sctp_paramhdr_t) + 2); htons(sizeof(struct sctp_paramhdr) + 2);
} }
} }
......
...@@ -663,19 +663,19 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -663,19 +663,19 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
*/ */
static int sctp_rcv_ootb(struct sk_buff *skb) static int sctp_rcv_ootb(struct sk_buff *skb)
{ {
sctp_chunkhdr_t *ch, _ch; struct sctp_chunkhdr *ch, _ch;
int ch_end, offset = 0; int ch_end, offset = 0;
/* Scan through all the chunks in the packet. */ /* Scan through all the chunks in the packet. */
do { do {
/* Make sure we have at least the header there */ /* Make sure we have at least the header there */
if (offset + sizeof(sctp_chunkhdr_t) > skb->len) if (offset + sizeof(_ch) > skb->len)
break; break;
ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch);
/* Break out if chunk length is less then minimal. */ /* Break out if chunk length is less then minimal. */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(_ch))
break; break;
ch_end = offset + SCTP_PAD4(ntohs(ch->length)); ch_end = offset + SCTP_PAD4(ntohs(ch->length));
...@@ -1051,7 +1051,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, ...@@ -1051,7 +1051,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
union sctp_addr *paddr = &addr; union sctp_addr *paddr = &addr;
struct sctphdr *sh = sctp_hdr(skb); struct sctphdr *sh = sctp_hdr(skb);
union sctp_params params; union sctp_params params;
sctp_init_chunk_t *init; struct sctp_init_chunk *init;
struct sctp_af *af; struct sctp_af *af;
/* /*
...@@ -1070,7 +1070,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, ...@@ -1070,7 +1070,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
/* Find the start of the TLVs and the end of the chunk. This is /* Find the start of the TLVs and the end of the chunk. This is
* the region we search for address parameters. * the region we search for address parameters.
*/ */
init = (sctp_init_chunk_t *)skb->data; init = (struct sctp_init_chunk *)skb->data;
/* Walk the parameters looking for embedded addresses. */ /* Walk the parameters looking for embedded addresses. */
sctp_walk_params(params, init, init_hdr.params) { sctp_walk_params(params, init, init_hdr.params) {
...@@ -1106,7 +1106,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, ...@@ -1106,7 +1106,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
*/ */
static struct sctp_association *__sctp_rcv_asconf_lookup( static struct sctp_association *__sctp_rcv_asconf_lookup(
struct net *net, struct net *net,
sctp_chunkhdr_t *ch, struct sctp_chunkhdr *ch,
const union sctp_addr *laddr, const union sctp_addr *laddr,
__be16 peer_port, __be16 peer_port,
struct sctp_transport **transportp) struct sctp_transport **transportp)
...@@ -1144,7 +1144,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1144,7 +1144,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
struct sctp_transport **transportp) struct sctp_transport **transportp)
{ {
struct sctp_association *asoc = NULL; struct sctp_association *asoc = NULL;
sctp_chunkhdr_t *ch; struct sctp_chunkhdr *ch;
int have_auth = 0; int have_auth = 0;
unsigned int chunk_num = 1; unsigned int chunk_num = 1;
__u8 *ch_end; __u8 *ch_end;
...@@ -1152,10 +1152,10 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1152,10 +1152,10 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
/* Walk through the chunks looking for AUTH or ASCONF chunks /* Walk through the chunks looking for AUTH or ASCONF chunks
* to help us find the association. * to help us find the association.
*/ */
ch = (sctp_chunkhdr_t *) skb->data; ch = (struct sctp_chunkhdr *)skb->data;
do { do {
/* Break out if chunk length is less then minimal. */ /* Break out if chunk length is less then minimal. */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(*ch))
break; break;
ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
...@@ -1192,7 +1192,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1192,7 +1192,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
if (asoc) if (asoc)
break; break;
ch = (sctp_chunkhdr_t *) ch_end; ch = (struct sctp_chunkhdr *)ch_end;
chunk_num++; chunk_num++;
} while (ch_end < skb_tail_pointer(skb)); } while (ch_end < skb_tail_pointer(skb));
...@@ -1210,7 +1210,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, ...@@ -1210,7 +1210,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net,
const union sctp_addr *laddr, const union sctp_addr *laddr,
struct sctp_transport **transportp) struct sctp_transport **transportp)
{ {
sctp_chunkhdr_t *ch; struct sctp_chunkhdr *ch;
/* We do not allow GSO frames here as we need to linearize and /* We do not allow GSO frames here as we need to linearize and
* then cannot guarantee frame boundaries. This shouldn't be an * then cannot guarantee frame boundaries. This shouldn't be an
...@@ -1220,7 +1220,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, ...@@ -1220,7 +1220,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net,
if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP) if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP)
return NULL; return NULL;
ch = (sctp_chunkhdr_t *) skb->data; ch = (struct sctp_chunkhdr *)skb->data;
/* The code below will attempt to walk the chunk and extract /* The code below will attempt to walk the chunk and extract
* parameter information. Before we do that, we need to verify * parameter information. Before we do that, we need to verify
......
...@@ -99,7 +99,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) ...@@ -99,7 +99,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
{ {
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
sctp_chunkhdr_t *ch = NULL; struct sctp_chunkhdr *ch = NULL;
chunk = queue->in_progress; chunk = queue->in_progress;
/* If there is no more chunks in this packet, say so */ /* If there is no more chunks in this packet, say so */
...@@ -108,7 +108,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) ...@@ -108,7 +108,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
chunk->pdiscard) chunk->pdiscard)
return NULL; return NULL;
ch = (sctp_chunkhdr_t *)chunk->chunk_end; ch = (struct sctp_chunkhdr *)chunk->chunk_end;
return ch; return ch;
} }
...@@ -122,7 +122,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) ...@@ -122,7 +122,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
{ {
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
sctp_chunkhdr_t *ch = NULL; struct sctp_chunkhdr *ch = NULL;
/* The assumption is that we are safe to process the chunks /* The assumption is that we are safe to process the chunks
* at this time. * at this time.
...@@ -151,7 +151,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -151,7 +151,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
chunk = queue->in_progress = NULL; chunk = queue->in_progress = NULL;
} else { } else {
/* Nothing to do. Next chunk in the packet, please. */ /* Nothing to do. Next chunk in the packet, please. */
ch = (sctp_chunkhdr_t *) chunk->chunk_end; ch = (struct sctp_chunkhdr *)chunk->chunk_end;
/* Force chunk->skb->data to chunk->chunk_end. */ /* Force chunk->skb->data to chunk->chunk_end. */
skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data);
/* We are guaranteed to pull a SCTP header. */ /* We are guaranteed to pull a SCTP header. */
...@@ -195,7 +195,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -195,7 +195,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
new_skb: new_skb:
/* This is the first chunk in the packet. */ /* This is the first chunk in the packet. */
ch = (sctp_chunkhdr_t *) chunk->skb->data; ch = (struct sctp_chunkhdr *)chunk->skb->data;
chunk->singleton = 1; chunk->singleton = 1;
chunk->data_accepted = 0; chunk->data_accepted = 0;
chunk->pdiscard = 0; chunk->pdiscard = 0;
...@@ -214,11 +214,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -214,11 +214,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
chunk->chunk_hdr = ch; chunk->chunk_hdr = ch;
chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); skb_pull(chunk->skb, sizeof(*ch));
chunk->subh.v = NULL; /* Subheader is no longer valid. */ chunk->subh.v = NULL; /* Subheader is no longer valid. */
if (chunk->chunk_end + sizeof(sctp_chunkhdr_t) < if (chunk->chunk_end + sizeof(*ch) < skb_tail_pointer(chunk->skb)) {
skb_tail_pointer(chunk->skb)) {
/* This is not a singleton */ /* This is not a singleton */
chunk->singleton = 0; chunk->singleton = 0;
} else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) {
......
...@@ -723,8 +723,8 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet, ...@@ -723,8 +723,8 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
/* Check whether this chunk and all the rest of pending data will fit /* Check whether this chunk and all the rest of pending data will fit
* or delay in hopes of bundling a full sized packet. * or delay in hopes of bundling a full sized packet.
*/ */
if (chunk->skb->len + q->out_qlen > if (chunk->skb->len + q->out_qlen > transport->pathmtu -
transport->pathmtu - packet->overhead - sizeof(sctp_data_chunk_t) - 4) packet->overhead - sizeof(struct sctp_data_chunk) - 4)
/* Enough data queued to fill a packet */ /* Enough data queued to fill a packet */
return SCTP_XMIT_OK; return SCTP_XMIT_OK;
......
This diff is collapsed.
...@@ -647,7 +647,7 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands, ...@@ -647,7 +647,7 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands,
static int sctp_cmd_process_init(sctp_cmd_seq_t *commands, static int sctp_cmd_process_init(sctp_cmd_seq_t *commands,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_chunk *chunk, struct sctp_chunk *chunk,
sctp_init_chunk_t *peer_init, struct sctp_init_chunk *peer_init,
gfp_t gfp) gfp_t gfp)
{ {
int error; int error;
...@@ -955,9 +955,10 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, ...@@ -955,9 +955,10 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds,
switch (err_hdr->cause) { switch (err_hdr->cause) {
case SCTP_ERROR_UNKNOWN_CHUNK: case SCTP_ERROR_UNKNOWN_CHUNK:
{ {
sctp_chunkhdr_t *unk_chunk_hdr; struct sctp_chunkhdr *unk_chunk_hdr;
unk_chunk_hdr = (sctp_chunkhdr_t *)err_hdr->variable; unk_chunk_hdr = (struct sctp_chunkhdr *)
err_hdr->variable;
switch (unk_chunk_hdr->type) { switch (unk_chunk_hdr->type) {
/* ADDIP 4.1 A9) If the peer responds to an ASCONF with /* ADDIP 4.1 A9) If the peer responds to an ASCONF with
* an ERROR chunk reporting that it did not recognized * an ERROR chunk reporting that it did not recognized
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ static const sctp_sm_table_entry_t ...@@ -53,7 +53,7 @@ static const sctp_sm_table_entry_t
timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES]; timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net, static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
sctp_cid_t cid, enum sctp_cid cid,
sctp_state_t state); sctp_state_t state);
...@@ -968,7 +968,7 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S ...@@ -968,7 +968,7 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S
}; };
static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net, static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
sctp_cid_t cid, enum sctp_cid cid,
sctp_state_t state) sctp_state_t state)
{ {
if (state > SCTP_STATE_MAX) if (state > SCTP_STATE_MAX)
......
...@@ -6033,7 +6033,8 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, ...@@ -6033,7 +6033,8 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
return -EACCES; return -EACCES;
hmacs = ep->auth_hmacs_list; hmacs = ep->auth_hmacs_list;
data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t); data_len = ntohs(hmacs->param_hdr.length) -
sizeof(struct sctp_paramhdr);
if (len < sizeof(struct sctp_hmacalgo) + data_len) if (len < sizeof(struct sctp_hmacalgo) + data_len)
return -EINVAL; return -EINVAL;
...@@ -6117,7 +6118,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, ...@@ -6117,7 +6118,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
goto num; goto num;
/* See if the user provided enough room for all the data */ /* See if the user provided enough room for all the data */
num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); num_chunks = ntohs(ch->param_hdr.length) - sizeof(struct sctp_paramhdr);
if (len < num_chunks) if (len < num_chunks)
return -EINVAL; return -EINVAL;
...@@ -6165,7 +6166,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, ...@@ -6165,7 +6166,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
if (!ch) if (!ch)
goto num; goto num;
num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); num_chunks = ntohs(ch->param_hdr.length) - sizeof(struct sctp_paramhdr);
if (len < sizeof(struct sctp_authchunks) + num_chunks) if (len < sizeof(struct sctp_authchunks) + num_chunks)
return -EINVAL; return -EINVAL;
......
...@@ -304,7 +304,7 @@ int sctp_send_add_streams(struct sctp_association *asoc, ...@@ -304,7 +304,7 @@ int sctp_send_add_streams(struct sctp_association *asoc,
return retval; return retval;
} }
static sctp_paramhdr_t *sctp_chunk_lookup_strreset_param( static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param(
struct sctp_association *asoc, __u32 resp_seq, struct sctp_association *asoc, __u32 resp_seq,
__be16 type) __be16 type)
{ {
...@@ -749,7 +749,7 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -749,7 +749,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
struct sctp_strreset_resp *resp = param.v; struct sctp_strreset_resp *resp = param.v;
struct sctp_transport *t; struct sctp_transport *t;
__u16 i, nums, flags = 0; __u16 i, nums, flags = 0;
sctp_paramhdr_t *req; struct sctp_paramhdr *req;
__u32 result; __u32 result;
req = sctp_chunk_lookup_strreset_param(asoc, resp->response_seq, 0); req = sctp_chunk_lookup_strreset_param(asoc, resp->response_seq, 0);
......
...@@ -158,7 +158,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( ...@@ -158,7 +158,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
/* Trim the buffer to the right length. */ /* Trim the buffer to the right length. */
skb_trim(skb, sizeof(struct sctp_assoc_change) + skb_trim(skb, sizeof(struct sctp_assoc_change) +
ntohs(chunk->chunk_hdr->length) - ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
} else { } else {
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, gfp); MSG_NOTIFICATION, gfp);
......
...@@ -1090,7 +1090,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, ...@@ -1090,7 +1090,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
if (chunk) { if (chunk) {
needed = ntohs(chunk->chunk_hdr->length); needed = ntohs(chunk->chunk_hdr->length);
needed -= sizeof(sctp_data_chunk_t); needed -= sizeof(struct sctp_data_chunk);
} else } else
needed = SCTP_DEFAULT_MAXWINDOW; needed = SCTP_DEFAULT_MAXWINDOW;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment