sctp: remove the typedef sctp_sctphdr_t
authorXin Long <lucien.xin@gmail.com>
Fri, 30 Jun 2017 03:52:12 +0000 (11:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Jul 2017 16:08:41 +0000 (09:08 -0700)
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: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sctp.h
net/netfilter/ipset/ip_set_getport.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/ipvs/ip_vs_proto_sctp.c
net/netfilter/nf_conntrack_proto_sctp.c
net/netfilter/nf_nat_proto_sctp.c
net/netfilter/xt_sctp.c

index 7a4804c4a59362f519e0e6429496c1307320f125..85540ec4b561db17acf54ce61e06967ee9f61d05 100644 (file)
 #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)
 {
index 42c3e3ba1b9460eb3680f843424458e4513b8cef..3f09cdb4256266b3eab30f4672853ee81e438ed3 100644 (file)
@@ -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)
index ad99c1ceea6f42bf3e52500a4452f7f74e730be5..6f39af9fd6df442f80e84ffa1107e86ebcf13112 100644 (file)
@@ -1038,8 +1038,8 @@ 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),
-                       sizeof(schunk), &schunk);
+       sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr),
+                                sizeof(schunk), &schunk);
        if (sch == NULL)
                return 0;
        if (sch->type == SCTP_CID_ABORT)
@@ -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;
index 56f8e4b204ffcc4840a1042097a0f7d0f004df18..6b38cadab822b4cf7a4fe2782502eb4a10981897 100644 (file)
@@ -16,15 +16,14 @@ 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),
-                               sizeof(_schunkh), &_schunkh);
+                       sch = skb_header_pointer(skb, iph->len + sizeof(_sctph),
+                                                sizeof(_schunkh), &_schunkh);
                        if (sch && (sch->type == SCTP_CID_INIT ||
                                    sysctl_sloppy_sctp(ipvs)))
                                ports = &sh->source;
@@ -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;
index 1c5b14a6cab369591bd13e22b284a0737ad75c2e..db87af41c342a74ce151088df1be4a4a0ea024a8 100644 (file)
@@ -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)++)
index 804e8a0ab36ef56b120ea89be1994b39eca5bc36..c57ee3240b1d5e848077c61f37c72a40ed0d1afd 100644 (file)
@@ -32,7 +32,7 @@ sctp_manip_pkt(struct sk_buff *skb,
               const struct nf_conntrack_tuple *tuple,
               enum nf_nat_manip_type maniptype)
 {
-       sctp_sctphdr_t *hdr;
+       struct sctphdr *hdr;
        int hdrsize = 8;
 
        /* This could be an inner header returned in imcp packet; in such
index 4dedb96d1a067de6c9766017642e16f9b148d616..0f20ea4f511eba7d6b1eaf6907457943753c8502 100644 (file)
@@ -118,8 +118,8 @@ static bool
 sctp_mt(const struct sk_buff *skb, struct xt_action_param *par)
 {
        const struct xt_sctp_info *info = par->matchinfo;
-       const sctp_sctphdr_t *sh;
-       sctp_sctphdr_t _sh;
+       const struct sctphdr *sh;
+       struct sctphdr _sh;
 
        if (par->fragoff != 0) {
                pr_debug("Dropping non-first fragment.. FIXME\n");
@@ -136,13 +136,13 @@ sctp_mt(const struct sk_buff *skb, struct xt_action_param *par)
 
        return  SCCHECK(ntohs(sh->source) >= info->spts[0]
                        && ntohs(sh->source) <= info->spts[1],
-                       XT_SCTP_SRC_PORTS, info->flags, info->invflags)
-               && SCCHECK(ntohs(sh->dest) >= info->dpts[0]
+                       XT_SCTP_SRC_PORTS, info->flags, info->invflags) &&
+               SCCHECK(ntohs(sh->dest) >= info->dpts[0]
                        && ntohs(sh->dest) <= info->dpts[1],
-                       XT_SCTP_DEST_PORTS, info->flags, info->invflags)
-               && SCCHECK(match_packet(skb, par->thoff + sizeof(sctp_sctphdr_t),
-                                       info, &par->hotdrop),
-                          XT_SCTP_CHUNK_TYPES, info->flags, info->invflags);
+                       XT_SCTP_DEST_PORTS, info->flags, info->invflags) &&
+               SCCHECK(match_packet(skb, par->thoff + sizeof(_sh),
+                                    info, &par->hotdrop),
+                       XT_SCTP_CHUNK_TYPES, info->flags, info->invflags);
 }
 
 static int sctp_mt_check(const struct xt_mtchk_param *par)