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

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

sctp: remove the typedef sctp_sctphdr_t



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

It is also to fix some indents and 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 13834451
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,12 +57,12 @@
#include <uapi/linux/sctp.h>

/* Section 3.1.  SCTP Common Header Format */
typedef struct sctphdr {
struct sctphdr {
	__be16 source;
	__be16 dest;
	__be32 vtag;
	__le32 checksum;
} sctp_sctphdr_t;
};

static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
{
+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
		break;
	}
	case IPPROTO_SCTP: {
		sctp_sctphdr_t _sh;
		const sctp_sctphdr_t *sh;
		struct sctphdr _sh;
		const struct sctphdr *sh;

		sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh);
		if (!sh)
+3 −3
Original line number Diff line number Diff line
@@ -1038,7 +1038,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;
	sch = skb_header_pointer(skb, nh_len + sizeof(sctp_sctphdr_t),
	sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr),
				 sizeof(schunk), &schunk);
	if (sch == NULL)
		return 0;
@@ -1072,7 +1072,7 @@ static inline bool is_new_conn(const struct sk_buff *skb,
	case IPPROTO_SCTP: {
		sctp_chunkhdr_t *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);
		if (sch == NULL)
			return false;
+7 −8
Original line number Diff line number Diff line
@@ -16,14 +16,13 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
{
	struct ip_vs_service *svc;
	sctp_chunkhdr_t _schunkh, *sch;
	sctp_sctphdr_t *sh, _sctph;
	struct sctphdr *sh, _sctph;
	__be16 _ports[2], *ports = NULL;

	if (likely(!ip_vs_iph_icmp(iph))) {
		sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
		if (sh) {
			sch = skb_header_pointer(
				skb, iph->len + sizeof(sctp_sctphdr_t),
			sch = skb_header_pointer(skb, iph->len + sizeof(_sctph),
						 sizeof(_schunkh), &_schunkh);
			if (sch && (sch->type == SCTP_CID_INIT ||
				    sysctl_sloppy_sctp(ipvs)))
@@ -77,7 +76,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
	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)
{
	sctph->checksum = sctp_compute_cksum(skb, sctphoff);
@@ -88,7 +87,7 @@ static int
sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
		  struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
{
	sctp_sctphdr_t *sctph;
	struct sctphdr *sctph;
	unsigned int sctphoff = iph->len;
	bool payload_csum = false;

@@ -135,7 +134,7 @@ static int
sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
		  struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
{
	sctp_sctphdr_t *sctph;
	struct sctphdr *sctph;
	unsigned int sctphoff = iph->len;
	bool payload_csum = false;

@@ -389,7 +388,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
	ihl = ip_hdrlen(skb);
#endif

	cofs = ihl + sizeof(sctp_sctphdr_t);
	cofs = ihl + sizeof(struct sctphdr);
	sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch);
	if (sch == NULL)
		return;
+1 −1
Original line number Diff line number Diff line
@@ -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)	\
for ((offset) = (dataoff) + sizeof(sctp_sctphdr_t), (count) = 0;	\
for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0;	\
	(offset) < (skb)->len &&					\
	((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch)));	\
	(offset) += (ntohs((sch)->length) + 3) & ~3, (count)++)
Loading