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

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

sctp: remove the typedef sctp_chunkhdr_t



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

It is also to fix some indents and use sizeof(variable) instead
of sizeof(type)., especially in sctp_new.

Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae146d9b
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
}

/* Section 3.2.  Chunk Field Descriptions. */
typedef struct sctp_chunkhdr {
struct sctp_chunkhdr {
	__u8 type;
	__u8 flags;
	__be16 length;
} sctp_chunkhdr_t;
};


/* Section 3.2.  Chunk Type Values.
@@ -236,7 +236,7 @@ typedef struct sctp_datahdr {
} sctp_datahdr_t;

typedef struct sctp_data_chunk {
        sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_datahdr_t  data_hdr;
} sctp_data_chunk_t;

@@ -267,7 +267,7 @@ typedef struct sctp_inithdr {
} sctp_inithdr_t;

typedef struct sctp_init_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_inithdr_t init_hdr;
} sctp_init_chunk_t;

@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr {
} sctp_sackhdr_t;

typedef struct sctp_sack_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_sackhdr_t sack_hdr;
} sctp_sack_chunk_t;

@@ -403,7 +403,7 @@ typedef struct sctp_heartbeathdr {
} sctp_heartbeathdr_t;

typedef struct sctp_heartbeat_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_heartbeathdr_t hb_hdr;
} sctp_heartbeat_chunk_t;

@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk {
 * chunk descriptor.
 */
typedef struct sctp_abort_chunk {
        sctp_chunkhdr_t uh;
	struct sctp_chunkhdr uh;
} sctp_abort_chunk_t;


@@ -425,7 +425,7 @@ typedef struct sctp_shutdownhdr {
} sctp_shutdownhdr_t;

struct sctp_shutdown_chunk_t {
        sctp_chunkhdr_t    chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_shutdownhdr_t shutdown_hdr;
};

@@ -438,7 +438,7 @@ typedef struct sctp_errhdr {
} sctp_errhdr_t;

typedef struct sctp_operr_chunk {
        sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_errhdr_t err_hdr;
} sctp_operr_chunk_t;

@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr {
} sctp_ecnehdr_t;

typedef struct sctp_ecne_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_ecnehdr_t ence_hdr;
} sctp_ecne_chunk_t;

@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr {
} sctp_cwrhdr_t;

typedef struct sctp_cwr_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_cwrhdr_t cwr_hdr;
} sctp_cwr_chunk_t;

@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr {
} sctp_addiphdr_t;

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

@@ -709,7 +709,7 @@ typedef struct sctp_authhdr {
} sctp_authhdr_t;

typedef struct sctp_auth_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	sctp_authhdr_t auth_hdr;
} sctp_auth_chunk_t;

@@ -719,7 +719,7 @@ struct sctp_infox {
};

struct sctp_reconf_chunk {
	sctp_chunkhdr_t chunk_hdr;
	struct sctp_chunkhdr chunk_hdr;
	__u8 params[0];
};

+1 −1
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))

#define _sctp_walk_errors(err, chunk_hdr, end)\
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) &&\
     ntohs(err->length) >= sizeof(sctp_errhdr_t); \
     err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
+2 −2
Original line number Diff line number Diff line
@@ -1037,7 +1037,7 @@ 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)
{
	sctp_chunkhdr_t *sch, schunk;
	struct sctp_chunkhdr *sch, schunk;
	sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr),
				 sizeof(schunk), &schunk);
	if (sch == NULL)
@@ -1070,7 +1070,7 @@ static inline bool is_new_conn(const struct sk_buff *skb,
		return th->syn;
	}
	case IPPROTO_SCTP: {
		sctp_chunkhdr_t *sch, schunk;
		struct sctp_chunkhdr *sch, schunk;

		sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr),
					 sizeof(schunk), &schunk);
+3 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
		   struct ip_vs_iphdr *iph)
{
	struct ip_vs_service *svc;
	sctp_chunkhdr_t _schunkh, *sch;
	struct sctp_chunkhdr _schunkh, *sch;
	struct sctphdr *sh, _sctph;
	__be16 _ports[2], *ports = NULL;

@@ -377,7 +377,7 @@ static inline void
set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
		int direction, const struct sk_buff *skb)
{
	sctp_chunkhdr_t _sctpch, *sch;
	struct sctp_chunkhdr _sctpch, *sch;
	unsigned char chunk_type;
	int event, next_state;
	int ihl, cofs;
@@ -409,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
	    (sch->type == SCTP_CID_COOKIE_ACK)) {
		int clen = ntohs(sch->length);

		if (clen >= sizeof(sctp_chunkhdr_t)) {
		if (clen >= sizeof(_sctpch)) {
			sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4),
						 sizeof(_sctpch), &_sctpch);
			if (sch && sch->type == SCTP_CID_ABORT)
+13 −16
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct,
			   unsigned long *map)
{
	u_int32_t offset, count;
	sctp_chunkhdr_t _sch, *sch;
	struct sctp_chunkhdr _sch, *sch;
	int flag;

	flag = 0;
@@ -397,7 +397,7 @@ static int sctp_packet(struct nf_conn *ct,
		    sch->type == SCTP_CID_INIT_ACK) {
			sctp_inithdr_t _inithdr, *ih;

			ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t),
			ih = skb_header_pointer(skb, offset + sizeof(_sch),
						sizeof(_inithdr), &_inithdr);
			if (ih == NULL)
				goto out_unlock;
@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb,

		/* Copy the vtag into the state info */
		if (sch->type == SCTP_CID_INIT) {
			if (sh->vtag == 0) {
			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);
				if (ih == NULL)
			if (!ih)
				return false;

			pr_debug("Setting vtag %x for new conn\n",
				 ih->init_tag);

				ct->proto.sctp.vtag[IP_CT_DIR_REPLY] =
								ih->init_tag;
			} else {
				/* Sec 8.5.1 (A) */
				return false;
			}
			ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ih->init_tag;
		} else if (sch->type == SCTP_CID_HEARTBEAT) {
			pr_debug("Setting vtag %x for secondary conntrack\n",
				 sh->vtag);
Loading