aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@gmx.de>2007-07-08 01:16:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:17:01 -0400
commita47362a226456d8db8207e618324a2278d05d3a7 (patch)
tree9431e971844582fd65a8cdd234cf89d72c6e4c6c /net/ipv6
parente1931b784a8de324abf310fa3b5e3f25d3988233 (diff)
[NETFILTER]: add some consts, remove some casts
Make a number of variables const and/or remove unneeded casts. Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/ip6t_HL.c2
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c27
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c2
-rw-r--r--net/ipv6/netfilter/ip6t_ah.c3
-rw-r--r--net/ipv6/netfilter/ip6t_frag.c3
-rw-r--r--net/ipv6/netfilter/ip6t_hbh.c9
-rw-r--r--net/ipv6/netfilter/ip6t_mh.c3
-rw-r--r--net/ipv6/netfilter/ip6t_rt.c10
8 files changed, 38 insertions, 21 deletions
diff --git a/net/ipv6/netfilter/ip6t_HL.c b/net/ipv6/netfilter/ip6t_HL.c
index 82966c09fd64..20047ff5492f 100644
--- a/net/ipv6/netfilter/ip6t_HL.c
+++ b/net/ipv6/netfilter/ip6t_HL.c
@@ -64,7 +64,7 @@ static bool ip6t_hl_checkentry(const char *tablename,
64 void *targinfo, 64 void *targinfo,
65 unsigned int hook_mask) 65 unsigned int hook_mask)
66{ 66{
67 struct ip6t_HL_info *info = targinfo; 67 const struct ip6t_HL_info *info = targinfo;
68 68
69 if (info->mode > IP6T_HL_MAXMODE) { 69 if (info->mode > IP6T_HL_MAXMODE) {
70 printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n", 70 printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n",
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index aa4b9a14a11c..996168d2ca25 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -48,7 +48,8 @@ static void dump_packet(const struct nf_loginfo *info,
48{ 48{
49 u_int8_t currenthdr; 49 u_int8_t currenthdr;
50 int fragment; 50 int fragment;
51 struct ipv6hdr _ip6h, *ih; 51 struct ipv6hdr _ip6h;
52 const struct ipv6hdr *ih;
52 unsigned int ptr; 53 unsigned int ptr;
53 unsigned int hdrlen = 0; 54 unsigned int hdrlen = 0;
54 unsigned int logflags; 55 unsigned int logflags;
@@ -78,7 +79,8 @@ static void dump_packet(const struct nf_loginfo *info,
78 ptr = ip6hoff + sizeof(struct ipv6hdr); 79 ptr = ip6hoff + sizeof(struct ipv6hdr);
79 currenthdr = ih->nexthdr; 80 currenthdr = ih->nexthdr;
80 while (currenthdr != NEXTHDR_NONE && ip6t_ext_hdr(currenthdr)) { 81 while (currenthdr != NEXTHDR_NONE && ip6t_ext_hdr(currenthdr)) {
81 struct ipv6_opt_hdr _hdr, *hp; 82 struct ipv6_opt_hdr _hdr;
83 const struct ipv6_opt_hdr *hp;
82 84
83 hp = skb_header_pointer(skb, ptr, sizeof(_hdr), &_hdr); 85 hp = skb_header_pointer(skb, ptr, sizeof(_hdr), &_hdr);
84 if (hp == NULL) { 86 if (hp == NULL) {
@@ -92,7 +94,8 @@ static void dump_packet(const struct nf_loginfo *info,
92 94
93 switch (currenthdr) { 95 switch (currenthdr) {
94 case IPPROTO_FRAGMENT: { 96 case IPPROTO_FRAGMENT: {
95 struct frag_hdr _fhdr, *fh; 97 struct frag_hdr _fhdr;
98 const struct frag_hdr *fh;
96 99
97 printk("FRAG:"); 100 printk("FRAG:");
98 fh = skb_header_pointer(skb, ptr, sizeof(_fhdr), 101 fh = skb_header_pointer(skb, ptr, sizeof(_fhdr),
@@ -131,7 +134,8 @@ static void dump_packet(const struct nf_loginfo *info,
131 /* Max Length */ 134 /* Max Length */
132 case IPPROTO_AH: 135 case IPPROTO_AH:
133 if (logflags & IP6T_LOG_IPOPT) { 136 if (logflags & IP6T_LOG_IPOPT) {
134 struct ip_auth_hdr _ahdr, *ah; 137 struct ip_auth_hdr _ahdr;
138 const struct ip_auth_hdr *ah;
135 139
136 /* Max length: 3 "AH " */ 140 /* Max length: 3 "AH " */
137 printk("AH "); 141 printk("AH ");
@@ -162,7 +166,8 @@ static void dump_packet(const struct nf_loginfo *info,
162 break; 166 break;
163 case IPPROTO_ESP: 167 case IPPROTO_ESP:
164 if (logflags & IP6T_LOG_IPOPT) { 168 if (logflags & IP6T_LOG_IPOPT) {
165 struct ip_esp_hdr _esph, *eh; 169 struct ip_esp_hdr _esph;
170 const struct ip_esp_hdr *eh;
166 171
167 /* Max length: 4 "ESP " */ 172 /* Max length: 4 "ESP " */
168 printk("ESP "); 173 printk("ESP ");
@@ -202,7 +207,8 @@ static void dump_packet(const struct nf_loginfo *info,
202 207
203 switch (currenthdr) { 208 switch (currenthdr) {
204 case IPPROTO_TCP: { 209 case IPPROTO_TCP: {
205 struct tcphdr _tcph, *th; 210 struct tcphdr _tcph;
211 const struct tcphdr *th;
206 212
207 /* Max length: 10 "PROTO=TCP " */ 213 /* Max length: 10 "PROTO=TCP " */
208 printk("PROTO=TCP "); 214 printk("PROTO=TCP ");
@@ -250,7 +256,8 @@ static void dump_packet(const struct nf_loginfo *info,
250 256
251 if ((logflags & IP6T_LOG_TCPOPT) 257 if ((logflags & IP6T_LOG_TCPOPT)
252 && th->doff * 4 > sizeof(struct tcphdr)) { 258 && th->doff * 4 > sizeof(struct tcphdr)) {
253 u_int8_t _opt[60 - sizeof(struct tcphdr)], *op; 259 u_int8_t _opt[60 - sizeof(struct tcphdr)];
260 const u_int8_t *op;
254 unsigned int i; 261 unsigned int i;
255 unsigned int optsize = th->doff * 4 262 unsigned int optsize = th->doff * 4
256 - sizeof(struct tcphdr); 263 - sizeof(struct tcphdr);
@@ -273,7 +280,8 @@ static void dump_packet(const struct nf_loginfo *info,
273 } 280 }
274 case IPPROTO_UDP: 281 case IPPROTO_UDP:
275 case IPPROTO_UDPLITE: { 282 case IPPROTO_UDPLITE: {
276 struct udphdr _udph, *uh; 283 struct udphdr _udph;
284 const struct udphdr *uh;
277 285
278 if (currenthdr == IPPROTO_UDP) 286 if (currenthdr == IPPROTO_UDP)
279 /* Max length: 10 "PROTO=UDP " */ 287 /* Max length: 10 "PROTO=UDP " */
@@ -298,7 +306,8 @@ static void dump_packet(const struct nf_loginfo *info,
298 break; 306 break;
299 } 307 }
300 case IPPROTO_ICMPV6: { 308 case IPPROTO_ICMPV6: {
301 struct icmp6hdr _icmp6h, *ic; 309 struct icmp6hdr _icmp6h;
310 const struct icmp6hdr *ic;
302 311
303 /* Max length: 13 "PROTO=ICMPv6 " */ 312 /* Max length: 13 "PROTO=ICMPv6 " */
304 printk("PROTO=ICMPv6 "); 313 printk("PROTO=ICMPv6 ");
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 8639a0599bf5..4df07f0adf1d 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -159,7 +159,7 @@ static void send_reset(struct sk_buff *oldskb)
159 tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr, 159 tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
160 &ipv6_hdr(nskb)->daddr, 160 &ipv6_hdr(nskb)->daddr,
161 sizeof(struct tcphdr), IPPROTO_TCP, 161 sizeof(struct tcphdr), IPPROTO_TCP,
162 csum_partial((char *)tcph, 162 csum_partial(tcph,
163 sizeof(struct tcphdr), 0)); 163 sizeof(struct tcphdr), 0));
164 164
165 nf_ct_attach(nskb, oldskb); 165 nf_ct_attach(nskb, oldskb);
diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c
index 8fc00bdfc38b..b4b1d282761c 100644
--- a/net/ipv6/netfilter/ip6t_ah.c
+++ b/net/ipv6/netfilter/ip6t_ah.c
@@ -51,7 +51,8 @@ match(const struct sk_buff *skb,
51 unsigned int protoff, 51 unsigned int protoff,
52 bool *hotdrop) 52 bool *hotdrop)
53{ 53{
54 struct ip_auth_hdr *ah, _ah; 54 struct ip_auth_hdr _ah;
55 const struct ip_auth_hdr *ah;
55 const struct ip6t_ah *ahinfo = matchinfo; 56 const struct ip6t_ah *ahinfo = matchinfo;
56 unsigned int ptr; 57 unsigned int ptr;
57 unsigned int hdrlen = 0; 58 unsigned int hdrlen = 0;
diff --git a/net/ipv6/netfilter/ip6t_frag.c b/net/ipv6/netfilter/ip6t_frag.c
index f0aed898e8b7..e0e416bb284a 100644
--- a/net/ipv6/netfilter/ip6t_frag.c
+++ b/net/ipv6/netfilter/ip6t_frag.c
@@ -50,7 +50,8 @@ match(const struct sk_buff *skb,
50 unsigned int protoff, 50 unsigned int protoff,
51 bool *hotdrop) 51 bool *hotdrop)
52{ 52{
53 struct frag_hdr _frag, *fh; 53 struct frag_hdr _frag;
54 const struct frag_hdr *fh;
54 const struct ip6t_frag *fraginfo = matchinfo; 55 const struct ip6t_frag *fraginfo = matchinfo;
55 unsigned int ptr; 56 unsigned int ptr;
56 int err; 57 int err;
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c
index 6fdd79785f32..bbd2615ad2e1 100644
--- a/net/ipv6/netfilter/ip6t_hbh.c
+++ b/net/ipv6/netfilter/ip6t_hbh.c
@@ -57,14 +57,17 @@ match(const struct sk_buff *skb,
57 unsigned int protoff, 57 unsigned int protoff,
58 bool *hotdrop) 58 bool *hotdrop)
59{ 59{
60 struct ipv6_opt_hdr _optsh, *oh; 60 struct ipv6_opt_hdr _optsh;
61 const struct ipv6_opt_hdr *oh;
61 const struct ip6t_opts *optinfo = matchinfo; 62 const struct ip6t_opts *optinfo = matchinfo;
62 unsigned int temp; 63 unsigned int temp;
63 unsigned int ptr; 64 unsigned int ptr;
64 unsigned int hdrlen = 0; 65 unsigned int hdrlen = 0;
65 bool ret = false; 66 bool ret = false;
66 u8 _opttype, *tp = NULL; 67 u8 _opttype;
67 u8 _optlen, *lp = NULL; 68 u8 _optlen;
69 const u_int8_t *tp = NULL;
70 const u_int8_t *lp = NULL;
68 unsigned int optlen; 71 unsigned int optlen;
69 int err; 72 int err;
70 73
diff --git a/net/ipv6/netfilter/ip6t_mh.c b/net/ipv6/netfilter/ip6t_mh.c
index a3008b41d24b..e94fdd82f284 100644
--- a/net/ipv6/netfilter/ip6t_mh.c
+++ b/net/ipv6/netfilter/ip6t_mh.c
@@ -47,7 +47,8 @@ match(const struct sk_buff *skb,
47 unsigned int protoff, 47 unsigned int protoff,
48 bool *hotdrop) 48 bool *hotdrop)
49{ 49{
50 struct ip6_mh _mh, *mh; 50 struct ip6_mh _mh;
51 const struct ip6_mh *mh;
51 const struct ip6t_mh *mhinfo = matchinfo; 52 const struct ip6t_mh *mhinfo = matchinfo;
52 53
53 /* Must not be a fragment. */ 54 /* Must not be a fragment. */
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c
index e991ed4a692e..bc5ff4b1af39 100644
--- a/net/ipv6/netfilter/ip6t_rt.c
+++ b/net/ipv6/netfilter/ip6t_rt.c
@@ -52,13 +52,15 @@ match(const struct sk_buff *skb,
52 unsigned int protoff, 52 unsigned int protoff,
53 bool *hotdrop) 53 bool *hotdrop)
54{ 54{
55 struct ipv6_rt_hdr _route, *rh; 55 struct ipv6_rt_hdr _route;
56 const struct ipv6_rt_hdr *rh;
56 const struct ip6t_rt *rtinfo = matchinfo; 57 const struct ip6t_rt *rtinfo = matchinfo;
57 unsigned int temp; 58 unsigned int temp;
58 unsigned int ptr; 59 unsigned int ptr;
59 unsigned int hdrlen = 0; 60 unsigned int hdrlen = 0;
60 bool ret = false; 61 bool ret = false;
61 struct in6_addr *ap, _addr; 62 struct in6_addr _addr;
63 const struct in6_addr *ap;
62 int err; 64 int err;
63 65
64 err = ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL); 66 err = ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL);
@@ -100,9 +102,9 @@ match(const struct sk_buff *skb,
100 !!(rtinfo->invflags & IP6T_RT_INV_LEN)))); 102 !!(rtinfo->invflags & IP6T_RT_INV_LEN))));
101 DEBUGP("res %02X %02X %02X ", 103 DEBUGP("res %02X %02X %02X ",
102 (rtinfo->flags & IP6T_RT_RES), 104 (rtinfo->flags & IP6T_RT_RES),
103 ((struct rt0_hdr *)rh)->reserved, 105 ((const struct rt0_hdr *)rh)->reserved,
104 !((rtinfo->flags & IP6T_RT_RES) && 106 !((rtinfo->flags & IP6T_RT_RES) &&
105 (((struct rt0_hdr *)rh)->reserved))); 107 (((const struct rt0_hdr *)rh)->reserved)));
106 108
107 ret = (rh != NULL) 109 ret = (rh != NULL)
108 && 110 &&