diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-06-29 23:52:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-01 12:08:41 -0400 |
commit | ae146d9b76589d636d11c5e4382bbba2fe8bdb9b (patch) | |
tree | 1c816c31c77c71e85198e7d0cd703fc66bd28b20 | |
parent | 13834451950f557cbbc3129426e72e763f2d63ee (diff) |
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: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/sctp.h | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_getport.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c | 6 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_sctp.c | 15 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_sctp.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_nat_proto_sctp.c | 2 | ||||
-rw-r--r-- | net/netfilter/xt_sctp.c | 16 |
7 files changed, 24 insertions, 25 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 7a4804c4a593..85540ec4b561 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -57,12 +57,12 @@ | |||
57 | #include <uapi/linux/sctp.h> | 57 | #include <uapi/linux/sctp.h> |
58 | 58 | ||
59 | /* Section 3.1. SCTP Common Header Format */ | 59 | /* Section 3.1. SCTP Common Header Format */ |
60 | typedef struct sctphdr { | 60 | struct sctphdr { |
61 | __be16 source; | 61 | __be16 source; |
62 | __be16 dest; | 62 | __be16 dest; |
63 | __be32 vtag; | 63 | __be32 vtag; |
64 | __le32 checksum; | 64 | __le32 checksum; |
65 | } sctp_sctphdr_t; | 65 | }; |
66 | 66 | ||
67 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) | 67 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) |
68 | { | 68 | { |
diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c index 42c3e3ba1b94..3f09cdb42562 100644 --- a/net/netfilter/ipset/ip_set_getport.c +++ b/net/netfilter/ipset/ip_set_getport.c | |||
@@ -38,8 +38,8 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff, | |||
38 | break; | 38 | break; |
39 | } | 39 | } |
40 | case IPPROTO_SCTP: { | 40 | case IPPROTO_SCTP: { |
41 | sctp_sctphdr_t _sh; | 41 | struct sctphdr _sh; |
42 | const sctp_sctphdr_t *sh; | 42 | const struct sctphdr *sh; |
43 | 43 | ||
44 | sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh); | 44 | sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh); |
45 | if (!sh) | 45 | if (!sh) |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index ad99c1ceea6f..6f39af9fd6df 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1038,8 +1038,8 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, | |||
1038 | static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) | 1038 | static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) |
1039 | { | 1039 | { |
1040 | sctp_chunkhdr_t *sch, schunk; | 1040 | sctp_chunkhdr_t *sch, schunk; |
1041 | sch = skb_header_pointer(skb, nh_len + sizeof(sctp_sctphdr_t), | 1041 | sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr), |
1042 | sizeof(schunk), &schunk); | 1042 | sizeof(schunk), &schunk); |
1043 | if (sch == NULL) | 1043 | if (sch == NULL) |
1044 | return 0; | 1044 | return 0; |
1045 | if (sch->type == SCTP_CID_ABORT) | 1045 | if (sch->type == SCTP_CID_ABORT) |
@@ -1072,7 +1072,7 @@ static inline bool is_new_conn(const struct sk_buff *skb, | |||
1072 | case IPPROTO_SCTP: { | 1072 | case IPPROTO_SCTP: { |
1073 | sctp_chunkhdr_t *sch, schunk; | 1073 | sctp_chunkhdr_t *sch, schunk; |
1074 | 1074 | ||
1075 | sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t), | 1075 | sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr), |
1076 | sizeof(schunk), &schunk); | 1076 | sizeof(schunk), &schunk); |
1077 | if (sch == NULL) | 1077 | if (sch == NULL) |
1078 | return false; | 1078 | return false; |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 56f8e4b204ff..6b38cadab822 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -16,15 +16,14 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, | |||
16 | { | 16 | { |
17 | struct ip_vs_service *svc; | 17 | struct ip_vs_service *svc; |
18 | sctp_chunkhdr_t _schunkh, *sch; | 18 | sctp_chunkhdr_t _schunkh, *sch; |
19 | sctp_sctphdr_t *sh, _sctph; | 19 | struct sctphdr *sh, _sctph; |
20 | __be16 _ports[2], *ports = NULL; | 20 | __be16 _ports[2], *ports = NULL; |
21 | 21 | ||
22 | if (likely(!ip_vs_iph_icmp(iph))) { | 22 | if (likely(!ip_vs_iph_icmp(iph))) { |
23 | sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph); | 23 | sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph); |
24 | if (sh) { | 24 | if (sh) { |
25 | sch = skb_header_pointer( | 25 | sch = skb_header_pointer(skb, iph->len + sizeof(_sctph), |
26 | skb, iph->len + sizeof(sctp_sctphdr_t), | 26 | sizeof(_schunkh), &_schunkh); |
27 | sizeof(_schunkh), &_schunkh); | ||
28 | if (sch && (sch->type == SCTP_CID_INIT || | 27 | if (sch && (sch->type == SCTP_CID_INIT || |
29 | sysctl_sloppy_sctp(ipvs))) | 28 | sysctl_sloppy_sctp(ipvs))) |
30 | ports = &sh->source; | 29 | ports = &sh->source; |
@@ -77,7 +76,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, | |||
77 | return 1; | 76 | return 1; |
78 | } | 77 | } |
79 | 78 | ||
80 | static void sctp_nat_csum(struct sk_buff *skb, sctp_sctphdr_t *sctph, | 79 | static void sctp_nat_csum(struct sk_buff *skb, struct sctphdr *sctph, |
81 | unsigned int sctphoff) | 80 | unsigned int sctphoff) |
82 | { | 81 | { |
83 | sctph->checksum = sctp_compute_cksum(skb, sctphoff); | 82 | sctph->checksum = sctp_compute_cksum(skb, sctphoff); |
@@ -88,7 +87,7 @@ static int | |||
88 | sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, | 87 | sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, |
89 | struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) | 88 | struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) |
90 | { | 89 | { |
91 | sctp_sctphdr_t *sctph; | 90 | struct sctphdr *sctph; |
92 | unsigned int sctphoff = iph->len; | 91 | unsigned int sctphoff = iph->len; |
93 | bool payload_csum = false; | 92 | bool payload_csum = false; |
94 | 93 | ||
@@ -135,7 +134,7 @@ static int | |||
135 | sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, | 134 | sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, |
136 | struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) | 135 | struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) |
137 | { | 136 | { |
138 | sctp_sctphdr_t *sctph; | 137 | struct sctphdr *sctph; |
139 | unsigned int sctphoff = iph->len; | 138 | unsigned int sctphoff = iph->len; |
140 | bool payload_csum = false; | 139 | bool payload_csum = false; |
141 | 140 | ||
@@ -389,7 +388,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | |||
389 | ihl = ip_hdrlen(skb); | 388 | ihl = ip_hdrlen(skb); |
390 | #endif | 389 | #endif |
391 | 390 | ||
392 | cofs = ihl + sizeof(sctp_sctphdr_t); | 391 | cofs = ihl + sizeof(struct sctphdr); |
393 | sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch); | 392 | sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch); |
394 | if (sch == NULL) | 393 | if (sch == NULL) |
395 | return; | 394 | return; |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 1c5b14a6cab3..db87af41c342 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -190,7 +190,7 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ | 192 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ |
193 | for ((offset) = (dataoff) + sizeof(sctp_sctphdr_t), (count) = 0; \ | 193 | for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \ |
194 | (offset) < (skb)->len && \ | 194 | (offset) < (skb)->len && \ |
195 | ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ | 195 | ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ |
196 | (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++) | 196 | (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++) |
diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c index 804e8a0ab36e..c57ee3240b1d 100644 --- a/net/netfilter/nf_nat_proto_sctp.c +++ b/net/netfilter/nf_nat_proto_sctp.c | |||
@@ -32,7 +32,7 @@ sctp_manip_pkt(struct sk_buff *skb, | |||
32 | const struct nf_conntrack_tuple *tuple, | 32 | const struct nf_conntrack_tuple *tuple, |
33 | enum nf_nat_manip_type maniptype) | 33 | enum nf_nat_manip_type maniptype) |
34 | { | 34 | { |
35 | sctp_sctphdr_t *hdr; | 35 | struct sctphdr *hdr; |
36 | int hdrsize = 8; | 36 | int hdrsize = 8; |
37 | 37 | ||
38 | /* This could be an inner header returned in imcp packet; in such | 38 | /* This could be an inner header returned in imcp packet; in such |
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c index 4dedb96d1a06..0f20ea4f511e 100644 --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c | |||
@@ -118,8 +118,8 @@ static bool | |||
118 | sctp_mt(const struct sk_buff *skb, struct xt_action_param *par) | 118 | sctp_mt(const struct sk_buff *skb, struct xt_action_param *par) |
119 | { | 119 | { |
120 | const struct xt_sctp_info *info = par->matchinfo; | 120 | const struct xt_sctp_info *info = par->matchinfo; |
121 | const sctp_sctphdr_t *sh; | 121 | const struct sctphdr *sh; |
122 | sctp_sctphdr_t _sh; | 122 | struct sctphdr _sh; |
123 | 123 | ||
124 | if (par->fragoff != 0) { | 124 | if (par->fragoff != 0) { |
125 | pr_debug("Dropping non-first fragment.. FIXME\n"); | 125 | pr_debug("Dropping non-first fragment.. FIXME\n"); |
@@ -136,13 +136,13 @@ sctp_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
136 | 136 | ||
137 | return SCCHECK(ntohs(sh->source) >= info->spts[0] | 137 | return SCCHECK(ntohs(sh->source) >= info->spts[0] |
138 | && ntohs(sh->source) <= info->spts[1], | 138 | && ntohs(sh->source) <= info->spts[1], |
139 | XT_SCTP_SRC_PORTS, info->flags, info->invflags) | 139 | XT_SCTP_SRC_PORTS, info->flags, info->invflags) && |
140 | && SCCHECK(ntohs(sh->dest) >= info->dpts[0] | 140 | SCCHECK(ntohs(sh->dest) >= info->dpts[0] |
141 | && ntohs(sh->dest) <= info->dpts[1], | 141 | && ntohs(sh->dest) <= info->dpts[1], |
142 | XT_SCTP_DEST_PORTS, info->flags, info->invflags) | 142 | XT_SCTP_DEST_PORTS, info->flags, info->invflags) && |
143 | && SCCHECK(match_packet(skb, par->thoff + sizeof(sctp_sctphdr_t), | 143 | SCCHECK(match_packet(skb, par->thoff + sizeof(_sh), |
144 | info, &par->hotdrop), | 144 | info, &par->hotdrop), |
145 | XT_SCTP_CHUNK_TYPES, info->flags, info->invflags); | 145 | XT_SCTP_CHUNK_TYPES, info->flags, info->invflags); |
146 | } | 146 | } |
147 | 147 | ||
148 | static int sctp_mt_check(const struct xt_mtchk_param *par) | 148 | static int sctp_mt_check(const struct xt_mtchk_param *par) |