Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65205cc4 authored by Xin Long's avatar Xin Long Committed by David S. Miller
Browse files

sctp: remove the typedef sctp_addiphdr_t



This patch is to remove the typedef sctp_addiphdr_t, and
replace with struct sctp_addiphdr in the places where it's
using this typedef.

It is also to use sizeof(variable) instead of sizeof(type).

Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b32f234
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -634,14 +634,14 @@ struct sctp_addip_param {
	__be32 crr_id;
	__be32 crr_id;
};
};


typedef struct sctp_addiphdr {
struct sctp_addiphdr {
	__be32	serial;
	__be32	serial;
	__u8	params[0];
	__u8	params[0];
} sctp_addiphdr_t;
};


typedef struct sctp_addip_chunk {
typedef struct sctp_addip_chunk {
	struct sctp_chunkhdr chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_addiphdr_t addip_hdr;
	struct sctp_addiphdr addip_hdr;
} sctp_addip_chunk_t;
} sctp_addip_chunk_t;


/* AUTH
/* AUTH
+7 −7
Original line number Original line Diff line number Diff line
@@ -2752,7 +2752,7 @@ static struct sctp_chunk *sctp_make_asconf(struct sctp_association *asoc,
					   union sctp_addr *addr,
					   union sctp_addr *addr,
					   int vparam_len)
					   int vparam_len)
{
{
	sctp_addiphdr_t asconf;
	struct sctp_addiphdr asconf;
	struct sctp_chunk *retval;
	struct sctp_chunk *retval;
	int length = sizeof(asconf) + vparam_len;
	int length = sizeof(asconf) + vparam_len;
	union sctp_addr_param addrparam;
	union sctp_addr_param addrparam;
@@ -2945,7 +2945,7 @@ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *asoc,
static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *asoc,
					       __u32 serial, int vparam_len)
					       __u32 serial, int vparam_len)
{
{
	sctp_addiphdr_t		asconf;
	struct sctp_addiphdr	asconf;
	struct sctp_chunk	*retval;
	struct sctp_chunk	*retval;
	int			length = sizeof(asconf) + vparam_len;
	int			length = sizeof(asconf) + vparam_len;


@@ -3210,7 +3210,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
	sctp_addip_chunk_t *addip = (sctp_addip_chunk_t *) asconf->chunk_hdr;
	sctp_addip_chunk_t *addip = (sctp_addip_chunk_t *) asconf->chunk_hdr;
	bool all_param_pass = true;
	bool all_param_pass = true;
	union sctp_params param;
	union sctp_params param;
	sctp_addiphdr_t		*hdr;
	struct sctp_addiphdr	*hdr;
	union sctp_addr_param	*addr_param;
	union sctp_addr_param	*addr_param;
	struct sctp_chunk	*asconf_ack;
	struct sctp_chunk	*asconf_ack;
	__be16	err_code;
	__be16	err_code;
@@ -3220,11 +3220,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,


	chunk_len = ntohs(asconf->chunk_hdr->length) -
	chunk_len = ntohs(asconf->chunk_hdr->length) -
		    sizeof(struct sctp_chunkhdr);
		    sizeof(struct sctp_chunkhdr);
	hdr = (sctp_addiphdr_t *)asconf->skb->data;
	hdr = (struct sctp_addiphdr *)asconf->skb->data;
	serial = ntohl(hdr->serial);
	serial = ntohl(hdr->serial);


	/* Skip the addiphdr and store a pointer to address parameter.  */
	/* Skip the addiphdr and store a pointer to address parameter.  */
	length = sizeof(sctp_addiphdr_t);
	length = sizeof(*hdr);
	addr_param = (union sctp_addr_param *)(asconf->skb->data + length);
	addr_param = (union sctp_addr_param *)(asconf->skb->data + length);
	chunk_len -= length;
	chunk_len -= length;


@@ -3370,7 +3370,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
	/* Skip the addiphdr from the asconf_ack chunk and store a pointer to
	/* Skip the addiphdr from the asconf_ack chunk and store a pointer to
	 * the first asconf_ack parameter.
	 * the first asconf_ack parameter.
	 */
	 */
	length = sizeof(sctp_addiphdr_t);
	length = sizeof(struct sctp_addiphdr);
	asconf_ack_param = (struct sctp_addip_param *)(asconf_ack->skb->data +
	asconf_ack_param = (struct sctp_addip_param *)(asconf_ack->skb->data +
						       length);
						       length);
	asconf_ack_len -= length;
	asconf_ack_len -= length;
@@ -3435,7 +3435,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
	 * failures are indicated, then all request(s) are considered
	 * failures are indicated, then all request(s) are considered
	 * successful.
	 * successful.
	 */
	 */
	if (asconf_ack->skb->len == sizeof(sctp_addiphdr_t))
	if (asconf_ack->skb->len == sizeof(struct sctp_addiphdr))
		all_param_pass = 1;
		all_param_pass = 1;


	/* Process the TLVs contained in the last sent ASCONF chunk. */
	/* Process the TLVs contained in the last sent ASCONF chunk. */
+5 −5
Original line number Original line Diff line number Diff line
@@ -3613,7 +3613,7 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net,
	struct sctp_chunk	*chunk = arg;
	struct sctp_chunk	*chunk = arg;
	struct sctp_chunk	*asconf_ack = NULL;
	struct sctp_chunk	*asconf_ack = NULL;
	struct sctp_paramhdr	*err_param = NULL;
	struct sctp_paramhdr	*err_param = NULL;
	sctp_addiphdr_t		*hdr;
	struct sctp_addiphdr	*hdr;
	__u32			serial;
	__u32			serial;


	if (!sctp_vtag_verify(chunk, asoc)) {
	if (!sctp_vtag_verify(chunk, asoc)) {
@@ -3636,7 +3636,7 @@ sctp_disposition_t sctp_sf_do_asconf(struct net *net,
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
						  commands);
						  commands);


	hdr = (sctp_addiphdr_t *)chunk->skb->data;
	hdr = (struct sctp_addiphdr *)chunk->skb->data;
	serial = ntohl(hdr->serial);
	serial = ntohl(hdr->serial);


	/* Verify the ASCONF chunk before processing it. */
	/* Verify the ASCONF chunk before processing it. */
@@ -3730,7 +3730,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
	struct sctp_chunk	*last_asconf = asoc->addip_last_asconf;
	struct sctp_chunk	*last_asconf = asoc->addip_last_asconf;
	struct sctp_chunk	*abort;
	struct sctp_chunk	*abort;
	struct sctp_paramhdr	*err_param = NULL;
	struct sctp_paramhdr	*err_param = NULL;
	sctp_addiphdr_t		*addip_hdr;
	struct sctp_addiphdr	*addip_hdr;
	__u32			sent_serial, rcvd_serial;
	__u32			sent_serial, rcvd_serial;


	if (!sctp_vtag_verify(asconf_ack, asoc)) {
	if (!sctp_vtag_verify(asconf_ack, asoc)) {
@@ -3753,7 +3753,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
						  commands);
						  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);
	rcvd_serial = ntohl(addip_hdr->serial);


	/* Verify the ASCONF-ACK chunk before processing it. */
	/* Verify the ASCONF-ACK chunk before processing it. */
@@ -3762,7 +3762,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
			   (void *)err_param, commands);
			   (void *)err_param, commands);


	if (last_asconf) {
	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);
		sent_serial = ntohl(addip_hdr->serial);
	} else {
	} else {
		sent_serial = asoc->addip_serial - 1;
		sent_serial = asoc->addip_serial - 1;