diff options
author | Jan Engelhardt <jengelh@computergmbh.de> | 2008-01-31 07:53:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:12 -0500 |
commit | 7cc3864d39837549c5ccb33c5b85183d6e6986bc (patch) | |
tree | 6eea6059e6e133f82e8998664af789ab50ee7d39 /net | |
parent | dc35dc5a4c8e7752c82643ff2ad442685331ab28 (diff) |
[NETFILTER]: nf_{conntrack,nat}_icmp: constify and annotate
Constify a few data tables use const qualifiers on variables where
possible in the nf_conntrack_icmp* sources.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 10 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_icmp.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 14 |
3 files changed, 15 insertions, 11 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 17217f4f9918..6873fddb3529 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -26,7 +26,8 @@ static int icmp_pkt_to_tuple(const struct sk_buff *skb, | |||
26 | unsigned int dataoff, | 26 | unsigned int dataoff, |
27 | struct nf_conntrack_tuple *tuple) | 27 | struct nf_conntrack_tuple *tuple) |
28 | { | 28 | { |
29 | struct icmphdr _hdr, *hp; | 29 | const struct icmphdr *hp; |
30 | struct icmphdr _hdr; | ||
30 | 31 | ||
31 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 32 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
32 | if (hp == NULL) | 33 | if (hp == NULL) |
@@ -129,8 +130,8 @@ icmp_error_message(struct sk_buff *skb, | |||
129 | unsigned int hooknum) | 130 | unsigned int hooknum) |
130 | { | 131 | { |
131 | struct nf_conntrack_tuple innertuple, origtuple; | 132 | struct nf_conntrack_tuple innertuple, origtuple; |
132 | struct nf_conntrack_l4proto *innerproto; | 133 | const struct nf_conntrack_l4proto *innerproto; |
133 | struct nf_conntrack_tuple_hash *h; | 134 | const struct nf_conntrack_tuple_hash *h; |
134 | 135 | ||
135 | NF_CT_ASSERT(skb->nfct == NULL); | 136 | NF_CT_ASSERT(skb->nfct == NULL); |
136 | 137 | ||
@@ -176,7 +177,8 @@ static int | |||
176 | icmp_error(struct sk_buff *skb, unsigned int dataoff, | 177 | icmp_error(struct sk_buff *skb, unsigned int dataoff, |
177 | enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) | 178 | enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) |
178 | { | 179 | { |
179 | struct icmphdr _ih, *icmph; | 180 | const struct icmphdr *icmph; |
181 | struct icmphdr _ih; | ||
180 | 182 | ||
181 | /* Not enough header? */ | 183 | /* Not enough header? */ |
182 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); | 184 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); |
diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c index a0e44c953cb6..03a02969aa57 100644 --- a/net/ipv4/netfilter/nf_nat_proto_icmp.c +++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c | |||
@@ -57,7 +57,7 @@ icmp_manip_pkt(struct sk_buff *skb, | |||
57 | const struct nf_conntrack_tuple *tuple, | 57 | const struct nf_conntrack_tuple *tuple, |
58 | enum nf_nat_manip_type maniptype) | 58 | enum nf_nat_manip_type maniptype) |
59 | { | 59 | { |
60 | struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); | 60 | const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); |
61 | struct icmphdr *hdr; | 61 | struct icmphdr *hdr; |
62 | unsigned int hdroff = iphdroff + iph->ihl*4; | 62 | unsigned int hdroff = iphdroff + iph->ihl*4; |
63 | 63 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 430db1de31e3..0897d0f4c4a2 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -32,7 +32,8 @@ static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, | |||
32 | unsigned int dataoff, | 32 | unsigned int dataoff, |
33 | struct nf_conntrack_tuple *tuple) | 33 | struct nf_conntrack_tuple *tuple) |
34 | { | 34 | { |
35 | struct icmp6hdr _hdr, *hp; | 35 | const struct icmp6hdr *hp; |
36 | struct icmp6hdr _hdr; | ||
36 | 37 | ||
37 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 38 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
38 | if (hp == NULL) | 39 | if (hp == NULL) |
@@ -45,7 +46,7 @@ static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, | |||
45 | } | 46 | } |
46 | 47 | ||
47 | /* Add 1; spaces filled with 0. */ | 48 | /* Add 1; spaces filled with 0. */ |
48 | static u_int8_t invmap[] = { | 49 | static const u_int8_t invmap[] = { |
49 | [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1, | 50 | [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1, |
50 | [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1, | 51 | [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1, |
51 | [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_QUERY + 1, | 52 | [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_QUERY + 1, |
@@ -105,7 +106,7 @@ static int icmpv6_new(struct nf_conn *ct, | |||
105 | const struct sk_buff *skb, | 106 | const struct sk_buff *skb, |
106 | unsigned int dataoff) | 107 | unsigned int dataoff) |
107 | { | 108 | { |
108 | static u_int8_t valid_new[] = { | 109 | static const u_int8_t valid_new[] = { |
109 | [ICMPV6_ECHO_REQUEST - 128] = 1, | 110 | [ICMPV6_ECHO_REQUEST - 128] = 1, |
110 | [ICMPV6_NI_QUERY - 128] = 1 | 111 | [ICMPV6_NI_QUERY - 128] = 1 |
111 | }; | 112 | }; |
@@ -129,8 +130,8 @@ icmpv6_error_message(struct sk_buff *skb, | |||
129 | unsigned int hooknum) | 130 | unsigned int hooknum) |
130 | { | 131 | { |
131 | struct nf_conntrack_tuple intuple, origtuple; | 132 | struct nf_conntrack_tuple intuple, origtuple; |
132 | struct nf_conntrack_tuple_hash *h; | 133 | const struct nf_conntrack_tuple_hash *h; |
133 | struct nf_conntrack_l4proto *inproto; | 134 | const struct nf_conntrack_l4proto *inproto; |
134 | 135 | ||
135 | NF_CT_ASSERT(skb->nfct == NULL); | 136 | NF_CT_ASSERT(skb->nfct == NULL); |
136 | 137 | ||
@@ -176,7 +177,8 @@ static int | |||
176 | icmpv6_error(struct sk_buff *skb, unsigned int dataoff, | 177 | icmpv6_error(struct sk_buff *skb, unsigned int dataoff, |
177 | enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) | 178 | enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) |
178 | { | 179 | { |
179 | struct icmp6hdr _ih, *icmp6h; | 180 | const struct icmp6hdr *icmp6h; |
181 | struct icmp6hdr _ih; | ||
180 | 182 | ||
181 | icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); | 183 | icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); |
182 | if (icmp6h == NULL) { | 184 | if (icmp6h == NULL) { |