Commit d5fdd6babcfc2b0e6a8da1acf492a69fb54b4c47
Committed by
David S. Miller
1 parent
0cf08dcb78
Exists in
master
and in
39 other branches
ipv6: Use correct data types for ICMPv6 type and code
Change all the code that deals directly with ICMPv6 type and code values to use u8 instead of a signed int as that's the actual data type. Signed-off-by: Brian Haley <brian.haley@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 20 changed files with 38 additions and 38 deletions Side-by-side Diff
- include/linux/icmpv6.h
- include/net/protocol.h
- include/net/rawv6.h
- include/net/xfrm.h
- net/dccp/ipv6.c
- net/ipv6/ah6.c
- net/ipv6/esp6.c
- net/ipv6/icmp.c
- net/ipv6/ip6_tunnel.c
- net/ipv6/ipcomp6.c
- net/ipv6/mip6.c
- net/ipv6/raw.c
- net/ipv6/route.c
- net/ipv6/tcp_ipv6.c
- net/ipv6/tunnel6.c
- net/ipv6/udp.c
- net/ipv6/udp_impl.h
- net/ipv6/udplite.c
- net/ipv6/xfrm6_tunnel.c
- net/sctp/ipv6.c
include/linux/icmpv6.h
... | ... | @@ -175,16 +175,16 @@ |
175 | 175 | |
176 | 176 | |
177 | 177 | extern void icmpv6_send(struct sk_buff *skb, |
178 | - int type, int code, | |
178 | + u8 type, u8 code, | |
179 | 179 | __u32 info, |
180 | 180 | struct net_device *dev); |
181 | 181 | |
182 | 182 | extern int icmpv6_init(void); |
183 | -extern int icmpv6_err_convert(int type, int code, | |
183 | +extern int icmpv6_err_convert(u8 type, u8 code, | |
184 | 184 | int *err); |
185 | 185 | extern void icmpv6_cleanup(void); |
186 | 186 | extern void icmpv6_param_prob(struct sk_buff *skb, |
187 | - int code, int pos); | |
187 | + u8 code, int pos); | |
188 | 188 | |
189 | 189 | struct flowi; |
190 | 190 | struct in6_addr; |
include/net/protocol.h
include/net/rawv6.h
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | #include <net/protocol.h> |
7 | 7 | |
8 | 8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, |
9 | - int type, int code, int inner_offset, __be32); | |
9 | + u8 type, u8 code, int inner_offset, __be32); | |
10 | 10 | int raw6_local_deliver(struct sk_buff *, int); |
11 | 11 | |
12 | 12 | extern int rawv6_rcv(struct sock *sk, |
include/net/xfrm.h
... | ... | @@ -1274,7 +1274,7 @@ |
1274 | 1274 | struct xfrm6_tunnel { |
1275 | 1275 | int (*handler)(struct sk_buff *skb); |
1276 | 1276 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, |
1277 | - int type, int code, int offset, __be32 info); | |
1277 | + u8 type, u8 code, int offset, __be32 info); | |
1278 | 1278 | struct xfrm6_tunnel *next; |
1279 | 1279 | int priority; |
1280 | 1280 | }; |
net/dccp/ipv6.c
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 | } |
86 | 86 | |
87 | 87 | static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
88 | - int type, int code, int offset, __be32 info) | |
88 | + u8 type, u8 code, int offset, __be32 info) | |
89 | 89 | { |
90 | 90 | struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; |
91 | 91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); |
net/ipv6/ah6.c
... | ... | @@ -405,7 +405,7 @@ |
405 | 405 | } |
406 | 406 | |
407 | 407 | static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
408 | - int type, int code, int offset, __be32 info) | |
408 | + u8 type, u8 code, int offset, __be32 info) | |
409 | 409 | { |
410 | 410 | struct net *net = dev_net(skb->dev); |
411 | 411 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
net/ipv6/esp6.c
... | ... | @@ -354,7 +354,7 @@ |
354 | 354 | } |
355 | 355 | |
356 | 356 | static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
357 | - int type, int code, int offset, __be32 info) | |
357 | + u8 type, u8 code, int offset, __be32 info) | |
358 | 358 | { |
359 | 359 | struct net *net = dev_net(skb->dev); |
360 | 360 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
net/ipv6/icmp.c
... | ... | @@ -117,7 +117,7 @@ |
117 | 117 | /* |
118 | 118 | * Slightly more convenient version of icmpv6_send. |
119 | 119 | */ |
120 | -void icmpv6_param_prob(struct sk_buff *skb, int code, int pos) | |
120 | +void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos) | |
121 | 121 | { |
122 | 122 | icmpv6_send(skb, ICMPV6_PARAMPROB, code, pos, skb->dev); |
123 | 123 | kfree_skb(skb); |
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | /* |
162 | 162 | * Check the ICMP output rate limit |
163 | 163 | */ |
164 | -static inline int icmpv6_xrlim_allow(struct sock *sk, int type, | |
164 | +static inline int icmpv6_xrlim_allow(struct sock *sk, u8 type, | |
165 | 165 | struct flowi *fl) |
166 | 166 | { |
167 | 167 | struct dst_entry *dst; |
... | ... | @@ -305,7 +305,7 @@ |
305 | 305 | /* |
306 | 306 | * Send an ICMP message in response to a packet in error |
307 | 307 | */ |
308 | -void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |
308 | +void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, | |
309 | 309 | struct net_device *dev) |
310 | 310 | { |
311 | 311 | struct net *net = dev_net(skb->dev); |
... | ... | @@ -590,7 +590,7 @@ |
590 | 590 | icmpv6_xmit_unlock(sk); |
591 | 591 | } |
592 | 592 | |
593 | -static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info) | |
593 | +static void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) | |
594 | 594 | { |
595 | 595 | struct inet6_protocol *ipprot; |
596 | 596 | int inner_offset; |
... | ... | @@ -643,7 +643,7 @@ |
643 | 643 | struct in6_addr *saddr, *daddr; |
644 | 644 | struct ipv6hdr *orig_hdr; |
645 | 645 | struct icmp6hdr *hdr; |
646 | - int type; | |
646 | + u8 type; | |
647 | 647 | |
648 | 648 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
649 | 649 | struct sec_path *sp = skb_sec_path(skb); |
... | ... | @@ -914,7 +914,7 @@ |
914 | 914 | }, |
915 | 915 | }; |
916 | 916 | |
917 | -int icmpv6_err_convert(int type, int code, int *err) | |
917 | +int icmpv6_err_convert(u8 type, u8 code, int *err) | |
918 | 918 | { |
919 | 919 | int fatal = 0; |
920 | 920 |
net/ipv6/ip6_tunnel.c
... | ... | @@ -394,13 +394,13 @@ |
394 | 394 | |
395 | 395 | static int |
396 | 396 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, |
397 | - int *type, int *code, int *msg, __u32 *info, int offset) | |
397 | + u8 *type, u8 *code, int *msg, __u32 *info, int offset) | |
398 | 398 | { |
399 | 399 | struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data; |
400 | 400 | struct ip6_tnl *t; |
401 | 401 | int rel_msg = 0; |
402 | - int rel_type = ICMPV6_DEST_UNREACH; | |
403 | - int rel_code = ICMPV6_ADDR_UNREACH; | |
402 | + u8 rel_type = ICMPV6_DEST_UNREACH; | |
403 | + u8 rel_code = ICMPV6_ADDR_UNREACH; | |
404 | 404 | __u32 rel_info = 0; |
405 | 405 | __u16 len; |
406 | 406 | int err = -ENOENT; |
407 | 407 | |
... | ... | @@ -488,11 +488,11 @@ |
488 | 488 | |
489 | 489 | static int |
490 | 490 | ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
491 | - int type, int code, int offset, __be32 info) | |
491 | + u8 type, u8 code, int offset, __be32 info) | |
492 | 492 | { |
493 | 493 | int rel_msg = 0; |
494 | - int rel_type = type; | |
495 | - int rel_code = code; | |
494 | + u8 rel_type = type; | |
495 | + u8 rel_code = code; | |
496 | 496 | __u32 rel_info = ntohl(info); |
497 | 497 | int err; |
498 | 498 | struct sk_buff *skb2; |
499 | 499 | |
... | ... | @@ -586,11 +586,11 @@ |
586 | 586 | |
587 | 587 | static int |
588 | 588 | ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
589 | - int type, int code, int offset, __be32 info) | |
589 | + u8 type, u8 code, int offset, __be32 info) | |
590 | 590 | { |
591 | 591 | int rel_msg = 0; |
592 | - int rel_type = type; | |
593 | - int rel_code = code; | |
592 | + u8 rel_type = type; | |
593 | + u8 rel_code = code; | |
594 | 594 | __u32 rel_info = ntohl(info); |
595 | 595 | int err; |
596 | 596 |
net/ipv6/ipcomp6.c
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | #include <linux/mutex.h> |
52 | 52 | |
53 | 53 | static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
54 | - int type, int code, int offset, __be32 info) | |
54 | + u8 type, u8 code, int offset, __be32 info) | |
55 | 55 | { |
56 | 56 | __be32 spi; |
57 | 57 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
net/ipv6/mip6.c
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | return data + padlen; |
55 | 55 | } |
56 | 56 | |
57 | -static inline void mip6_param_prob(struct sk_buff *skb, int code, int pos) | |
57 | +static inline void mip6_param_prob(struct sk_buff *skb, u8 code, int pos) | |
58 | 58 | { |
59 | 59 | icmpv6_send(skb, ICMPV6_PARAMPROB, code, pos, skb->dev); |
60 | 60 | } |
net/ipv6/raw.c
... | ... | @@ -310,7 +310,7 @@ |
310 | 310 | |
311 | 311 | static void rawv6_err(struct sock *sk, struct sk_buff *skb, |
312 | 312 | struct inet6_skb_parm *opt, |
313 | - int type, int code, int offset, __be32 info) | |
313 | + u8 type, u8 code, int offset, __be32 info) | |
314 | 314 | { |
315 | 315 | struct inet_sock *inet = inet_sk(sk); |
316 | 316 | struct ipv6_pinfo *np = inet6_sk(sk); |
... | ... | @@ -343,7 +343,7 @@ |
343 | 343 | } |
344 | 344 | |
345 | 345 | void raw6_icmp_error(struct sk_buff *skb, int nexthdr, |
346 | - int type, int code, int inner_offset, __be32 info) | |
346 | + u8 type, u8 code, int inner_offset, __be32 info) | |
347 | 347 | { |
348 | 348 | struct sock *sk; |
349 | 349 | int hash; |
net/ipv6/route.c
... | ... | @@ -1865,7 +1865,7 @@ |
1865 | 1865 | * Drop the packet on the floor |
1866 | 1866 | */ |
1867 | 1867 | |
1868 | -static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) | |
1868 | +static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) | |
1869 | 1869 | { |
1870 | 1870 | int type; |
1871 | 1871 | struct dst_entry *dst = skb_dst(skb); |
net/ipv6/tcp_ipv6.c
... | ... | @@ -317,7 +317,7 @@ |
317 | 317 | } |
318 | 318 | |
319 | 319 | static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
320 | - int type, int code, int offset, __be32 info) | |
320 | + u8 type, u8 code, int offset, __be32 info) | |
321 | 321 | { |
322 | 322 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; |
323 | 323 | const struct tcphdr *th = (struct tcphdr *)(skb->data+offset); |
net/ipv6/tunnel6.c
net/ipv6/udp.c
... | ... | @@ -312,7 +312,7 @@ |
312 | 312 | } |
313 | 313 | |
314 | 314 | void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
315 | - int type, int code, int offset, __be32 info, | |
315 | + u8 type, u8 code, int offset, __be32 info, | |
316 | 316 | struct udp_table *udptable) |
317 | 317 | { |
318 | 318 | struct ipv6_pinfo *np; |
... | ... | @@ -346,8 +346,8 @@ |
346 | 346 | } |
347 | 347 | |
348 | 348 | static __inline__ void udpv6_err(struct sk_buff *skb, |
349 | - struct inet6_skb_parm *opt, int type, | |
350 | - int code, int offset, __be32 info ) | |
349 | + struct inet6_skb_parm *opt, u8 type, | |
350 | + u8 code, int offset, __be32 info ) | |
351 | 351 | { |
352 | 352 | __udp6_lib_err(skb, opt, type, code, offset, info, &udp_table); |
353 | 353 | } |
net/ipv6/udp_impl.h
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | |
10 | 10 | extern int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int ); |
11 | 11 | extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, |
12 | - int , int , int , __be32 , struct udp_table *); | |
12 | + u8 , u8 , int , __be32 , struct udp_table *); | |
13 | 13 | |
14 | 14 | extern int udp_v6_get_port(struct sock *sk, unsigned short snum); |
15 | 15 |
net/ipv6/udplite.c
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | |
21 | 21 | static void udplitev6_err(struct sk_buff *skb, |
22 | 22 | struct inet6_skb_parm *opt, |
23 | - int type, int code, int offset, __be32 info) | |
23 | + u8 type, u8 code, int offset, __be32 info) | |
24 | 24 | { |
25 | 25 | __udp6_lib_err(skb, opt, type, code, offset, info, &udplite_table); |
26 | 26 | } |
net/ipv6/xfrm6_tunnel.c
... | ... | @@ -262,7 +262,7 @@ |
262 | 262 | } |
263 | 263 | |
264 | 264 | static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
265 | - int type, int code, int offset, __be32 info) | |
265 | + u8 type, u8 code, int offset, __be32 info) | |
266 | 266 | { |
267 | 267 | /* xfrm6_tunnel native err handling */ |
268 | 268 | switch (type) { |
net/sctp/ipv6.c
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | |
134 | 134 | /* ICMP error handler. */ |
135 | 135 | SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
136 | - int type, int code, int offset, __be32 info) | |
136 | + u8 type, u8 code, int offset, __be32 info) | |
137 | 137 | { |
138 | 138 | struct inet6_dev *idev; |
139 | 139 | struct sock *sk; |