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

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

sctp: remove the typedef sctp_sender_hb_info_t



This patch is to remove the typedef sctp_sender_hb_info_t, and
replace with struct sctp_sender_hb_info 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 afa6c454
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -371,12 +371,12 @@ union sctp_params {
 *    chunk is sent and the destination transport address to which this
 *    chunk is sent and the destination transport address to which this
 *    HEARTBEAT is sent (see Section 8.3).
 *    HEARTBEAT is sent (see Section 8.3).
 */
 */
typedef struct sctp_sender_hb_info {
struct sctp_sender_hb_info {
	struct sctp_paramhdr param_hdr;
	struct sctp_paramhdr param_hdr;
	union sctp_addr daddr;
	union sctp_addr daddr;
	unsigned long sent_at;
	unsigned long sent_at;
	__u64 hb_nonce;
	__u64 hb_nonce;
} sctp_sender_hb_info_t;
};


int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
		     gfp_t gfp);
		     gfp_t gfp);
+3 −3
Original line number Original line Diff line number Diff line
@@ -1144,8 +1144,8 @@ struct sctp_chunk *sctp_make_violation_max_retrans(
struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
				       const struct sctp_transport *transport)
				       const struct sctp_transport *transport)
{
{
	struct sctp_sender_hb_info hbinfo;
	struct sctp_chunk *retval;
	struct sctp_chunk *retval;
	sctp_sender_hb_info_t hbinfo;


	retval = sctp_make_control(asoc, SCTP_CID_HEARTBEAT, 0,
	retval = sctp_make_control(asoc, SCTP_CID_HEARTBEAT, 0,
				   sizeof(hbinfo), GFP_ATOMIC);
				   sizeof(hbinfo), GFP_ATOMIC);
@@ -1154,7 +1154,7 @@ struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
		goto nodata;
		goto nodata;


	hbinfo.param_hdr.type = SCTP_PARAM_HEARTBEAT_INFO;
	hbinfo.param_hdr.type = SCTP_PARAM_HEARTBEAT_INFO;
	hbinfo.param_hdr.length = htons(sizeof(sctp_sender_hb_info_t));
	hbinfo.param_hdr.length = htons(sizeof(hbinfo));
	hbinfo.daddr = transport->ipaddr;
	hbinfo.daddr = transport->ipaddr;
	hbinfo.sent_at = jiffies;
	hbinfo.sent_at = jiffies;
	hbinfo.hb_nonce = transport->hb_nonce;
	hbinfo.hb_nonce = transport->hb_nonce;
+2 −2
Original line number Original line Diff line number Diff line
@@ -714,7 +714,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
				  struct sctp_transport *t,
				  struct sctp_transport *t,
				  struct sctp_chunk *chunk)
				  struct sctp_chunk *chunk)
{
{
	sctp_sender_hb_info_t *hbinfo;
	struct sctp_sender_hb_info *hbinfo;
	int was_unconfirmed = 0;
	int was_unconfirmed = 0;


	/* 8.3 Upon the receipt of the HEARTBEAT ACK, the sender of the
	/* 8.3 Upon the receipt of the HEARTBEAT ACK, the sender of the
@@ -768,7 +768,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
	if (t->rto_pending == 0)
	if (t->rto_pending == 0)
		t->rto_pending = 1;
		t->rto_pending = 1;


	hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
	hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data;
	sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));
	sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));


	/* Update the heartbeat timer.  */
	/* Update the heartbeat timer.  */
+5 −7
Original line number Original line Diff line number Diff line
@@ -1155,27 +1155,25 @@ sctp_disposition_t sctp_sf_backbeat_8_3(struct net *net,
					void *arg,
					void *arg,
					sctp_cmd_seq_t *commands)
					sctp_cmd_seq_t *commands)
{
{
	struct sctp_sender_hb_info *hbinfo;
	struct sctp_chunk *chunk = arg;
	struct sctp_chunk *chunk = arg;
	union sctp_addr from_addr;
	struct sctp_transport *link;
	struct sctp_transport *link;
	sctp_sender_hb_info_t *hbinfo;
	unsigned long max_interval;
	unsigned long max_interval;
	union sctp_addr from_addr;


	if (!sctp_vtag_verify(chunk, asoc))
	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 HEARTBEAT-ACK chunk has a valid length.  */
	/* Make sure that the HEARTBEAT-ACK chunk has a valid length.  */
	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) +
	if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) +
					    sizeof(sctp_sender_hb_info_t)))
					    sizeof(*hbinfo)))
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
		return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
						  commands);
						  commands);


	hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
	hbinfo = (struct sctp_sender_hb_info *)chunk->skb->data;
	/* Make sure that the length of the parameter is what we expect */
	/* Make sure that the length of the parameter is what we expect */
	if (ntohs(hbinfo->param_hdr.length) !=
	if (ntohs(hbinfo->param_hdr.length) != sizeof(*hbinfo))
				    sizeof(sctp_sender_hb_info_t)) {
		return SCTP_DISPOSITION_DISCARD;
		return SCTP_DISPOSITION_DISCARD;
	}


	from_addr = hbinfo->daddr;
	from_addr = hbinfo->daddr;
	link = sctp_assoc_lookup_paddr(asoc, &from_addr);
	link = sctp_assoc_lookup_paddr(asoc, &from_addr);