diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-04-22 00:53:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-22 14:04:14 -0400 |
commit | b71d1d426d263b0b6cb5760322efebbfc89d4463 (patch) | |
tree | 226ca7390bd6187ec9139d2ccedd26fd94d8e57a /net | |
parent | 5f8629c526b4f7e529a6d27bbd802c0dc7fcc357 (diff) |
inet: constify ip headers and in6_addr
Add const qualifiers to structs iphdr, ipv6hdr and in6_addr pointers
where possible, to make code intention more obvious.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
55 files changed, 280 insertions, 276 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 59660c909a7c..2f14eafdeeab 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -413,7 +413,7 @@ out: | |||
413 | 413 | ||
414 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 414 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
415 | static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | 415 | static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, |
416 | struct in6_addr *group) | 416 | const struct in6_addr *group) |
417 | { | 417 | { |
418 | struct sk_buff *skb; | 418 | struct sk_buff *skb; |
419 | struct ipv6hdr *ip6h; | 419 | struct ipv6hdr *ip6h; |
@@ -1115,7 +1115,7 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1115 | struct net_bridge_port *port, | 1115 | struct net_bridge_port *port, |
1116 | struct sk_buff *skb) | 1116 | struct sk_buff *skb) |
1117 | { | 1117 | { |
1118 | struct iphdr *iph = ip_hdr(skb); | 1118 | const struct iphdr *iph = ip_hdr(skb); |
1119 | struct igmphdr *ih = igmp_hdr(skb); | 1119 | struct igmphdr *ih = igmp_hdr(skb); |
1120 | struct net_bridge_mdb_entry *mp; | 1120 | struct net_bridge_mdb_entry *mp; |
1121 | struct igmpv3_query *ih3; | 1121 | struct igmpv3_query *ih3; |
@@ -1190,7 +1190,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1190 | struct net_bridge_port *port, | 1190 | struct net_bridge_port *port, |
1191 | struct sk_buff *skb) | 1191 | struct sk_buff *skb) |
1192 | { | 1192 | { |
1193 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 1193 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
1194 | struct mld_msg *mld = (struct mld_msg *) icmp6_hdr(skb); | 1194 | struct mld_msg *mld = (struct mld_msg *) icmp6_hdr(skb); |
1195 | struct net_bridge_mdb_entry *mp; | 1195 | struct net_bridge_mdb_entry *mp; |
1196 | struct mld2_query *mld2q; | 1196 | struct mld2_query *mld2q; |
@@ -1198,7 +1198,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1198 | struct net_bridge_port_group __rcu **pp; | 1198 | struct net_bridge_port_group __rcu **pp; |
1199 | unsigned long max_delay; | 1199 | unsigned long max_delay; |
1200 | unsigned long now = jiffies; | 1200 | unsigned long now = jiffies; |
1201 | struct in6_addr *group = NULL; | 1201 | const struct in6_addr *group = NULL; |
1202 | int err = 0; | 1202 | int err = 0; |
1203 | 1203 | ||
1204 | spin_lock(&br->multicast_lock); | 1204 | spin_lock(&br->multicast_lock); |
@@ -1356,7 +1356,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, | |||
1356 | struct sk_buff *skb) | 1356 | struct sk_buff *skb) |
1357 | { | 1357 | { |
1358 | struct sk_buff *skb2 = skb; | 1358 | struct sk_buff *skb2 = skb; |
1359 | struct iphdr *iph; | 1359 | const struct iphdr *iph; |
1360 | struct igmphdr *ih; | 1360 | struct igmphdr *ih; |
1361 | unsigned len; | 1361 | unsigned len; |
1362 | unsigned offset; | 1362 | unsigned offset; |
@@ -1452,7 +1452,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1452 | struct sk_buff *skb) | 1452 | struct sk_buff *skb) |
1453 | { | 1453 | { |
1454 | struct sk_buff *skb2; | 1454 | struct sk_buff *skb2; |
1455 | struct ipv6hdr *ip6h; | 1455 | const struct ipv6hdr *ip6h; |
1456 | struct icmp6hdr *icmp6h; | 1456 | struct icmp6hdr *icmp6h; |
1457 | u8 nexthdr; | 1457 | u8 nexthdr; |
1458 | unsigned len; | 1458 | unsigned len; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index f3bc322c5891..5614907525e1 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -219,7 +219,7 @@ static inline void nf_bridge_update_protocol(struct sk_buff *skb) | |||
219 | static int br_parse_ip_options(struct sk_buff *skb) | 219 | static int br_parse_ip_options(struct sk_buff *skb) |
220 | { | 220 | { |
221 | struct ip_options *opt; | 221 | struct ip_options *opt; |
222 | struct iphdr *iph; | 222 | const struct iphdr *iph; |
223 | struct net_device *dev = skb->dev; | 223 | struct net_device *dev = skb->dev; |
224 | u32 len; | 224 | u32 len; |
225 | 225 | ||
@@ -554,7 +554,7 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, | |||
554 | const struct net_device *out, | 554 | const struct net_device *out, |
555 | int (*okfn)(struct sk_buff *)) | 555 | int (*okfn)(struct sk_buff *)) |
556 | { | 556 | { |
557 | struct ipv6hdr *hdr; | 557 | const struct ipv6hdr *hdr; |
558 | u32 pkt_len; | 558 | u32 pkt_len; |
559 | 559 | ||
560 | if (skb->len < sizeof(struct ipv6hdr)) | 560 | if (skb->len < sizeof(struct ipv6hdr)) |
diff --git a/net/core/dev.c b/net/core/dev.c index 3871bf69a386..379c993ff421 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2502,8 +2502,8 @@ static inline void ____napi_schedule(struct softnet_data *sd, | |||
2502 | __u32 __skb_get_rxhash(struct sk_buff *skb) | 2502 | __u32 __skb_get_rxhash(struct sk_buff *skb) |
2503 | { | 2503 | { |
2504 | int nhoff, hash = 0, poff; | 2504 | int nhoff, hash = 0, poff; |
2505 | struct ipv6hdr *ip6; | 2505 | const struct ipv6hdr *ip6; |
2506 | struct iphdr *ip; | 2506 | const struct iphdr *ip; |
2507 | u8 ip_proto; | 2507 | u8 ip_proto; |
2508 | u32 addr1, addr2, ihl; | 2508 | u32 addr1, addr2, ihl; |
2509 | union { | 2509 | union { |
@@ -2518,7 +2518,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) | |||
2518 | if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) | 2518 | if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) |
2519 | goto done; | 2519 | goto done; |
2520 | 2520 | ||
2521 | ip = (struct iphdr *) (skb->data + nhoff); | 2521 | ip = (const struct iphdr *) (skb->data + nhoff); |
2522 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) | 2522 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) |
2523 | ip_proto = 0; | 2523 | ip_proto = 0; |
2524 | else | 2524 | else |
@@ -2531,7 +2531,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) | |||
2531 | if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) | 2531 | if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) |
2532 | goto done; | 2532 | goto done; |
2533 | 2533 | ||
2534 | ip6 = (struct ipv6hdr *) (skb->data + nhoff); | 2534 | ip6 = (const struct ipv6hdr *) (skb->data + nhoff); |
2535 | ip_proto = ip6->nexthdr; | 2535 | ip_proto = ip6->nexthdr; |
2536 | addr1 = (__force u32) ip6->saddr.s6_addr32[3]; | 2536 | addr1 = (__force u32) ip6->saddr.s6_addr32[3]; |
2537 | addr2 = (__force u32) ip6->daddr.s6_addr32[3]; | 2537 | addr2 = (__force u32) ip6->daddr.s6_addr32[3]; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 06be2431753e..46d9c3a4de2f 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -539,7 +539,7 @@ int __netpoll_rx(struct sk_buff *skb) | |||
539 | { | 539 | { |
540 | int proto, len, ulen; | 540 | int proto, len, ulen; |
541 | int hits = 0; | 541 | int hits = 0; |
542 | struct iphdr *iph; | 542 | const struct iphdr *iph; |
543 | struct udphdr *uh; | 543 | struct udphdr *uh; |
544 | struct netpoll_info *npinfo = skb->dev->npinfo; | 544 | struct netpoll_info *npinfo = skb->dev->npinfo; |
545 | struct netpoll *np, *tmp; | 545 | struct netpoll *np, *tmp; |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index de1b7e37ad5b..73add2373247 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -54,8 +54,8 @@ static void dccp_v6_hash(struct sock *sk) | |||
54 | 54 | ||
55 | /* add pseudo-header to DCCP checksum stored in skb->csum */ | 55 | /* add pseudo-header to DCCP checksum stored in skb->csum */ |
56 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, | 56 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, |
57 | struct in6_addr *saddr, | 57 | const struct in6_addr *saddr, |
58 | struct in6_addr *daddr) | 58 | const struct in6_addr *daddr) |
59 | { | 59 | { |
60 | return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum); | 60 | return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum); |
61 | } | 61 | } |
@@ -87,7 +87,7 @@ static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb) | |||
87 | static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 87 | static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
88 | u8 type, u8 code, int offset, __be32 info) | 88 | u8 type, u8 code, int offset, __be32 info) |
89 | { | 89 | { |
90 | struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; | 90 | const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; |
91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); | 91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); |
92 | struct dccp_sock *dp; | 92 | struct dccp_sock *dp; |
93 | struct ipv6_pinfo *np; | 93 | struct ipv6_pinfo *np; |
@@ -296,7 +296,7 @@ static void dccp_v6_reqsk_destructor(struct request_sock *req) | |||
296 | 296 | ||
297 | static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | 297 | static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) |
298 | { | 298 | { |
299 | struct ipv6hdr *rxip6h; | 299 | const struct ipv6hdr *rxip6h; |
300 | struct sk_buff *skb; | 300 | struct sk_buff *skb; |
301 | struct flowi6 fl6; | 301 | struct flowi6 fl6; |
302 | struct net *net = dev_net(skb_dst(rxskb)->dev); | 302 | struct net *net = dev_net(skb_dst(rxskb)->dev); |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 807d83c02ef6..cae75ef21fea 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1186,7 +1186,7 @@ EXPORT_SYMBOL(inet_sk_rebuild_header); | |||
1186 | 1186 | ||
1187 | static int inet_gso_send_check(struct sk_buff *skb) | 1187 | static int inet_gso_send_check(struct sk_buff *skb) |
1188 | { | 1188 | { |
1189 | struct iphdr *iph; | 1189 | const struct iphdr *iph; |
1190 | const struct net_protocol *ops; | 1190 | const struct net_protocol *ops; |
1191 | int proto; | 1191 | int proto; |
1192 | int ihl; | 1192 | int ihl; |
@@ -1293,7 +1293,7 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head, | |||
1293 | const struct net_protocol *ops; | 1293 | const struct net_protocol *ops; |
1294 | struct sk_buff **pp = NULL; | 1294 | struct sk_buff **pp = NULL; |
1295 | struct sk_buff *p; | 1295 | struct sk_buff *p; |
1296 | struct iphdr *iph; | 1296 | const struct iphdr *iph; |
1297 | unsigned int hlen; | 1297 | unsigned int hlen; |
1298 | unsigned int off; | 1298 | unsigned int off; |
1299 | unsigned int id; | 1299 | unsigned int id; |
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 4286fd3cc0e2..c1f4154552fc 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -73,7 +73,7 @@ static inline struct scatterlist *ah_req_sg(struct crypto_ahash *ahash, | |||
73 | * into IP header for icv calculation. Options are already checked | 73 | * into IP header for icv calculation. Options are already checked |
74 | * for validity, so paranoia is not required. */ | 74 | * for validity, so paranoia is not required. */ |
75 | 75 | ||
76 | static int ip_clear_mutable_options(struct iphdr *iph, __be32 *daddr) | 76 | static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr) |
77 | { | 77 | { |
78 | unsigned char * optptr = (unsigned char*)(iph+1); | 78 | unsigned char * optptr = (unsigned char*)(iph+1); |
79 | int l = iph->ihl*4 - sizeof(struct iphdr); | 79 | int l = iph->ihl*4 - sizeof(struct iphdr); |
@@ -396,7 +396,7 @@ out: | |||
396 | static void ah4_err(struct sk_buff *skb, u32 info) | 396 | static void ah4_err(struct sk_buff *skb, u32 info) |
397 | { | 397 | { |
398 | struct net *net = dev_net(skb->dev); | 398 | struct net *net = dev_net(skb->dev); |
399 | struct iphdr *iph = (struct iphdr *)skb->data; | 399 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
400 | struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2)); | 400 | struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2)); |
401 | struct xfrm_state *x; | 401 | struct xfrm_state *x; |
402 | 402 | ||
@@ -404,7 +404,8 @@ static void ah4_err(struct sk_buff *skb, u32 info) | |||
404 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) | 404 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) |
405 | return; | 405 | return; |
406 | 406 | ||
407 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET); | 407 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
408 | ah->spi, IPPROTO_AH, AF_INET); | ||
408 | if (!x) | 409 | if (!x) |
409 | return; | 410 | return; |
410 | printk(KERN_DEBUG "pmtu discovery on SA AH/%08x/%08x\n", | 411 | printk(KERN_DEBUG "pmtu discovery on SA AH/%08x/%08x\n", |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 03f994bcf7de..a5b413416da3 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -276,7 +276,7 @@ error: | |||
276 | 276 | ||
277 | static int esp_input_done2(struct sk_buff *skb, int err) | 277 | static int esp_input_done2(struct sk_buff *skb, int err) |
278 | { | 278 | { |
279 | struct iphdr *iph; | 279 | const struct iphdr *iph; |
280 | struct xfrm_state *x = xfrm_input_state(skb); | 280 | struct xfrm_state *x = xfrm_input_state(skb); |
281 | struct esp_data *esp = x->data; | 281 | struct esp_data *esp = x->data; |
282 | struct crypto_aead *aead = esp->aead; | 282 | struct crypto_aead *aead = esp->aead; |
@@ -484,7 +484,7 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | |||
484 | static void esp4_err(struct sk_buff *skb, u32 info) | 484 | static void esp4_err(struct sk_buff *skb, u32 info) |
485 | { | 485 | { |
486 | struct net *net = dev_net(skb->dev); | 486 | struct net *net = dev_net(skb->dev); |
487 | struct iphdr *iph = (struct iphdr *)skb->data; | 487 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
488 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); | 488 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); |
489 | struct xfrm_state *x; | 489 | struct xfrm_state *x; |
490 | 490 | ||
@@ -492,7 +492,8 @@ static void esp4_err(struct sk_buff *skb, u32 info) | |||
492 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) | 492 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) |
493 | return; | 493 | return; |
494 | 494 | ||
495 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET); | 495 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
496 | esph->spi, IPPROTO_ESP, AF_INET); | ||
496 | if (!x) | 497 | if (!x) |
497 | return; | 498 | return; |
498 | NETDEBUG(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%08x\n", | 499 | NETDEBUG(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%08x\n", |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index e5f8a71d3a2a..74e35e5736e2 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -373,7 +373,7 @@ out_unlock: | |||
373 | } | 373 | } |
374 | 374 | ||
375 | static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, | 375 | static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, |
376 | struct iphdr *iph, | 376 | const struct iphdr *iph, |
377 | __be32 saddr, u8 tos, | 377 | __be32 saddr, u8 tos, |
378 | int type, int code, | 378 | int type, int code, |
379 | struct icmp_bxm *param) | 379 | struct icmp_bxm *param) |
@@ -637,7 +637,7 @@ EXPORT_SYMBOL(icmp_send); | |||
637 | 637 | ||
638 | static void icmp_unreach(struct sk_buff *skb) | 638 | static void icmp_unreach(struct sk_buff *skb) |
639 | { | 639 | { |
640 | struct iphdr *iph; | 640 | const struct iphdr *iph; |
641 | struct icmphdr *icmph; | 641 | struct icmphdr *icmph; |
642 | int hash, protocol; | 642 | int hash, protocol; |
643 | const struct net_protocol *ipprot; | 643 | const struct net_protocol *ipprot; |
@@ -656,7 +656,7 @@ static void icmp_unreach(struct sk_buff *skb) | |||
656 | goto out_err; | 656 | goto out_err; |
657 | 657 | ||
658 | icmph = icmp_hdr(skb); | 658 | icmph = icmp_hdr(skb); |
659 | iph = (struct iphdr *)skb->data; | 659 | iph = (const struct iphdr *)skb->data; |
660 | 660 | ||
661 | if (iph->ihl < 5) /* Mangled header, drop. */ | 661 | if (iph->ihl < 5) /* Mangled header, drop. */ |
662 | goto out_err; | 662 | goto out_err; |
@@ -729,7 +729,7 @@ static void icmp_unreach(struct sk_buff *skb) | |||
729 | if (!pskb_may_pull(skb, iph->ihl * 4 + 8)) | 729 | if (!pskb_may_pull(skb, iph->ihl * 4 + 8)) |
730 | goto out; | 730 | goto out; |
731 | 731 | ||
732 | iph = (struct iphdr *)skb->data; | 732 | iph = (const struct iphdr *)skb->data; |
733 | protocol = iph->protocol; | 733 | protocol = iph->protocol; |
734 | 734 | ||
735 | /* | 735 | /* |
@@ -758,7 +758,7 @@ out_err: | |||
758 | 758 | ||
759 | static void icmp_redirect(struct sk_buff *skb) | 759 | static void icmp_redirect(struct sk_buff *skb) |
760 | { | 760 | { |
761 | struct iphdr *iph; | 761 | const struct iphdr *iph; |
762 | 762 | ||
763 | if (skb->len < sizeof(struct iphdr)) | 763 | if (skb->len < sizeof(struct iphdr)) |
764 | goto out_err; | 764 | goto out_err; |
@@ -769,7 +769,7 @@ static void icmp_redirect(struct sk_buff *skb) | |||
769 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) | 769 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) |
770 | goto out; | 770 | goto out; |
771 | 771 | ||
772 | iph = (struct iphdr *)skb->data; | 772 | iph = (const struct iphdr *)skb->data; |
773 | 773 | ||
774 | switch (icmp_hdr(skb)->code & 7) { | 774 | switch (icmp_hdr(skb)->code & 7) { |
775 | case ICMP_REDIR_NET: | 775 | case ICMP_REDIR_NET: |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 2ada17129fce..6ffe94ca5bc9 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -124,7 +124,7 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
124 | 124 | ||
125 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 125 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
126 | if (r->idiag_family == AF_INET6) { | 126 | if (r->idiag_family == AF_INET6) { |
127 | struct ipv6_pinfo *np = inet6_sk(sk); | 127 | const struct ipv6_pinfo *np = inet6_sk(sk); |
128 | 128 | ||
129 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 129 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
130 | &np->rcv_saddr); | 130 | &np->rcv_saddr); |
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c index 47038cb6c138..85a0f75dae64 100644 --- a/net/ipv4/inet_lro.c +++ b/net/ipv4/inet_lro.c | |||
@@ -51,8 +51,8 @@ MODULE_DESCRIPTION("Large Receive Offload (ipv4 / tcp)"); | |||
51 | * Basic tcp checks whether packet is suitable for LRO | 51 | * Basic tcp checks whether packet is suitable for LRO |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static int lro_tcp_ip_check(struct iphdr *iph, struct tcphdr *tcph, | 54 | static int lro_tcp_ip_check(const struct iphdr *iph, const struct tcphdr *tcph, |
55 | int len, struct net_lro_desc *lro_desc) | 55 | int len, const struct net_lro_desc *lro_desc) |
56 | { | 56 | { |
57 | /* check ip header: don't aggregate padded frames */ | 57 | /* check ip header: don't aggregate padded frames */ |
58 | if (ntohs(iph->tot_len) != len) | 58 | if (ntohs(iph->tot_len) != len) |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index da5941f18c3c..24efd353279a 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -462,7 +462,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) | |||
462 | by themself??? | 462 | by themself??? |
463 | */ | 463 | */ |
464 | 464 | ||
465 | struct iphdr *iph = (struct iphdr *)skb->data; | 465 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
466 | __be16 *p = (__be16*)(skb->data+(iph->ihl<<2)); | 466 | __be16 *p = (__be16*)(skb->data+(iph->ihl<<2)); |
467 | int grehlen = (iph->ihl<<2) + 4; | 467 | int grehlen = (iph->ihl<<2) + 4; |
468 | const int type = icmp_hdr(skb)->type; | 468 | const int type = icmp_hdr(skb)->type; |
@@ -534,7 +534,7 @@ out: | |||
534 | rcu_read_unlock(); | 534 | rcu_read_unlock(); |
535 | } | 535 | } |
536 | 536 | ||
537 | static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | 537 | static inline void ipgre_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb) |
538 | { | 538 | { |
539 | if (INET_ECN_is_ce(iph->tos)) { | 539 | if (INET_ECN_is_ce(iph->tos)) { |
540 | if (skb->protocol == htons(ETH_P_IP)) { | 540 | if (skb->protocol == htons(ETH_P_IP)) { |
@@ -546,19 +546,19 @@ static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | |||
546 | } | 546 | } |
547 | 547 | ||
548 | static inline u8 | 548 | static inline u8 |
549 | ipgre_ecn_encapsulate(u8 tos, struct iphdr *old_iph, struct sk_buff *skb) | 549 | ipgre_ecn_encapsulate(u8 tos, const struct iphdr *old_iph, struct sk_buff *skb) |
550 | { | 550 | { |
551 | u8 inner = 0; | 551 | u8 inner = 0; |
552 | if (skb->protocol == htons(ETH_P_IP)) | 552 | if (skb->protocol == htons(ETH_P_IP)) |
553 | inner = old_iph->tos; | 553 | inner = old_iph->tos; |
554 | else if (skb->protocol == htons(ETH_P_IPV6)) | 554 | else if (skb->protocol == htons(ETH_P_IPV6)) |
555 | inner = ipv6_get_dsfield((struct ipv6hdr *)old_iph); | 555 | inner = ipv6_get_dsfield((const struct ipv6hdr *)old_iph); |
556 | return INET_ECN_encapsulate(tos, inner); | 556 | return INET_ECN_encapsulate(tos, inner); |
557 | } | 557 | } |
558 | 558 | ||
559 | static int ipgre_rcv(struct sk_buff *skb) | 559 | static int ipgre_rcv(struct sk_buff *skb) |
560 | { | 560 | { |
561 | struct iphdr *iph; | 561 | const struct iphdr *iph; |
562 | u8 *h; | 562 | u8 *h; |
563 | __be16 flags; | 563 | __be16 flags; |
564 | __sum16 csum = 0; | 564 | __sum16 csum = 0; |
@@ -697,8 +697,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
697 | { | 697 | { |
698 | struct ip_tunnel *tunnel = netdev_priv(dev); | 698 | struct ip_tunnel *tunnel = netdev_priv(dev); |
699 | struct pcpu_tstats *tstats; | 699 | struct pcpu_tstats *tstats; |
700 | struct iphdr *old_iph = ip_hdr(skb); | 700 | const struct iphdr *old_iph = ip_hdr(skb); |
701 | struct iphdr *tiph; | 701 | const struct iphdr *tiph; |
702 | u8 tos; | 702 | u8 tos; |
703 | __be16 df; | 703 | __be16 df; |
704 | struct rtable *rt; /* Route to the other host */ | 704 | struct rtable *rt; /* Route to the other host */ |
@@ -714,7 +714,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
714 | 714 | ||
715 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { | 715 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { |
716 | gre_hlen = 0; | 716 | gre_hlen = 0; |
717 | tiph = (struct iphdr *)skb->data; | 717 | tiph = (const struct iphdr *)skb->data; |
718 | } else { | 718 | } else { |
719 | gre_hlen = tunnel->hlen; | 719 | gre_hlen = tunnel->hlen; |
720 | tiph = &tunnel->parms.iph; | 720 | tiph = &tunnel->parms.iph; |
@@ -735,14 +735,14 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
735 | } | 735 | } |
736 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 736 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
737 | else if (skb->protocol == htons(ETH_P_IPV6)) { | 737 | else if (skb->protocol == htons(ETH_P_IPV6)) { |
738 | struct in6_addr *addr6; | 738 | const struct in6_addr *addr6; |
739 | int addr_type; | 739 | int addr_type; |
740 | struct neighbour *neigh = skb_dst(skb)->neighbour; | 740 | struct neighbour *neigh = skb_dst(skb)->neighbour; |
741 | 741 | ||
742 | if (neigh == NULL) | 742 | if (neigh == NULL) |
743 | goto tx_error; | 743 | goto tx_error; |
744 | 744 | ||
745 | addr6 = (struct in6_addr *)&neigh->primary_key; | 745 | addr6 = (const struct in6_addr *)&neigh->primary_key; |
746 | addr_type = ipv6_addr_type(addr6); | 746 | addr_type = ipv6_addr_type(addr6); |
747 | 747 | ||
748 | if (addr_type == IPV6_ADDR_ANY) { | 748 | if (addr_type == IPV6_ADDR_ANY) { |
@@ -766,7 +766,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
766 | if (skb->protocol == htons(ETH_P_IP)) | 766 | if (skb->protocol == htons(ETH_P_IP)) |
767 | tos = old_iph->tos; | 767 | tos = old_iph->tos; |
768 | else if (skb->protocol == htons(ETH_P_IPV6)) | 768 | else if (skb->protocol == htons(ETH_P_IPV6)) |
769 | tos = ipv6_get_dsfield((struct ipv6hdr *)old_iph); | 769 | tos = ipv6_get_dsfield((const struct ipv6hdr *)old_iph); |
770 | } | 770 | } |
771 | 771 | ||
772 | rt = ip_route_output_gre(dev_net(dev), dst, tiph->saddr, | 772 | rt = ip_route_output_gre(dev_net(dev), dst, tiph->saddr, |
@@ -881,7 +881,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
881 | iph->ttl = old_iph->ttl; | 881 | iph->ttl = old_iph->ttl; |
882 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 882 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
883 | else if (skb->protocol == htons(ETH_P_IPV6)) | 883 | else if (skb->protocol == htons(ETH_P_IPV6)) |
884 | iph->ttl = ((struct ipv6hdr *)old_iph)->hop_limit; | 884 | iph->ttl = ((const struct ipv6hdr *)old_iph)->hop_limit; |
885 | #endif | 885 | #endif |
886 | else | 886 | else |
887 | iph->ttl = ip4_dst_hoplimit(&rt->dst); | 887 | iph->ttl = ip4_dst_hoplimit(&rt->dst); |
@@ -927,7 +927,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
927 | { | 927 | { |
928 | struct net_device *tdev = NULL; | 928 | struct net_device *tdev = NULL; |
929 | struct ip_tunnel *tunnel; | 929 | struct ip_tunnel *tunnel; |
930 | struct iphdr *iph; | 930 | const struct iphdr *iph; |
931 | int hlen = LL_MAX_HEADER; | 931 | int hlen = LL_MAX_HEADER; |
932 | int mtu = ETH_DATA_LEN; | 932 | int mtu = ETH_DATA_LEN; |
933 | int addend = sizeof(struct iphdr) + 4; | 933 | int addend = sizeof(struct iphdr) + 4; |
@@ -1180,7 +1180,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, | |||
1180 | 1180 | ||
1181 | static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) | 1181 | static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) |
1182 | { | 1182 | { |
1183 | struct iphdr *iph = (struct iphdr *) skb_mac_header(skb); | 1183 | const struct iphdr *iph = (const struct iphdr *) skb_mac_header(skb); |
1184 | memcpy(haddr, &iph->saddr, 4); | 1184 | memcpy(haddr, &iph->saddr, 4); |
1185 | return 4; | 1185 | return 4; |
1186 | } | 1186 | } |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index d7b2b0987a3b..c8f48efc5fd3 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -268,7 +268,7 @@ int ip_local_deliver(struct sk_buff *skb) | |||
268 | static inline int ip_rcv_options(struct sk_buff *skb) | 268 | static inline int ip_rcv_options(struct sk_buff *skb) |
269 | { | 269 | { |
270 | struct ip_options *opt; | 270 | struct ip_options *opt; |
271 | struct iphdr *iph; | 271 | const struct iphdr *iph; |
272 | struct net_device *dev = skb->dev; | 272 | struct net_device *dev = skb->dev; |
273 | 273 | ||
274 | /* It looks as overkill, because not all | 274 | /* It looks as overkill, because not all |
@@ -374,7 +374,7 @@ drop: | |||
374 | */ | 374 | */ |
375 | int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) | 375 | int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) |
376 | { | 376 | { |
377 | struct iphdr *iph; | 377 | const struct iphdr *iph; |
378 | u32 len; | 378 | u32 len; |
379 | 379 | ||
380 | /* When the interface is in promisc. mode, drop all the crap | 380 | /* When the interface is in promisc. mode, drop all the crap |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 3948c86e59ca..9640900309bb 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -131,7 +131,7 @@ static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb) | |||
131 | static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) | 131 | static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
132 | { | 132 | { |
133 | struct sockaddr_in sin; | 133 | struct sockaddr_in sin; |
134 | struct iphdr *iph = ip_hdr(skb); | 134 | const struct iphdr *iph = ip_hdr(skb); |
135 | __be16 *ports = (__be16 *)skb_transport_header(skb); | 135 | __be16 *ports = (__be16 *)skb_transport_header(skb); |
136 | 136 | ||
137 | if (skb_transport_offset(skb) + 4 > skb->len) | 137 | if (skb_transport_offset(skb) + 4 > skb->len) |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 629067571f02..c857f6f49b03 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -27,7 +27,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
27 | { | 27 | { |
28 | struct net *net = dev_net(skb->dev); | 28 | struct net *net = dev_net(skb->dev); |
29 | __be32 spi; | 29 | __be32 spi; |
30 | struct iphdr *iph = (struct iphdr *)skb->data; | 30 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
31 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); | 31 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); |
32 | struct xfrm_state *x; | 32 | struct xfrm_state *x; |
33 | 33 | ||
@@ -36,7 +36,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
36 | return; | 36 | return; |
37 | 37 | ||
38 | spi = htonl(ntohs(ipch->cpi)); | 38 | spi = htonl(ntohs(ipch->cpi)); |
39 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, | 39 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
40 | spi, IPPROTO_COMP, AF_INET); | 40 | spi, IPPROTO_COMP, AF_INET); |
41 | if (!x) | 41 | if (!x) |
42 | return; | 42 | return; |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index bfc17c5914e7..ef16377ec73f 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -319,7 +319,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) | |||
319 | 8 bytes of packet payload. It means, that precise relaying of | 319 | 8 bytes of packet payload. It means, that precise relaying of |
320 | ICMP in the real Internet is absolutely infeasible. | 320 | ICMP in the real Internet is absolutely infeasible. |
321 | */ | 321 | */ |
322 | struct iphdr *iph = (struct iphdr *)skb->data; | 322 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
323 | const int type = icmp_hdr(skb)->type; | 323 | const int type = icmp_hdr(skb)->type; |
324 | const int code = icmp_hdr(skb)->code; | 324 | const int code = icmp_hdr(skb)->code; |
325 | struct ip_tunnel *t; | 325 | struct ip_tunnel *t; |
@@ -433,12 +433,12 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
433 | { | 433 | { |
434 | struct ip_tunnel *tunnel = netdev_priv(dev); | 434 | struct ip_tunnel *tunnel = netdev_priv(dev); |
435 | struct pcpu_tstats *tstats; | 435 | struct pcpu_tstats *tstats; |
436 | struct iphdr *tiph = &tunnel->parms.iph; | 436 | const struct iphdr *tiph = &tunnel->parms.iph; |
437 | u8 tos = tunnel->parms.iph.tos; | 437 | u8 tos = tunnel->parms.iph.tos; |
438 | __be16 df = tiph->frag_off; | 438 | __be16 df = tiph->frag_off; |
439 | struct rtable *rt; /* Route to the other host */ | 439 | struct rtable *rt; /* Route to the other host */ |
440 | struct net_device *tdev; /* Device to other host */ | 440 | struct net_device *tdev; /* Device to other host */ |
441 | struct iphdr *old_iph = ip_hdr(skb); | 441 | const struct iphdr *old_iph = ip_hdr(skb); |
442 | struct iphdr *iph; /* Our new IP header */ | 442 | struct iphdr *iph; /* Our new IP header */ |
443 | unsigned int max_headroom; /* The extra header space needed */ | 443 | unsigned int max_headroom; /* The extra header space needed */ |
444 | __be32 dst = tiph->daddr; | 444 | __be32 dst = tiph->daddr; |
@@ -572,7 +572,7 @@ static void ipip_tunnel_bind_dev(struct net_device *dev) | |||
572 | { | 572 | { |
573 | struct net_device *tdev = NULL; | 573 | struct net_device *tdev = NULL; |
574 | struct ip_tunnel *tunnel; | 574 | struct ip_tunnel *tunnel; |
575 | struct iphdr *iph; | 575 | const struct iphdr *iph; |
576 | 576 | ||
577 | tunnel = netdev_priv(dev); | 577 | tunnel = netdev_priv(dev); |
578 | iph = &tunnel->parms.iph; | 578 | iph = &tunnel->parms.iph; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 1f62eaeb6de4..c81b9b661d26 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1549,7 +1549,7 @@ static struct notifier_block ip_mr_notifier = { | |||
1549 | static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) | 1549 | static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) |
1550 | { | 1550 | { |
1551 | struct iphdr *iph; | 1551 | struct iphdr *iph; |
1552 | struct iphdr *old_iph = ip_hdr(skb); | 1552 | const struct iphdr *old_iph = ip_hdr(skb); |
1553 | 1553 | ||
1554 | skb_push(skb, sizeof(struct iphdr)); | 1554 | skb_push(skb, sizeof(struct iphdr)); |
1555 | skb->transport_header = skb->network_header; | 1555 | skb->transport_header = skb->network_header; |
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index 31427fb57aa8..99cfa28b6d38 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c | |||
@@ -153,7 +153,7 @@ void nf_nat_set_seq_adjust(struct nf_conn *ct, enum ip_conntrack_info ctinfo, | |||
153 | } | 153 | } |
154 | EXPORT_SYMBOL_GPL(nf_nat_set_seq_adjust); | 154 | EXPORT_SYMBOL_GPL(nf_nat_set_seq_adjust); |
155 | 155 | ||
156 | static void nf_nat_csum(struct sk_buff *skb, struct iphdr *iph, void *data, | 156 | static void nf_nat_csum(struct sk_buff *skb, const struct iphdr *iph, void *data, |
157 | int datalen, __sum16 *check, int oldlen) | 157 | int datalen, __sum16 *check, int oldlen) |
158 | { | 158 | { |
159 | struct rtable *rt = skb_rtable(skb); | 159 | struct rtable *rt = skb_rtable(skb); |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 2b50cc2da90a..abf14dbcb3b9 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -154,7 +154,7 @@ static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) | |||
154 | * RFC 1122: SHOULD pass TOS value up to the transport layer. | 154 | * RFC 1122: SHOULD pass TOS value up to the transport layer. |
155 | * -> It does. And not only TOS, but all IP header. | 155 | * -> It does. And not only TOS, but all IP header. |
156 | */ | 156 | */ |
157 | static int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash) | 157 | static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash) |
158 | { | 158 | { |
159 | struct sock *sk; | 159 | struct sock *sk; |
160 | struct hlist_head *head; | 160 | struct hlist_head *head; |
@@ -247,7 +247,7 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info) | |||
247 | } | 247 | } |
248 | 248 | ||
249 | if (inet->recverr) { | 249 | if (inet->recverr) { |
250 | struct iphdr *iph = (struct iphdr *)skb->data; | 250 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
251 | u8 *payload = skb->data + (iph->ihl << 2); | 251 | u8 *payload = skb->data + (iph->ihl << 2); |
252 | 252 | ||
253 | if (inet->hdrincl) | 253 | if (inet->hdrincl) |
@@ -265,7 +265,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) | |||
265 | { | 265 | { |
266 | int hash; | 266 | int hash; |
267 | struct sock *raw_sk; | 267 | struct sock *raw_sk; |
268 | struct iphdr *iph; | 268 | const struct iphdr *iph; |
269 | struct net *net; | 269 | struct net *net; |
270 | 270 | ||
271 | hash = protocol & (RAW_HTABLE_SIZE - 1); | 271 | hash = protocol & (RAW_HTABLE_SIZE - 1); |
@@ -273,7 +273,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) | |||
273 | read_lock(&raw_v4_hashinfo.lock); | 273 | read_lock(&raw_v4_hashinfo.lock); |
274 | raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); | 274 | raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); |
275 | if (raw_sk != NULL) { | 275 | if (raw_sk != NULL) { |
276 | iph = (struct iphdr *)skb->data; | 276 | iph = (const struct iphdr *)skb->data; |
277 | net = dev_net(skb->dev); | 277 | net = dev_net(skb->dev); |
278 | 278 | ||
279 | while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, | 279 | while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, |
@@ -281,7 +281,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) | |||
281 | skb->dev->ifindex)) != NULL) { | 281 | skb->dev->ifindex)) != NULL) { |
282 | raw_err(raw_sk, skb, info); | 282 | raw_err(raw_sk, skb, info); |
283 | raw_sk = sk_next(raw_sk); | 283 | raw_sk = sk_next(raw_sk); |
284 | iph = (struct iphdr *)skb->data; | 284 | iph = (const struct iphdr *)skb->data; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | read_unlock(&raw_v4_hashinfo.lock); | 287 | read_unlock(&raw_v4_hashinfo.lock); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index e9aee81de3e3..f4b7f806afd8 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1507,7 +1507,7 @@ static inline unsigned short guess_mtu(unsigned short old_mtu) | |||
1507 | return 68; | 1507 | return 68; |
1508 | } | 1508 | } |
1509 | 1509 | ||
1510 | unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | 1510 | unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, |
1511 | unsigned short new_mtu, | 1511 | unsigned short new_mtu, |
1512 | struct net_device *dev) | 1512 | struct net_device *dev) |
1513 | { | 1513 | { |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f7e6c2c2d2bb..edf18bd74b87 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -279,7 +279,7 @@ EXPORT_SYMBOL(tcp_v4_connect); | |||
279 | /* | 279 | /* |
280 | * This routine does path mtu discovery as defined in RFC1191. | 280 | * This routine does path mtu discovery as defined in RFC1191. |
281 | */ | 281 | */ |
282 | static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu) | 282 | static void do_pmtu_discovery(struct sock *sk, const struct iphdr *iph, u32 mtu) |
283 | { | 283 | { |
284 | struct dst_entry *dst; | 284 | struct dst_entry *dst; |
285 | struct inet_sock *inet = inet_sk(sk); | 285 | struct inet_sock *inet = inet_sk(sk); |
@@ -341,7 +341,7 @@ static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu) | |||
341 | 341 | ||
342 | void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | 342 | void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) |
343 | { | 343 | { |
344 | struct iphdr *iph = (struct iphdr *)icmp_skb->data; | 344 | const struct iphdr *iph = (const struct iphdr *)icmp_skb->data; |
345 | struct tcphdr *th = (struct tcphdr *)(icmp_skb->data + (iph->ihl << 2)); | 345 | struct tcphdr *th = (struct tcphdr *)(icmp_skb->data + (iph->ihl << 2)); |
346 | struct inet_connection_sock *icsk; | 346 | struct inet_connection_sock *icsk; |
347 | struct tcp_sock *tp; | 347 | struct tcp_sock *tp; |
@@ -2527,7 +2527,7 @@ void tcp4_proc_exit(void) | |||
2527 | 2527 | ||
2528 | struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) | 2528 | struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) |
2529 | { | 2529 | { |
2530 | struct iphdr *iph = skb_gro_network_header(skb); | 2530 | const struct iphdr *iph = skb_gro_network_header(skb); |
2531 | 2531 | ||
2532 | switch (skb->ip_summed) { | 2532 | switch (skb->ip_summed) { |
2533 | case CHECKSUM_COMPLETE: | 2533 | case CHECKSUM_COMPLETE: |
@@ -2548,7 +2548,7 @@ struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2548 | 2548 | ||
2549 | int tcp4_gro_complete(struct sk_buff *skb) | 2549 | int tcp4_gro_complete(struct sk_buff *skb) |
2550 | { | 2550 | { |
2551 | struct iphdr *iph = ip_hdr(skb); | 2551 | const struct iphdr *iph = ip_hdr(skb); |
2552 | struct tcphdr *th = tcp_hdr(skb); | 2552 | struct tcphdr *th = tcp_hdr(skb); |
2553 | 2553 | ||
2554 | th->check = ~tcp_v4_check(skb->len - skb_transport_offset(skb), | 2554 | th->check = ~tcp_v4_check(skb->len - skb_transport_offset(skb), |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index a15c8fb653af..bc0dab2593e0 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -578,7 +578,7 @@ found: | |||
578 | void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) | 578 | void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) |
579 | { | 579 | { |
580 | struct inet_sock *inet; | 580 | struct inet_sock *inet; |
581 | struct iphdr *iph = (struct iphdr *)skb->data; | 581 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
582 | struct udphdr *uh = (struct udphdr *)(skb->data+(iph->ihl<<2)); | 582 | struct udphdr *uh = (struct udphdr *)(skb->data+(iph->ihl<<2)); |
583 | const int type = icmp_hdr(skb)->type; | 583 | const int type = icmp_hdr(skb)->type; |
584 | const int code = icmp_hdr(skb)->code; | 584 | const int code = icmp_hdr(skb)->code; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index d20a05e970d8..59b1340fb3bf 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -102,7 +102,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
102 | static void | 102 | static void |
103 | _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | 103 | _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
104 | { | 104 | { |
105 | struct iphdr *iph = ip_hdr(skb); | 105 | const struct iphdr *iph = ip_hdr(skb); |
106 | u8 *xprth = skb_network_header(skb) + iph->ihl * 4; | 106 | u8 *xprth = skb_network_header(skb) + iph->ihl * 4; |
107 | struct flowi4 *fl4 = &fl->u.ip4; | 107 | struct flowi4 *fl4 = &fl->u.ip4; |
108 | 108 | ||
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index 1717c64628d1..ea983ae96ae6 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -55,7 +55,7 @@ xfrm4_init_temprop(struct xfrm_state *x, const struct xfrm_tmpl *tmpl, | |||
55 | 55 | ||
56 | int xfrm4_extract_header(struct sk_buff *skb) | 56 | int xfrm4_extract_header(struct sk_buff *skb) |
57 | { | 57 | { |
58 | struct iphdr *iph = ip_hdr(skb); | 58 | const struct iphdr *iph = ip_hdr(skb); |
59 | 59 | ||
60 | XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph); | 60 | XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph); |
61 | XFRM_MODE_SKB_CB(skb)->id = iph->id; | 61 | XFRM_MODE_SKB_CB(skb)->id = iph->id; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 129d7e1f311c..c663a3b70924 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1283,7 +1283,7 @@ static int ipv6_count_addresses(struct inet6_dev *idev) | |||
1283 | return cnt; | 1283 | return cnt; |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | int ipv6_chk_addr(struct net *net, struct in6_addr *addr, | 1286 | int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, |
1287 | struct net_device *dev, int strict) | 1287 | struct net_device *dev, int strict) |
1288 | { | 1288 | { |
1289 | struct inet6_ifaddr *ifp; | 1289 | struct inet6_ifaddr *ifp; |
@@ -1326,7 +1326,7 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, | |||
1326 | return false; | 1326 | return false; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev) | 1329 | int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev) |
1330 | { | 1330 | { |
1331 | struct inet6_dev *idev; | 1331 | struct inet6_dev *idev; |
1332 | struct inet6_ifaddr *ifa; | 1332 | struct inet6_ifaddr *ifa; |
@@ -1457,7 +1457,7 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) | |||
1457 | 1457 | ||
1458 | /* Join to solicited addr multicast group. */ | 1458 | /* Join to solicited addr multicast group. */ |
1459 | 1459 | ||
1460 | void addrconf_join_solict(struct net_device *dev, struct in6_addr *addr) | 1460 | void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) |
1461 | { | 1461 | { |
1462 | struct in6_addr maddr; | 1462 | struct in6_addr maddr; |
1463 | 1463 | ||
@@ -1468,7 +1468,7 @@ void addrconf_join_solict(struct net_device *dev, struct in6_addr *addr) | |||
1468 | ipv6_dev_mc_inc(dev, &maddr); | 1468 | ipv6_dev_mc_inc(dev, &maddr); |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | void addrconf_leave_solict(struct inet6_dev *idev, struct in6_addr *addr) | 1471 | void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) |
1472 | { | 1472 | { |
1473 | struct in6_addr maddr; | 1473 | struct in6_addr maddr; |
1474 | 1474 | ||
@@ -2113,7 +2113,7 @@ err_exit: | |||
2113 | /* | 2113 | /* |
2114 | * Manual configuration of address on an interface | 2114 | * Manual configuration of address on an interface |
2115 | */ | 2115 | */ |
2116 | static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | 2116 | static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *pfx, |
2117 | unsigned int plen, __u8 ifa_flags, __u32 prefered_lft, | 2117 | unsigned int plen, __u8 ifa_flags, __u32 prefered_lft, |
2118 | __u32 valid_lft) | 2118 | __u32 valid_lft) |
2119 | { | 2119 | { |
@@ -2187,7 +2187,7 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | |||
2187 | return PTR_ERR(ifp); | 2187 | return PTR_ERR(ifp); |
2188 | } | 2188 | } |
2189 | 2189 | ||
2190 | static int inet6_addr_del(struct net *net, int ifindex, struct in6_addr *pfx, | 2190 | static int inet6_addr_del(struct net *net, int ifindex, const struct in6_addr *pfx, |
2191 | unsigned int plen) | 2191 | unsigned int plen) |
2192 | { | 2192 | { |
2193 | struct inet6_ifaddr *ifp; | 2193 | struct inet6_ifaddr *ifp; |
@@ -2350,7 +2350,7 @@ static void init_loopback(struct net_device *dev) | |||
2350 | add_addr(idev, &in6addr_loopback, 128, IFA_HOST); | 2350 | add_addr(idev, &in6addr_loopback, 128, IFA_HOST); |
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr) | 2353 | static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr) |
2354 | { | 2354 | { |
2355 | struct inet6_ifaddr * ifp; | 2355 | struct inet6_ifaddr * ifp; |
2356 | u32 addr_flags = IFA_F_PERMANENT; | 2356 | u32 addr_flags = IFA_F_PERMANENT; |
@@ -3121,7 +3121,7 @@ void if6_proc_exit(void) | |||
3121 | 3121 | ||
3122 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 3122 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
3123 | /* Check if address is a home address configured on any interface. */ | 3123 | /* Check if address is a home address configured on any interface. */ |
3124 | int ipv6_chk_home_addr(struct net *net, struct in6_addr *addr) | 3124 | int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr) |
3125 | { | 3125 | { |
3126 | int ret = 0; | 3126 | int ret = 0; |
3127 | struct inet6_ifaddr *ifp = NULL; | 3127 | struct inet6_ifaddr *ifp = NULL; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index afcc7099f96d..b7919f901fbf 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -740,7 +740,7 @@ static int ipv6_gso_pull_exthdrs(struct sk_buff *skb, int proto) | |||
740 | 740 | ||
741 | static int ipv6_gso_send_check(struct sk_buff *skb) | 741 | static int ipv6_gso_send_check(struct sk_buff *skb) |
742 | { | 742 | { |
743 | struct ipv6hdr *ipv6h; | 743 | const struct ipv6hdr *ipv6h; |
744 | const struct inet6_protocol *ops; | 744 | const struct inet6_protocol *ops; |
745 | int err = -EINVAL; | 745 | int err = -EINVAL; |
746 | 746 | ||
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 0e5e943446f0..674255f5e6b7 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | #include <net/checksum.h> | 45 | #include <net/checksum.h> |
46 | 46 | ||
47 | static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr); | 47 | static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr); |
48 | 48 | ||
49 | /* Big ac list lock for all the sockets */ | 49 | /* Big ac list lock for all the sockets */ |
50 | static DEFINE_RWLOCK(ipv6_sk_ac_lock); | 50 | static DEFINE_RWLOCK(ipv6_sk_ac_lock); |
@@ -54,7 +54,7 @@ static DEFINE_RWLOCK(ipv6_sk_ac_lock); | |||
54 | * socket join an anycast group | 54 | * socket join an anycast group |
55 | */ | 55 | */ |
56 | 56 | ||
57 | int ipv6_sock_ac_join(struct sock *sk, int ifindex, struct in6_addr *addr) | 57 | int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) |
58 | { | 58 | { |
59 | struct ipv6_pinfo *np = inet6_sk(sk); | 59 | struct ipv6_pinfo *np = inet6_sk(sk); |
60 | struct net_device *dev = NULL; | 60 | struct net_device *dev = NULL; |
@@ -145,7 +145,7 @@ error: | |||
145 | /* | 145 | /* |
146 | * socket leave an anycast group | 146 | * socket leave an anycast group |
147 | */ | 147 | */ |
148 | int ipv6_sock_ac_drop(struct sock *sk, int ifindex, struct in6_addr *addr) | 148 | int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) |
149 | { | 149 | { |
150 | struct ipv6_pinfo *np = inet6_sk(sk); | 150 | struct ipv6_pinfo *np = inet6_sk(sk); |
151 | struct net_device *dev; | 151 | struct net_device *dev; |
@@ -252,7 +252,7 @@ static void aca_put(struct ifacaddr6 *ac) | |||
252 | /* | 252 | /* |
253 | * device anycast group inc (add if not found) | 253 | * device anycast group inc (add if not found) |
254 | */ | 254 | */ |
255 | int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr) | 255 | int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr) |
256 | { | 256 | { |
257 | struct ifacaddr6 *aca; | 257 | struct ifacaddr6 *aca; |
258 | struct inet6_dev *idev; | 258 | struct inet6_dev *idev; |
@@ -324,7 +324,7 @@ out: | |||
324 | /* | 324 | /* |
325 | * device anycast group decrement | 325 | * device anycast group decrement |
326 | */ | 326 | */ |
327 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr) | 327 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr) |
328 | { | 328 | { |
329 | struct ifacaddr6 *aca, *prev_aca; | 329 | struct ifacaddr6 *aca, *prev_aca; |
330 | 330 | ||
@@ -358,7 +358,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr) | |||
358 | } | 358 | } |
359 | 359 | ||
360 | /* called with rcu_read_lock() */ | 360 | /* called with rcu_read_lock() */ |
361 | static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr) | 361 | static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr) |
362 | { | 362 | { |
363 | struct inet6_dev *idev = __in6_dev_get(dev); | 363 | struct inet6_dev *idev = __in6_dev_get(dev); |
364 | 364 | ||
@@ -371,7 +371,7 @@ static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr) | |||
371 | * check if the interface has this anycast address | 371 | * check if the interface has this anycast address |
372 | * called with rcu_read_lock() | 372 | * called with rcu_read_lock() |
373 | */ | 373 | */ |
374 | static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr) | 374 | static int ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *addr) |
375 | { | 375 | { |
376 | struct inet6_dev *idev; | 376 | struct inet6_dev *idev; |
377 | struct ifacaddr6 *aca; | 377 | struct ifacaddr6 *aca; |
@@ -392,7 +392,7 @@ static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr) | |||
392 | * check if given interface (or any, if dev==0) has this anycast address | 392 | * check if given interface (or any, if dev==0) has this anycast address |
393 | */ | 393 | */ |
394 | int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, | 394 | int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, |
395 | struct in6_addr *addr) | 395 | const struct in6_addr *addr) |
396 | { | 396 | { |
397 | int found = 0; | 397 | int found = 0; |
398 | 398 | ||
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 5aa8ec88f194..e97b4b7ca2f2 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -430,7 +430,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
430 | u8 type, u8 code, int offset, __be32 info) | 430 | u8 type, u8 code, int offset, __be32 info) |
431 | { | 431 | { |
432 | struct net *net = dev_net(skb->dev); | 432 | struct net *net = dev_net(skb->dev); |
433 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | 433 | const struct ipv6hdr *iph = (const struct ipv6hdr *)skb->data; |
434 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset); | 434 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset); |
435 | struct xfrm_state *x; | 435 | struct xfrm_state *x; |
436 | 436 | ||
@@ -438,7 +438,8 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
438 | type != ICMPV6_PKT_TOOBIG) | 438 | type != ICMPV6_PKT_TOOBIG) |
439 | return; | 439 | return; |
440 | 440 | ||
441 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); | 441 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
442 | esph->spi, IPPROTO_ESP, AF_INET6); | ||
442 | if (!x) | 443 | if (!x) |
443 | return; | 444 | return; |
444 | printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%pI6\n", | 445 | printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%pI6\n", |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 83cb4f9add81..11900417b1cc 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -372,7 +372,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) | |||
372 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 372 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
373 | struct sock *sk; | 373 | struct sock *sk; |
374 | struct ipv6_pinfo *np; | 374 | struct ipv6_pinfo *np; |
375 | struct in6_addr *saddr = NULL; | 375 | const struct in6_addr *saddr = NULL; |
376 | struct dst_entry *dst; | 376 | struct dst_entry *dst; |
377 | struct icmp6hdr tmp_hdr; | 377 | struct icmp6hdr tmp_hdr; |
378 | struct flowi6 fl6; | 378 | struct flowi6 fl6; |
@@ -521,7 +521,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
521 | struct sock *sk; | 521 | struct sock *sk; |
522 | struct inet6_dev *idev; | 522 | struct inet6_dev *idev; |
523 | struct ipv6_pinfo *np; | 523 | struct ipv6_pinfo *np; |
524 | struct in6_addr *saddr = NULL; | 524 | const struct in6_addr *saddr = NULL; |
525 | struct icmp6hdr *icmph = icmp6_hdr(skb); | 525 | struct icmp6hdr *icmph = icmp6_hdr(skb); |
526 | struct icmp6hdr tmp_hdr; | 526 | struct icmp6hdr tmp_hdr; |
527 | struct flowi6 fl6; | 527 | struct flowi6 fl6; |
@@ -645,8 +645,8 @@ static int icmpv6_rcv(struct sk_buff *skb) | |||
645 | { | 645 | { |
646 | struct net_device *dev = skb->dev; | 646 | struct net_device *dev = skb->dev; |
647 | struct inet6_dev *idev = __in6_dev_get(dev); | 647 | struct inet6_dev *idev = __in6_dev_get(dev); |
648 | struct in6_addr *saddr, *daddr; | 648 | const struct in6_addr *saddr, *daddr; |
649 | struct ipv6hdr *orig_hdr; | 649 | const struct ipv6hdr *orig_hdr; |
650 | struct icmp6hdr *hdr; | 650 | struct icmp6hdr *hdr; |
651 | u8 type; | 651 | u8 type; |
652 | 652 | ||
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 7548905e79e1..dd88df0a5d7f 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -134,9 +134,9 @@ static __inline__ u32 fib6_new_sernum(void) | |||
134 | # define BITOP_BE32_SWIZZLE 0 | 134 | # define BITOP_BE32_SWIZZLE 0 |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | static __inline__ __be32 addr_bit_set(void *token, int fn_bit) | 137 | static __inline__ __be32 addr_bit_set(const void *token, int fn_bit) |
138 | { | 138 | { |
139 | __be32 *addr = token; | 139 | const __be32 *addr = token; |
140 | /* | 140 | /* |
141 | * Here, | 141 | * Here, |
142 | * 1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f) | 142 | * 1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f) |
@@ -822,7 +822,7 @@ st_failure: | |||
822 | 822 | ||
823 | struct lookup_args { | 823 | struct lookup_args { |
824 | int offset; /* key offset on rt6_info */ | 824 | int offset; /* key offset on rt6_info */ |
825 | struct in6_addr *addr; /* search key */ | 825 | const struct in6_addr *addr; /* search key */ |
826 | }; | 826 | }; |
827 | 827 | ||
828 | static struct fib6_node * fib6_lookup_1(struct fib6_node *root, | 828 | static struct fib6_node * fib6_lookup_1(struct fib6_node *root, |
@@ -881,8 +881,8 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root, | |||
881 | return NULL; | 881 | return NULL; |
882 | } | 882 | } |
883 | 883 | ||
884 | struct fib6_node * fib6_lookup(struct fib6_node *root, struct in6_addr *daddr, | 884 | struct fib6_node * fib6_lookup(struct fib6_node *root, const struct in6_addr *daddr, |
885 | struct in6_addr *saddr) | 885 | const struct in6_addr *saddr) |
886 | { | 886 | { |
887 | struct fib6_node *fn; | 887 | struct fib6_node *fn; |
888 | struct lookup_args args[] = { | 888 | struct lookup_args args[] = { |
@@ -916,7 +916,7 @@ struct fib6_node * fib6_lookup(struct fib6_node *root, struct in6_addr *daddr, | |||
916 | 916 | ||
917 | 917 | ||
918 | static struct fib6_node * fib6_locate_1(struct fib6_node *root, | 918 | static struct fib6_node * fib6_locate_1(struct fib6_node *root, |
919 | struct in6_addr *addr, | 919 | const struct in6_addr *addr, |
920 | int plen, int offset) | 920 | int plen, int offset) |
921 | { | 921 | { |
922 | struct fib6_node *fn; | 922 | struct fib6_node *fn; |
@@ -946,8 +946,8 @@ static struct fib6_node * fib6_locate_1(struct fib6_node *root, | |||
946 | } | 946 | } |
947 | 947 | ||
948 | struct fib6_node * fib6_locate(struct fib6_node *root, | 948 | struct fib6_node * fib6_locate(struct fib6_node *root, |
949 | struct in6_addr *daddr, int dst_len, | 949 | const struct in6_addr *daddr, int dst_len, |
950 | struct in6_addr *saddr, int src_len) | 950 | const struct in6_addr *saddr, int src_len) |
951 | { | 951 | { |
952 | struct fib6_node *fn; | 952 | struct fib6_node *fn; |
953 | 953 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index a83e9209cecc..027c7ff6f1e5 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -57,7 +57,7 @@ inline int ip6_rcv_finish( struct sk_buff *skb) | |||
57 | 57 | ||
58 | int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) | 58 | int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) |
59 | { | 59 | { |
60 | struct ipv6hdr *hdr; | 60 | const struct ipv6hdr *hdr; |
61 | u32 pkt_len; | 61 | u32 pkt_len; |
62 | struct inet6_dev *idev; | 62 | struct inet6_dev *idev; |
63 | struct net *net = dev_net(skb->dev); | 63 | struct net *net = dev_net(skb->dev); |
@@ -186,7 +186,7 @@ resubmit: | |||
186 | int ret; | 186 | int ret; |
187 | 187 | ||
188 | if (ipprot->flags & INET6_PROTO_FINAL) { | 188 | if (ipprot->flags & INET6_PROTO_FINAL) { |
189 | struct ipv6hdr *hdr; | 189 | const struct ipv6hdr *hdr; |
190 | 190 | ||
191 | /* Free reference early: we don't need it any more, | 191 | /* Free reference early: we don't need it any more, |
192 | and it may hold ip_conntrack module loaded | 192 | and it may hold ip_conntrack module loaded |
@@ -242,7 +242,7 @@ int ip6_input(struct sk_buff *skb) | |||
242 | 242 | ||
243 | int ip6_mc_input(struct sk_buff *skb) | 243 | int ip6_mc_input(struct sk_buff *skb) |
244 | { | 244 | { |
245 | struct ipv6hdr *hdr; | 245 | const struct ipv6hdr *hdr; |
246 | int deliver; | 246 | int deliver; |
247 | 247 | ||
248 | IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev), | 248 | IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev), |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c614d02bf429..4cfbb24b9e04 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -869,9 +869,9 @@ fail: | |||
869 | return err; | 869 | return err; |
870 | } | 870 | } |
871 | 871 | ||
872 | static inline int ip6_rt_check(struct rt6key *rt_key, | 872 | static inline int ip6_rt_check(const struct rt6key *rt_key, |
873 | struct in6_addr *fl_addr, | 873 | const struct in6_addr *fl_addr, |
874 | struct in6_addr *addr_cache) | 874 | const struct in6_addr *addr_cache) |
875 | { | 875 | { |
876 | return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && | 876 | return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && |
877 | (addr_cache == NULL || !ipv6_addr_equal(fl_addr, addr_cache)); | 877 | (addr_cache == NULL || !ipv6_addr_equal(fl_addr, addr_cache)); |
@@ -879,7 +879,7 @@ static inline int ip6_rt_check(struct rt6key *rt_key, | |||
879 | 879 | ||
880 | static struct dst_entry *ip6_sk_dst_check(struct sock *sk, | 880 | static struct dst_entry *ip6_sk_dst_check(struct sock *sk, |
881 | struct dst_entry *dst, | 881 | struct dst_entry *dst, |
882 | struct flowi6 *fl6) | 882 | const struct flowi6 *fl6) |
883 | { | 883 | { |
884 | struct ipv6_pinfo *np = inet6_sk(sk); | 884 | struct ipv6_pinfo *np = inet6_sk(sk); |
885 | struct rt6_info *rt = (struct rt6_info *)dst; | 885 | struct rt6_info *rt = (struct rt6_info *)dst; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index c1b1bd312df2..9dd0e964b8bd 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -162,7 +162,7 @@ static inline void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst) | |||
162 | for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) | 162 | for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) |
163 | 163 | ||
164 | static struct ip6_tnl * | 164 | static struct ip6_tnl * |
165 | ip6_tnl_lookup(struct net *net, struct in6_addr *remote, struct in6_addr *local) | 165 | ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) |
166 | { | 166 | { |
167 | unsigned int h0 = HASH(remote); | 167 | unsigned int h0 = HASH(remote); |
168 | unsigned int h1 = HASH(local); | 168 | unsigned int h1 = HASH(local); |
@@ -194,10 +194,10 @@ ip6_tnl_lookup(struct net *net, struct in6_addr *remote, struct in6_addr *local) | |||
194 | **/ | 194 | **/ |
195 | 195 | ||
196 | static struct ip6_tnl __rcu ** | 196 | static struct ip6_tnl __rcu ** |
197 | ip6_tnl_bucket(struct ip6_tnl_net *ip6n, struct ip6_tnl_parm *p) | 197 | ip6_tnl_bucket(struct ip6_tnl_net *ip6n, const struct ip6_tnl_parm *p) |
198 | { | 198 | { |
199 | struct in6_addr *remote = &p->raddr; | 199 | const struct in6_addr *remote = &p->raddr; |
200 | struct in6_addr *local = &p->laddr; | 200 | const struct in6_addr *local = &p->laddr; |
201 | unsigned h = 0; | 201 | unsigned h = 0; |
202 | int prio = 0; | 202 | int prio = 0; |
203 | 203 | ||
@@ -321,8 +321,8 @@ failed: | |||
321 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, | 321 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, |
322 | struct ip6_tnl_parm *p, int create) | 322 | struct ip6_tnl_parm *p, int create) |
323 | { | 323 | { |
324 | struct in6_addr *remote = &p->raddr; | 324 | const struct in6_addr *remote = &p->raddr; |
325 | struct in6_addr *local = &p->laddr; | 325 | const struct in6_addr *local = &p->laddr; |
326 | struct ip6_tnl __rcu **tp; | 326 | struct ip6_tnl __rcu **tp; |
327 | struct ip6_tnl *t; | 327 | struct ip6_tnl *t; |
328 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 328 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
@@ -374,7 +374,7 @@ ip6_tnl_dev_uninit(struct net_device *dev) | |||
374 | static __u16 | 374 | static __u16 |
375 | parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) | 375 | parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) |
376 | { | 376 | { |
377 | struct ipv6hdr *ipv6h = (struct ipv6hdr *) raw; | 377 | const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) raw; |
378 | __u8 nexthdr = ipv6h->nexthdr; | 378 | __u8 nexthdr = ipv6h->nexthdr; |
379 | __u16 off = sizeof (*ipv6h); | 379 | __u16 off = sizeof (*ipv6h); |
380 | 380 | ||
@@ -435,7 +435,7 @@ static int | |||
435 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, | 435 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, |
436 | u8 *type, u8 *code, int *msg, __u32 *info, int offset) | 436 | u8 *type, u8 *code, int *msg, __u32 *info, int offset) |
437 | { | 437 | { |
438 | struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data; | 438 | const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) skb->data; |
439 | struct ip6_tnl *t; | 439 | struct ip6_tnl *t; |
440 | int rel_msg = 0; | 440 | int rel_msg = 0; |
441 | u8 rel_type = ICMPV6_DEST_UNREACH; | 441 | u8 rel_type = ICMPV6_DEST_UNREACH; |
@@ -535,7 +535,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
535 | __u32 rel_info = ntohl(info); | 535 | __u32 rel_info = ntohl(info); |
536 | int err; | 536 | int err; |
537 | struct sk_buff *skb2; | 537 | struct sk_buff *skb2; |
538 | struct iphdr *eiph; | 538 | const struct iphdr *eiph; |
539 | struct rtable *rt; | 539 | struct rtable *rt; |
540 | 540 | ||
541 | err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, | 541 | err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, |
@@ -669,8 +669,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
669 | return 0; | 669 | return 0; |
670 | } | 670 | } |
671 | 671 | ||
672 | static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | 672 | static void ip4ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, |
673 | struct ipv6hdr *ipv6h, | 673 | const struct ipv6hdr *ipv6h, |
674 | struct sk_buff *skb) | 674 | struct sk_buff *skb) |
675 | { | 675 | { |
676 | __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK; | 676 | __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK; |
@@ -682,8 +682,8 @@ static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | |||
682 | IP_ECN_set_ce(ip_hdr(skb)); | 682 | IP_ECN_set_ce(ip_hdr(skb)); |
683 | } | 683 | } |
684 | 684 | ||
685 | static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | 685 | static void ip6ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, |
686 | struct ipv6hdr *ipv6h, | 686 | const struct ipv6hdr *ipv6h, |
687 | struct sk_buff *skb) | 687 | struct sk_buff *skb) |
688 | { | 688 | { |
689 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) | 689 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) |
@@ -726,12 +726,12 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t) | |||
726 | 726 | ||
727 | static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | 727 | static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, |
728 | __u8 ipproto, | 728 | __u8 ipproto, |
729 | void (*dscp_ecn_decapsulate)(struct ip6_tnl *t, | 729 | void (*dscp_ecn_decapsulate)(const struct ip6_tnl *t, |
730 | struct ipv6hdr *ipv6h, | 730 | const struct ipv6hdr *ipv6h, |
731 | struct sk_buff *skb)) | 731 | struct sk_buff *skb)) |
732 | { | 732 | { |
733 | struct ip6_tnl *t; | 733 | struct ip6_tnl *t; |
734 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 734 | const struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
735 | 735 | ||
736 | rcu_read_lock(); | 736 | rcu_read_lock(); |
737 | 737 | ||
@@ -828,7 +828,7 @@ static void init_tel_txopt(struct ipv6_tel_txoption *opt, __u8 encap_limit) | |||
828 | **/ | 828 | **/ |
829 | 829 | ||
830 | static inline int | 830 | static inline int |
831 | ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr) | 831 | ip6_tnl_addr_conflict(const struct ip6_tnl *t, const struct ipv6hdr *hdr) |
832 | { | 832 | { |
833 | return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); | 833 | return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); |
834 | } | 834 | } |
@@ -1005,7 +1005,7 @@ static inline int | |||
1005 | ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | 1005 | ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
1006 | { | 1006 | { |
1007 | struct ip6_tnl *t = netdev_priv(dev); | 1007 | struct ip6_tnl *t = netdev_priv(dev); |
1008 | struct iphdr *iph = ip_hdr(skb); | 1008 | const struct iphdr *iph = ip_hdr(skb); |
1009 | int encap_limit = -1; | 1009 | int encap_limit = -1; |
1010 | struct flowi6 fl6; | 1010 | struct flowi6 fl6; |
1011 | __u8 dsfield; | 1011 | __u8 dsfield; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 29e48593bf22..82a809901f8e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -989,8 +989,8 @@ static int mif6_add(struct net *net, struct mr6_table *mrt, | |||
989 | } | 989 | } |
990 | 990 | ||
991 | static struct mfc6_cache *ip6mr_cache_find(struct mr6_table *mrt, | 991 | static struct mfc6_cache *ip6mr_cache_find(struct mr6_table *mrt, |
992 | struct in6_addr *origin, | 992 | const struct in6_addr *origin, |
993 | struct in6_addr *mcastgrp) | 993 | const struct in6_addr *mcastgrp) |
994 | { | 994 | { |
995 | int line = MFC6_HASH(mcastgrp, origin); | 995 | int line = MFC6_HASH(mcastgrp, origin); |
996 | struct mfc6_cache *c; | 996 | struct mfc6_cache *c; |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 85cccd6ed0b7..bba658d9a03c 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -55,7 +55,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
55 | { | 55 | { |
56 | struct net *net = dev_net(skb->dev); | 56 | struct net *net = dev_net(skb->dev); |
57 | __be32 spi; | 57 | __be32 spi; |
58 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | 58 | const struct ipv6hdr *iph = (const struct ipv6hdr *)skb->data; |
59 | struct ip_comp_hdr *ipcomph = | 59 | struct ip_comp_hdr *ipcomph = |
60 | (struct ip_comp_hdr *)(skb->data + offset); | 60 | (struct ip_comp_hdr *)(skb->data + offset); |
61 | struct xfrm_state *x; | 61 | struct xfrm_state *x; |
@@ -64,7 +64,8 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
64 | return; | 64 | return; |
65 | 65 | ||
66 | spi = htonl(ntohs(ipcomph->cpi)); | 66 | spi = htonl(ntohs(ipcomph->cpi)); |
67 | x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); | 67 | x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, |
68 | spi, IPPROTO_COMP, AF_INET6); | ||
68 | if (!x) | 69 | if (!x) |
69 | return; | 70 | return; |
70 | 71 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 76b893771e6e..ff62e33ead07 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -92,16 +92,16 @@ static void mld_gq_timer_expire(unsigned long data); | |||
92 | static void mld_ifc_timer_expire(unsigned long data); | 92 | static void mld_ifc_timer_expire(unsigned long data); |
93 | static void mld_ifc_event(struct inet6_dev *idev); | 93 | static void mld_ifc_event(struct inet6_dev *idev); |
94 | static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *pmc); | 94 | static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *pmc); |
95 | static void mld_del_delrec(struct inet6_dev *idev, struct in6_addr *addr); | 95 | static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *addr); |
96 | static void mld_clear_delrec(struct inet6_dev *idev); | 96 | static void mld_clear_delrec(struct inet6_dev *idev); |
97 | static int sf_setstate(struct ifmcaddr6 *pmc); | 97 | static int sf_setstate(struct ifmcaddr6 *pmc); |
98 | static void sf_markstate(struct ifmcaddr6 *pmc); | 98 | static void sf_markstate(struct ifmcaddr6 *pmc); |
99 | static void ip6_mc_clear_src(struct ifmcaddr6 *pmc); | 99 | static void ip6_mc_clear_src(struct ifmcaddr6 *pmc); |
100 | static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, | 100 | static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, |
101 | int sfmode, int sfcount, struct in6_addr *psfsrc, | 101 | int sfmode, int sfcount, const struct in6_addr *psfsrc, |
102 | int delta); | 102 | int delta); |
103 | static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, | 103 | static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, |
104 | int sfmode, int sfcount, struct in6_addr *psfsrc, | 104 | int sfmode, int sfcount, const struct in6_addr *psfsrc, |
105 | int delta); | 105 | int delta); |
106 | static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, | 106 | static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, |
107 | struct inet6_dev *idev); | 107 | struct inet6_dev *idev); |
@@ -250,7 +250,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
250 | 250 | ||
251 | /* called with rcu_read_lock() */ | 251 | /* called with rcu_read_lock() */ |
252 | static struct inet6_dev *ip6_mc_find_dev_rcu(struct net *net, | 252 | static struct inet6_dev *ip6_mc_find_dev_rcu(struct net *net, |
253 | struct in6_addr *group, | 253 | const struct in6_addr *group, |
254 | int ifindex) | 254 | int ifindex) |
255 | { | 255 | { |
256 | struct net_device *dev = NULL; | 256 | struct net_device *dev = NULL; |
@@ -451,7 +451,7 @@ done: | |||
451 | 451 | ||
452 | int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) | 452 | int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) |
453 | { | 453 | { |
454 | struct in6_addr *group; | 454 | const struct in6_addr *group; |
455 | struct ipv6_mc_socklist *pmc; | 455 | struct ipv6_mc_socklist *pmc; |
456 | struct inet6_dev *idev; | 456 | struct inet6_dev *idev; |
457 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 457 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
@@ -542,7 +542,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, | |||
542 | struct group_filter __user *optval, int __user *optlen) | 542 | struct group_filter __user *optval, int __user *optlen) |
543 | { | 543 | { |
544 | int err, i, count, copycount; | 544 | int err, i, count, copycount; |
545 | struct in6_addr *group; | 545 | const struct in6_addr *group; |
546 | struct ipv6_mc_socklist *pmc; | 546 | struct ipv6_mc_socklist *pmc; |
547 | struct inet6_dev *idev; | 547 | struct inet6_dev *idev; |
548 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 548 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
@@ -752,7 +752,7 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) | |||
752 | spin_unlock_bh(&idev->mc_lock); | 752 | spin_unlock_bh(&idev->mc_lock); |
753 | } | 753 | } |
754 | 754 | ||
755 | static void mld_del_delrec(struct inet6_dev *idev, struct in6_addr *pmca) | 755 | static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *pmca) |
756 | { | 756 | { |
757 | struct ifmcaddr6 *pmc, *pmc_prev; | 757 | struct ifmcaddr6 *pmc, *pmc_prev; |
758 | struct ip6_sf_list *psf, *psf_next; | 758 | struct ip6_sf_list *psf, *psf_next; |
@@ -1052,7 +1052,7 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime) | |||
1052 | 1052 | ||
1053 | /* mark EXCLUDE-mode sources */ | 1053 | /* mark EXCLUDE-mode sources */ |
1054 | static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, | 1054 | static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, |
1055 | struct in6_addr *srcs) | 1055 | const struct in6_addr *srcs) |
1056 | { | 1056 | { |
1057 | struct ip6_sf_list *psf; | 1057 | struct ip6_sf_list *psf; |
1058 | int i, scount; | 1058 | int i, scount; |
@@ -1080,7 +1080,7 @@ static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, | |||
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, | 1082 | static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, |
1083 | struct in6_addr *srcs) | 1083 | const struct in6_addr *srcs) |
1084 | { | 1084 | { |
1085 | struct ip6_sf_list *psf; | 1085 | struct ip6_sf_list *psf; |
1086 | int i, scount; | 1086 | int i, scount; |
@@ -1115,7 +1115,7 @@ int igmp6_event_query(struct sk_buff *skb) | |||
1115 | { | 1115 | { |
1116 | struct mld2_query *mlh2 = NULL; | 1116 | struct mld2_query *mlh2 = NULL; |
1117 | struct ifmcaddr6 *ma; | 1117 | struct ifmcaddr6 *ma; |
1118 | struct in6_addr *group; | 1118 | const struct in6_addr *group; |
1119 | unsigned long max_delay; | 1119 | unsigned long max_delay; |
1120 | struct inet6_dev *idev; | 1120 | struct inet6_dev *idev; |
1121 | struct mld_msg *mld; | 1121 | struct mld_msg *mld; |
@@ -1821,7 +1821,7 @@ err_out: | |||
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, | 1823 | static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, |
1824 | struct in6_addr *psfsrc) | 1824 | const struct in6_addr *psfsrc) |
1825 | { | 1825 | { |
1826 | struct ip6_sf_list *psf, *psf_prev; | 1826 | struct ip6_sf_list *psf, *psf_prev; |
1827 | int rv = 0; | 1827 | int rv = 0; |
@@ -1857,8 +1857,8 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, | |||
1857 | return rv; | 1857 | return rv; |
1858 | } | 1858 | } |
1859 | 1859 | ||
1860 | static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, | 1860 | static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, |
1861 | int sfmode, int sfcount, struct in6_addr *psfsrc, | 1861 | int sfmode, int sfcount, const struct in6_addr *psfsrc, |
1862 | int delta) | 1862 | int delta) |
1863 | { | 1863 | { |
1864 | struct ifmcaddr6 *pmc; | 1864 | struct ifmcaddr6 *pmc; |
@@ -1918,7 +1918,7 @@ static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, | |||
1918 | * Add multicast single-source filter to the interface list | 1918 | * Add multicast single-source filter to the interface list |
1919 | */ | 1919 | */ |
1920 | static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, | 1920 | static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, |
1921 | struct in6_addr *psfsrc, int delta) | 1921 | const struct in6_addr *psfsrc, int delta) |
1922 | { | 1922 | { |
1923 | struct ip6_sf_list *psf, *psf_prev; | 1923 | struct ip6_sf_list *psf, *psf_prev; |
1924 | 1924 | ||
@@ -2021,8 +2021,8 @@ static int sf_setstate(struct ifmcaddr6 *pmc) | |||
2021 | /* | 2021 | /* |
2022 | * Add multicast source filter list to the interface list | 2022 | * Add multicast source filter list to the interface list |
2023 | */ | 2023 | */ |
2024 | static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, | 2024 | static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, |
2025 | int sfmode, int sfcount, struct in6_addr *psfsrc, | 2025 | int sfmode, int sfcount, const struct in6_addr *psfsrc, |
2026 | int delta) | 2026 | int delta) |
2027 | { | 2027 | { |
2028 | struct ifmcaddr6 *pmc; | 2028 | struct ifmcaddr6 *pmc; |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 9b210482fb05..43242e6e6103 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -126,7 +126,7 @@ static struct mip6_report_rate_limiter mip6_report_rl = { | |||
126 | 126 | ||
127 | static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb) | 127 | static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb) |
128 | { | 128 | { |
129 | struct ipv6hdr *iph = ipv6_hdr(skb); | 129 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
130 | struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; | 130 | struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; |
131 | int err = destopt->nexthdr; | 131 | int err = destopt->nexthdr; |
132 | 132 | ||
@@ -181,8 +181,8 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | static inline int mip6_report_rl_allow(struct timeval *stamp, | 183 | static inline int mip6_report_rl_allow(struct timeval *stamp, |
184 | struct in6_addr *dst, | 184 | const struct in6_addr *dst, |
185 | struct in6_addr *src, int iif) | 185 | const struct in6_addr *src, int iif) |
186 | { | 186 | { |
187 | int allow = 0; | 187 | int allow = 0; |
188 | 188 | ||
@@ -349,7 +349,7 @@ static const struct xfrm_type mip6_destopt_type = | |||
349 | 349 | ||
350 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) | 350 | static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) |
351 | { | 351 | { |
352 | struct ipv6hdr *iph = ipv6_hdr(skb); | 352 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
353 | struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; | 353 | struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; |
354 | int err = rt2->rt_hdr.nexthdr; | 354 | int err = rt2->rt_hdr.nexthdr; |
355 | 355 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 01a0ffc7b402..69aacd18e066 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -324,7 +324,7 @@ static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, | |||
324 | return lladdr + prepad; | 324 | return lladdr + prepad; |
325 | } | 325 | } |
326 | 326 | ||
327 | int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir) | 327 | int ndisc_mc_map(const struct in6_addr *addr, char *buf, struct net_device *dev, int dir) |
328 | { | 328 | { |
329 | switch (dev->type) { | 329 | switch (dev->type) { |
330 | case ARPHRD_ETHER: | 330 | case ARPHRD_ETHER: |
@@ -748,8 +748,8 @@ static int pndisc_is_router(const void *pkey, | |||
748 | static void ndisc_recv_ns(struct sk_buff *skb) | 748 | static void ndisc_recv_ns(struct sk_buff *skb) |
749 | { | 749 | { |
750 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); | 750 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
751 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 751 | const struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
752 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 752 | const struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
753 | u8 *lladdr = NULL; | 753 | u8 *lladdr = NULL; |
754 | u32 ndoptlen = skb->tail - (skb->transport_header + | 754 | u32 ndoptlen = skb->tail - (skb->transport_header + |
755 | offsetof(struct nd_msg, opt)); | 755 | offsetof(struct nd_msg, opt)); |
@@ -924,8 +924,8 @@ out: | |||
924 | static void ndisc_recv_na(struct sk_buff *skb) | 924 | static void ndisc_recv_na(struct sk_buff *skb) |
925 | { | 925 | { |
926 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); | 926 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
927 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 927 | const struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
928 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 928 | const struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
929 | u8 *lladdr = NULL; | 929 | u8 *lladdr = NULL; |
930 | u32 ndoptlen = skb->tail - (skb->transport_header + | 930 | u32 ndoptlen = skb->tail - (skb->transport_header + |
931 | offsetof(struct nd_msg, opt)); | 931 | offsetof(struct nd_msg, opt)); |
@@ -1038,7 +1038,7 @@ static void ndisc_recv_rs(struct sk_buff *skb) | |||
1038 | unsigned long ndoptlen = skb->len - sizeof(*rs_msg); | 1038 | unsigned long ndoptlen = skb->len - sizeof(*rs_msg); |
1039 | struct neighbour *neigh; | 1039 | struct neighbour *neigh; |
1040 | struct inet6_dev *idev; | 1040 | struct inet6_dev *idev; |
1041 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 1041 | const struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
1042 | struct ndisc_options ndopts; | 1042 | struct ndisc_options ndopts; |
1043 | u8 *lladdr = NULL; | 1043 | u8 *lladdr = NULL; |
1044 | 1044 | ||
@@ -1435,8 +1435,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1435 | { | 1435 | { |
1436 | struct inet6_dev *in6_dev; | 1436 | struct inet6_dev *in6_dev; |
1437 | struct icmp6hdr *icmph; | 1437 | struct icmp6hdr *icmph; |
1438 | struct in6_addr *dest; | 1438 | const struct in6_addr *dest; |
1439 | struct in6_addr *target; /* new first hop to destination */ | 1439 | const struct in6_addr *target; /* new first hop to destination */ |
1440 | struct neighbour *neigh; | 1440 | struct neighbour *neigh; |
1441 | int on_link = 0; | 1441 | int on_link = 0; |
1442 | struct ndisc_options ndopts; | 1442 | struct ndisc_options ndopts; |
@@ -1469,7 +1469,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | icmph = icmp6_hdr(skb); | 1471 | icmph = icmp6_hdr(skb); |
1472 | target = (struct in6_addr *) (icmph + 1); | 1472 | target = (const struct in6_addr *) (icmph + 1); |
1473 | dest = target + 1; | 1473 | dest = target + 1; |
1474 | 1474 | ||
1475 | if (ipv6_addr_is_multicast(dest)) { | 1475 | if (ipv6_addr_is_multicast(dest)) { |
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index 28bc1f644b7b..30fcee465448 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -13,7 +13,7 @@ | |||
13 | int ip6_route_me_harder(struct sk_buff *skb) | 13 | int ip6_route_me_harder(struct sk_buff *skb) |
14 | { | 14 | { |
15 | struct net *net = dev_net(skb_dst(skb)->dev); | 15 | struct net *net = dev_net(skb_dst(skb)->dev); |
16 | struct ipv6hdr *iph = ipv6_hdr(skb); | 16 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
17 | struct dst_entry *dst; | 17 | struct dst_entry *dst; |
18 | struct flowi6 fl6 = { | 18 | struct flowi6 fl6 = { |
19 | .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, | 19 | .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, |
@@ -67,7 +67,7 @@ static void nf_ip6_saveroute(const struct sk_buff *skb, | |||
67 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); | 67 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); |
68 | 68 | ||
69 | if (entry->hook == NF_INET_LOCAL_OUT) { | 69 | if (entry->hook == NF_INET_LOCAL_OUT) { |
70 | struct ipv6hdr *iph = ipv6_hdr(skb); | 70 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
71 | 71 | ||
72 | rt_info->daddr = iph->daddr; | 72 | rt_info->daddr = iph->daddr; |
73 | rt_info->saddr = iph->saddr; | 73 | rt_info->saddr = iph->saddr; |
@@ -81,7 +81,7 @@ static int nf_ip6_reroute(struct sk_buff *skb, | |||
81 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); | 81 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); |
82 | 82 | ||
83 | if (entry->hook == NF_INET_LOCAL_OUT) { | 83 | if (entry->hook == NF_INET_LOCAL_OUT) { |
84 | struct ipv6hdr *iph = ipv6_hdr(skb); | 84 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
85 | if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || | 85 | if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || |
86 | !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || | 86 | !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || |
87 | skb->mark != rt_info->mark) | 87 | skb->mark != rt_info->mark) |
@@ -108,7 +108,7 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst, | |||
108 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 108 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
109 | unsigned int dataoff, u_int8_t protocol) | 109 | unsigned int dataoff, u_int8_t protocol) |
110 | { | 110 | { |
111 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 111 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
112 | __sum16 csum = 0; | 112 | __sum16 csum = 0; |
113 | 113 | ||
114 | switch (skb->ip_summed) { | 114 | switch (skb->ip_summed) { |
@@ -142,7 +142,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook, | |||
142 | unsigned int dataoff, unsigned int len, | 142 | unsigned int dataoff, unsigned int len, |
143 | u_int8_t protocol) | 143 | u_int8_t protocol) |
144 | { | 144 | { |
145 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 145 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
146 | __wsum hsum; | 146 | __wsum hsum; |
147 | __sum16 csum = 0; | 147 | __sum16 csum = 0; |
148 | 148 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 4a1c3b46c56b..e5e5425fe7d0 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -67,8 +67,8 @@ static struct raw_hashinfo raw_v6_hashinfo = { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, | 69 | static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, |
70 | unsigned short num, struct in6_addr *loc_addr, | 70 | unsigned short num, const struct in6_addr *loc_addr, |
71 | struct in6_addr *rmt_addr, int dif) | 71 | const struct in6_addr *rmt_addr, int dif) |
72 | { | 72 | { |
73 | struct hlist_node *node; | 73 | struct hlist_node *node; |
74 | int is_multicast = ipv6_addr_is_multicast(loc_addr); | 74 | int is_multicast = ipv6_addr_is_multicast(loc_addr); |
@@ -154,8 +154,8 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister); | |||
154 | */ | 154 | */ |
155 | static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | 155 | static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) |
156 | { | 156 | { |
157 | struct in6_addr *saddr; | 157 | const struct in6_addr *saddr; |
158 | struct in6_addr *daddr; | 158 | const struct in6_addr *daddr; |
159 | struct sock *sk; | 159 | struct sock *sk; |
160 | int delivered = 0; | 160 | int delivered = 0; |
161 | __u8 hash; | 161 | __u8 hash; |
@@ -348,7 +348,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, | |||
348 | { | 348 | { |
349 | struct sock *sk; | 349 | struct sock *sk; |
350 | int hash; | 350 | int hash; |
351 | struct in6_addr *saddr, *daddr; | 351 | const struct in6_addr *saddr, *daddr; |
352 | struct net *net; | 352 | struct net *net; |
353 | 353 | ||
354 | hash = nexthdr & (RAW_HTABLE_SIZE - 1); | 354 | hash = nexthdr & (RAW_HTABLE_SIZE - 1); |
@@ -357,7 +357,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, | |||
357 | sk = sk_head(&raw_v6_hashinfo.ht[hash]); | 357 | sk = sk_head(&raw_v6_hashinfo.ht[hash]); |
358 | if (sk != NULL) { | 358 | if (sk != NULL) { |
359 | /* Note: ipv6_hdr(skb) != skb->data */ | 359 | /* Note: ipv6_hdr(skb) != skb->data */ |
360 | struct ipv6hdr *ip6h = (struct ipv6hdr *)skb->data; | 360 | const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data; |
361 | saddr = &ip6h->saddr; | 361 | saddr = &ip6h->saddr; |
362 | daddr = &ip6h->daddr; | 362 | daddr = &ip6h->daddr; |
363 | net = dev_net(skb->dev); | 363 | net = dev_net(skb->dev); |
@@ -1231,7 +1231,7 @@ struct proto rawv6_prot = { | |||
1231 | static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | 1231 | static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) |
1232 | { | 1232 | { |
1233 | struct ipv6_pinfo *np = inet6_sk(sp); | 1233 | struct ipv6_pinfo *np = inet6_sk(sp); |
1234 | struct in6_addr *dest, *src; | 1234 | const struct in6_addr *dest, *src; |
1235 | __u16 destp, srcp; | 1235 | __u16 destp, srcp; |
1236 | 1236 | ||
1237 | dest = &np->daddr; | 1237 | dest = &np->daddr; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 07beeb06f752..7b954e2539d0 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -224,7 +224,7 @@ out: | |||
224 | } | 224 | } |
225 | 225 | ||
226 | static __inline__ struct frag_queue * | 226 | static __inline__ struct frag_queue * |
227 | fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst) | 227 | fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6_addr *dst) |
228 | { | 228 | { |
229 | struct inet_frag_queue *q; | 229 | struct inet_frag_queue *q; |
230 | struct ip6_create_arg arg; | 230 | struct ip6_create_arg arg; |
@@ -535,7 +535,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
535 | { | 535 | { |
536 | struct frag_hdr *fhdr; | 536 | struct frag_hdr *fhdr; |
537 | struct frag_queue *fq; | 537 | struct frag_queue *fq; |
538 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 538 | const struct ipv6hdr *hdr = ipv6_hdr(skb); |
539 | struct net *net = dev_net(skb_dst(skb)->dev); | 539 | struct net *net = dev_net(skb_dst(skb)->dev); |
540 | 540 | ||
541 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS); | 541 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index af26cc1073cb..852fc28ca818 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -89,12 +89,12 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu); | |||
89 | 89 | ||
90 | #ifdef CONFIG_IPV6_ROUTE_INFO | 90 | #ifdef CONFIG_IPV6_ROUTE_INFO |
91 | static struct rt6_info *rt6_add_route_info(struct net *net, | 91 | static struct rt6_info *rt6_add_route_info(struct net *net, |
92 | struct in6_addr *prefix, int prefixlen, | 92 | const struct in6_addr *prefix, int prefixlen, |
93 | struct in6_addr *gwaddr, int ifindex, | 93 | const struct in6_addr *gwaddr, int ifindex, |
94 | unsigned pref); | 94 | unsigned pref); |
95 | static struct rt6_info *rt6_get_route_info(struct net *net, | 95 | static struct rt6_info *rt6_get_route_info(struct net *net, |
96 | struct in6_addr *prefix, int prefixlen, | 96 | const struct in6_addr *prefix, int prefixlen, |
97 | struct in6_addr *gwaddr, int ifindex); | 97 | const struct in6_addr *gwaddr, int ifindex); |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) | 100 | static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) |
@@ -283,7 +283,7 @@ static __inline__ int rt6_check_expired(const struct rt6_info *rt) | |||
283 | time_after(jiffies, rt->rt6i_expires); | 283 | time_after(jiffies, rt->rt6i_expires); |
284 | } | 284 | } |
285 | 285 | ||
286 | static inline int rt6_need_strict(struct in6_addr *daddr) | 286 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
287 | { | 287 | { |
288 | return ipv6_addr_type(daddr) & | 288 | return ipv6_addr_type(daddr) & |
289 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); | 289 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); |
@@ -295,7 +295,7 @@ static inline int rt6_need_strict(struct in6_addr *daddr) | |||
295 | 295 | ||
296 | static inline struct rt6_info *rt6_device_match(struct net *net, | 296 | static inline struct rt6_info *rt6_device_match(struct net *net, |
297 | struct rt6_info *rt, | 297 | struct rt6_info *rt, |
298 | struct in6_addr *saddr, | 298 | const struct in6_addr *saddr, |
299 | int oif, | 299 | int oif, |
300 | int flags) | 300 | int flags) |
301 | { | 301 | { |
@@ -507,7 +507,7 @@ static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict) | |||
507 | 507 | ||
508 | #ifdef CONFIG_IPV6_ROUTE_INFO | 508 | #ifdef CONFIG_IPV6_ROUTE_INFO |
509 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | 509 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
510 | struct in6_addr *gwaddr) | 510 | const struct in6_addr *gwaddr) |
511 | { | 511 | { |
512 | struct net *net = dev_net(dev); | 512 | struct net *net = dev_net(dev); |
513 | struct route_info *rinfo = (struct route_info *) opt; | 513 | struct route_info *rinfo = (struct route_info *) opt; |
@@ -670,8 +670,8 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
670 | return __ip6_ins_rt(rt, &info); | 670 | return __ip6_ins_rt(rt, &info); |
671 | } | 671 | } |
672 | 672 | ||
673 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, | 673 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, const struct in6_addr *daddr, |
674 | struct in6_addr *saddr) | 674 | const struct in6_addr *saddr) |
675 | { | 675 | { |
676 | struct rt6_info *rt; | 676 | struct rt6_info *rt; |
677 | 677 | ||
@@ -739,7 +739,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad | |||
739 | return rt; | 739 | return rt; |
740 | } | 740 | } |
741 | 741 | ||
742 | static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *daddr) | 742 | static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, const struct in6_addr *daddr) |
743 | { | 743 | { |
744 | struct rt6_info *rt = ip6_rt_copy(ort); | 744 | struct rt6_info *rt = ip6_rt_copy(ort); |
745 | if (rt) { | 745 | if (rt) { |
@@ -830,7 +830,7 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table * | |||
830 | 830 | ||
831 | void ip6_route_input(struct sk_buff *skb) | 831 | void ip6_route_input(struct sk_buff *skb) |
832 | { | 832 | { |
833 | struct ipv6hdr *iph = ipv6_hdr(skb); | 833 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
834 | struct net *net = dev_net(skb->dev); | 834 | struct net *net = dev_net(skb->dev); |
835 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 835 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
836 | struct flowi6 fl6 = { | 836 | struct flowi6 fl6 = { |
@@ -1272,7 +1272,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | if (cfg->fc_flags & RTF_GATEWAY) { | 1274 | if (cfg->fc_flags & RTF_GATEWAY) { |
1275 | struct in6_addr *gw_addr; | 1275 | const struct in6_addr *gw_addr; |
1276 | int gwa_type; | 1276 | int gwa_type; |
1277 | 1277 | ||
1278 | gw_addr = &cfg->fc_gateway; | 1278 | gw_addr = &cfg->fc_gateway; |
@@ -1512,9 +1512,9 @@ out: | |||
1512 | return rt; | 1512 | return rt; |
1513 | }; | 1513 | }; |
1514 | 1514 | ||
1515 | static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | 1515 | static struct rt6_info *ip6_route_redirect(const struct in6_addr *dest, |
1516 | struct in6_addr *src, | 1516 | const struct in6_addr *src, |
1517 | struct in6_addr *gateway, | 1517 | const struct in6_addr *gateway, |
1518 | struct net_device *dev) | 1518 | struct net_device *dev) |
1519 | { | 1519 | { |
1520 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 1520 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
@@ -1536,8 +1536,8 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | |||
1536 | flags, __ip6_route_redirect); | 1536 | flags, __ip6_route_redirect); |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, | 1539 | void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, |
1540 | struct in6_addr *saddr, | 1540 | const struct in6_addr *saddr, |
1541 | struct neighbour *neigh, u8 *lladdr, int on_link) | 1541 | struct neighbour *neigh, u8 *lladdr, int on_link) |
1542 | { | 1542 | { |
1543 | struct rt6_info *rt, *nrt = NULL; | 1543 | struct rt6_info *rt, *nrt = NULL; |
@@ -1611,7 +1611,7 @@ out: | |||
1611 | * i.e. Path MTU discovery | 1611 | * i.e. Path MTU discovery |
1612 | */ | 1612 | */ |
1613 | 1613 | ||
1614 | static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr, | 1614 | static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr *saddr, |
1615 | struct net *net, u32 pmtu, int ifindex) | 1615 | struct net *net, u32 pmtu, int ifindex) |
1616 | { | 1616 | { |
1617 | struct rt6_info *rt, *nrt; | 1617 | struct rt6_info *rt, *nrt; |
@@ -1696,7 +1696,7 @@ out: | |||
1696 | dst_release(&rt->dst); | 1696 | dst_release(&rt->dst); |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, | 1699 | void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *saddr, |
1700 | struct net_device *dev, u32 pmtu) | 1700 | struct net_device *dev, u32 pmtu) |
1701 | { | 1701 | { |
1702 | struct net *net = dev_net(dev); | 1702 | struct net *net = dev_net(dev); |
@@ -1756,8 +1756,8 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) | |||
1756 | 1756 | ||
1757 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1757 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1758 | static struct rt6_info *rt6_get_route_info(struct net *net, | 1758 | static struct rt6_info *rt6_get_route_info(struct net *net, |
1759 | struct in6_addr *prefix, int prefixlen, | 1759 | const struct in6_addr *prefix, int prefixlen, |
1760 | struct in6_addr *gwaddr, int ifindex) | 1760 | const struct in6_addr *gwaddr, int ifindex) |
1761 | { | 1761 | { |
1762 | struct fib6_node *fn; | 1762 | struct fib6_node *fn; |
1763 | struct rt6_info *rt = NULL; | 1763 | struct rt6_info *rt = NULL; |
@@ -1788,8 +1788,8 @@ out: | |||
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | static struct rt6_info *rt6_add_route_info(struct net *net, | 1790 | static struct rt6_info *rt6_add_route_info(struct net *net, |
1791 | struct in6_addr *prefix, int prefixlen, | 1791 | const struct in6_addr *prefix, int prefixlen, |
1792 | struct in6_addr *gwaddr, int ifindex, | 1792 | const struct in6_addr *gwaddr, int ifindex, |
1793 | unsigned pref) | 1793 | unsigned pref) |
1794 | { | 1794 | { |
1795 | struct fib6_config cfg = { | 1795 | struct fib6_config cfg = { |
@@ -1817,7 +1817,7 @@ static struct rt6_info *rt6_add_route_info(struct net *net, | |||
1817 | } | 1817 | } |
1818 | #endif | 1818 | #endif |
1819 | 1819 | ||
1820 | struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *dev) | 1820 | struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_device *dev) |
1821 | { | 1821 | { |
1822 | struct rt6_info *rt; | 1822 | struct rt6_info *rt; |
1823 | struct fib6_table *table; | 1823 | struct fib6_table *table; |
@@ -1839,7 +1839,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d | |||
1839 | return rt; | 1839 | return rt; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, | 1842 | struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr, |
1843 | struct net_device *dev, | 1843 | struct net_device *dev, |
1844 | unsigned int pref) | 1844 | unsigned int pref) |
1845 | { | 1845 | { |
@@ -2049,7 +2049,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2049 | 2049 | ||
2050 | int ip6_route_get_saddr(struct net *net, | 2050 | int ip6_route_get_saddr(struct net *net, |
2051 | struct rt6_info *rt, | 2051 | struct rt6_info *rt, |
2052 | struct in6_addr *daddr, | 2052 | const struct in6_addr *daddr, |
2053 | unsigned int prefs, | 2053 | unsigned int prefs, |
2054 | struct in6_addr *saddr) | 2054 | struct in6_addr *saddr) |
2055 | { | 2055 | { |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 43b33373adb2..34d896426701 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -452,7 +452,7 @@ out: | |||
452 | } | 452 | } |
453 | 453 | ||
454 | static int | 454 | static int |
455 | isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t) | 455 | isatap_chksrc(struct sk_buff *skb, const struct iphdr *iph, struct ip_tunnel *t) |
456 | { | 456 | { |
457 | struct ip_tunnel_prl_entry *p; | 457 | struct ip_tunnel_prl_entry *p; |
458 | int ok = 1; | 458 | int ok = 1; |
@@ -465,7 +465,8 @@ isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t) | |||
465 | else | 465 | else |
466 | skb->ndisc_nodetype = NDISC_NODETYPE_NODEFAULT; | 466 | skb->ndisc_nodetype = NDISC_NODETYPE_NODEFAULT; |
467 | } else { | 467 | } else { |
468 | struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; | 468 | const struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; |
469 | |||
469 | if (ipv6_addr_is_isatap(addr6) && | 470 | if (ipv6_addr_is_isatap(addr6) && |
470 | (addr6->s6_addr32[3] == iph->saddr) && | 471 | (addr6->s6_addr32[3] == iph->saddr) && |
471 | ipv6_chk_prefix(addr6, t->dev)) | 472 | ipv6_chk_prefix(addr6, t->dev)) |
@@ -499,7 +500,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info) | |||
499 | 8 bytes of packet payload. It means, that precise relaying of | 500 | 8 bytes of packet payload. It means, that precise relaying of |
500 | ICMP in the real Internet is absolutely infeasible. | 501 | ICMP in the real Internet is absolutely infeasible. |
501 | */ | 502 | */ |
502 | struct iphdr *iph = (struct iphdr*)skb->data; | 503 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
503 | const int type = icmp_hdr(skb)->type; | 504 | const int type = icmp_hdr(skb)->type; |
504 | const int code = icmp_hdr(skb)->code; | 505 | const int code = icmp_hdr(skb)->code; |
505 | struct ip_tunnel *t; | 506 | struct ip_tunnel *t; |
@@ -557,7 +558,7 @@ out: | |||
557 | return err; | 558 | return err; |
558 | } | 559 | } |
559 | 560 | ||
560 | static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | 561 | static inline void ipip6_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb) |
561 | { | 562 | { |
562 | if (INET_ECN_is_ce(iph->tos)) | 563 | if (INET_ECN_is_ce(iph->tos)) |
563 | IP6_ECN_set_ce(ipv6_hdr(skb)); | 564 | IP6_ECN_set_ce(ipv6_hdr(skb)); |
@@ -565,7 +566,7 @@ static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) | |||
565 | 566 | ||
566 | static int ipip6_rcv(struct sk_buff *skb) | 567 | static int ipip6_rcv(struct sk_buff *skb) |
567 | { | 568 | { |
568 | struct iphdr *iph; | 569 | const struct iphdr *iph; |
569 | struct ip_tunnel *tunnel; | 570 | struct ip_tunnel *tunnel; |
570 | 571 | ||
571 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) | 572 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) |
@@ -621,7 +622,7 @@ out: | |||
621 | * comes from 6rd / 6to4 (RFC 3056) addr space. | 622 | * comes from 6rd / 6to4 (RFC 3056) addr space. |
622 | */ | 623 | */ |
623 | static inline | 624 | static inline |
624 | __be32 try_6rd(struct in6_addr *v6dst, struct ip_tunnel *tunnel) | 625 | __be32 try_6rd(const struct in6_addr *v6dst, struct ip_tunnel *tunnel) |
625 | { | 626 | { |
626 | __be32 dst = 0; | 627 | __be32 dst = 0; |
627 | 628 | ||
@@ -664,8 +665,8 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
664 | { | 665 | { |
665 | struct ip_tunnel *tunnel = netdev_priv(dev); | 666 | struct ip_tunnel *tunnel = netdev_priv(dev); |
666 | struct pcpu_tstats *tstats; | 667 | struct pcpu_tstats *tstats; |
667 | struct iphdr *tiph = &tunnel->parms.iph; | 668 | const struct iphdr *tiph = &tunnel->parms.iph; |
668 | struct ipv6hdr *iph6 = ipv6_hdr(skb); | 669 | const struct ipv6hdr *iph6 = ipv6_hdr(skb); |
669 | u8 tos = tunnel->parms.iph.tos; | 670 | u8 tos = tunnel->parms.iph.tos; |
670 | __be16 df = tiph->frag_off; | 671 | __be16 df = tiph->frag_off; |
671 | struct rtable *rt; /* Route to the other host */ | 672 | struct rtable *rt; /* Route to the other host */ |
@@ -674,7 +675,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
674 | unsigned int max_headroom; /* The extra header space needed */ | 675 | unsigned int max_headroom; /* The extra header space needed */ |
675 | __be32 dst = tiph->daddr; | 676 | __be32 dst = tiph->daddr; |
676 | int mtu; | 677 | int mtu; |
677 | struct in6_addr *addr6; | 678 | const struct in6_addr *addr6; |
678 | int addr_type; | 679 | int addr_type; |
679 | 680 | ||
680 | if (skb->protocol != htons(ETH_P_IPV6)) | 681 | if (skb->protocol != htons(ETH_P_IPV6)) |
@@ -693,7 +694,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
693 | goto tx_error; | 694 | goto tx_error; |
694 | } | 695 | } |
695 | 696 | ||
696 | addr6 = (struct in6_addr*)&neigh->primary_key; | 697 | addr6 = (const struct in6_addr*)&neigh->primary_key; |
697 | addr_type = ipv6_addr_type(addr6); | 698 | addr_type = ipv6_addr_type(addr6); |
698 | 699 | ||
699 | if ((addr_type & IPV6_ADDR_UNICAST) && | 700 | if ((addr_type & IPV6_ADDR_UNICAST) && |
@@ -718,7 +719,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
718 | goto tx_error; | 719 | goto tx_error; |
719 | } | 720 | } |
720 | 721 | ||
721 | addr6 = (struct in6_addr*)&neigh->primary_key; | 722 | addr6 = (const struct in6_addr*)&neigh->primary_key; |
722 | addr_type = ipv6_addr_type(addr6); | 723 | addr_type = ipv6_addr_type(addr6); |
723 | 724 | ||
724 | if (addr_type == IPV6_ADDR_ANY) { | 725 | if (addr_type == IPV6_ADDR_ANY) { |
@@ -849,7 +850,7 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) | |||
849 | { | 850 | { |
850 | struct net_device *tdev = NULL; | 851 | struct net_device *tdev = NULL; |
851 | struct ip_tunnel *tunnel; | 852 | struct ip_tunnel *tunnel; |
852 | struct iphdr *iph; | 853 | const struct iphdr *iph; |
853 | 854 | ||
854 | tunnel = netdev_priv(dev); | 855 | tunnel = netdev_priv(dev); |
855 | iph = &tunnel->parms.iph; | 856 | iph = &tunnel->parms.iph; |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 352c26081f5d..8b9644a8b697 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -66,7 +66,7 @@ static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb, | |||
66 | static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], | 66 | static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], |
67 | ipv6_cookie_scratch); | 67 | ipv6_cookie_scratch); |
68 | 68 | ||
69 | static u32 cookie_hash(struct in6_addr *saddr, struct in6_addr *daddr, | 69 | static u32 cookie_hash(const struct in6_addr *saddr, const struct in6_addr *daddr, |
70 | __be16 sport, __be16 dport, u32 count, int c) | 70 | __be16 sport, __be16 dport, u32 count, int c) |
71 | { | 71 | { |
72 | __u32 *tmp = __get_cpu_var(ipv6_cookie_scratch); | 72 | __u32 *tmp = __get_cpu_var(ipv6_cookie_scratch); |
@@ -86,7 +86,8 @@ static u32 cookie_hash(struct in6_addr *saddr, struct in6_addr *daddr, | |||
86 | return tmp[17]; | 86 | return tmp[17]; |
87 | } | 87 | } |
88 | 88 | ||
89 | static __u32 secure_tcp_syn_cookie(struct in6_addr *saddr, struct in6_addr *daddr, | 89 | static __u32 secure_tcp_syn_cookie(const struct in6_addr *saddr, |
90 | const struct in6_addr *daddr, | ||
90 | __be16 sport, __be16 dport, __u32 sseq, | 91 | __be16 sport, __be16 dport, __u32 sseq, |
91 | __u32 count, __u32 data) | 92 | __u32 count, __u32 data) |
92 | { | 93 | { |
@@ -96,8 +97,8 @@ static __u32 secure_tcp_syn_cookie(struct in6_addr *saddr, struct in6_addr *dadd | |||
96 | & COOKIEMASK)); | 97 | & COOKIEMASK)); |
97 | } | 98 | } |
98 | 99 | ||
99 | static __u32 check_tcp_syn_cookie(__u32 cookie, struct in6_addr *saddr, | 100 | static __u32 check_tcp_syn_cookie(__u32 cookie, const struct in6_addr *saddr, |
100 | struct in6_addr *daddr, __be16 sport, | 101 | const struct in6_addr *daddr, __be16 sport, |
101 | __be16 dport, __u32 sseq, __u32 count, | 102 | __be16 dport, __u32 sseq, __u32 count, |
102 | __u32 maxdiff) | 103 | __u32 maxdiff) |
103 | { | 104 | { |
@@ -116,7 +117,7 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, struct in6_addr *saddr, | |||
116 | 117 | ||
117 | __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | 118 | __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) |
118 | { | 119 | { |
119 | struct ipv6hdr *iph = ipv6_hdr(skb); | 120 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
120 | const struct tcphdr *th = tcp_hdr(skb); | 121 | const struct tcphdr *th = tcp_hdr(skb); |
121 | int mssind; | 122 | int mssind; |
122 | const __u16 mss = *mssp; | 123 | const __u16 mss = *mssp; |
@@ -138,7 +139,7 @@ __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp) | |||
138 | 139 | ||
139 | static inline int cookie_check(struct sk_buff *skb, __u32 cookie) | 140 | static inline int cookie_check(struct sk_buff *skb, __u32 cookie) |
140 | { | 141 | { |
141 | struct ipv6hdr *iph = ipv6_hdr(skb); | 142 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
142 | const struct tcphdr *th = tcp_hdr(skb); | 143 | const struct tcphdr *th = tcp_hdr(skb); |
143 | __u32 seq = ntohl(th->seq) - 1; | 144 | __u32 seq = ntohl(th->seq) - 1; |
144 | __u32 mssind = check_tcp_syn_cookie(cookie, &iph->saddr, &iph->daddr, | 145 | __u32 mssind = check_tcp_syn_cookie(cookie, &iph->saddr, &iph->daddr, |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 4f49e5dd41bb..cb7658aceb6c 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -76,8 +76,8 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
76 | 76 | ||
77 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); | 77 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
78 | static void __tcp_v6_send_check(struct sk_buff *skb, | 78 | static void __tcp_v6_send_check(struct sk_buff *skb, |
79 | struct in6_addr *saddr, | 79 | const struct in6_addr *saddr, |
80 | struct in6_addr *daddr); | 80 | const struct in6_addr *daddr); |
81 | 81 | ||
82 | static const struct inet_connection_sock_af_ops ipv6_mapped; | 82 | static const struct inet_connection_sock_af_ops ipv6_mapped; |
83 | static const struct inet_connection_sock_af_ops ipv6_specific; | 83 | static const struct inet_connection_sock_af_ops ipv6_specific; |
@@ -86,7 +86,7 @@ static const struct tcp_sock_af_ops tcp_sock_ipv6_specific; | |||
86 | static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; | 86 | static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; |
87 | #else | 87 | #else |
88 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, | 88 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, |
89 | struct in6_addr *addr) | 89 | const struct in6_addr *addr) |
90 | { | 90 | { |
91 | return NULL; | 91 | return NULL; |
92 | } | 92 | } |
@@ -106,8 +106,8 @@ static void tcp_v6_hash(struct sock *sk) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | static __inline__ __sum16 tcp_v6_check(int len, | 108 | static __inline__ __sum16 tcp_v6_check(int len, |
109 | struct in6_addr *saddr, | 109 | const struct in6_addr *saddr, |
110 | struct in6_addr *daddr, | 110 | const struct in6_addr *daddr, |
111 | __wsum base) | 111 | __wsum base) |
112 | { | 112 | { |
113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); | 113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); |
@@ -331,7 +331,7 @@ failure: | |||
331 | static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 331 | static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
332 | u8 type, u8 code, int offset, __be32 info) | 332 | u8 type, u8 code, int offset, __be32 info) |
333 | { | 333 | { |
334 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; | 334 | const struct ipv6hdr *hdr = (const struct ipv6hdr*)skb->data; |
335 | const struct tcphdr *th = (struct tcphdr *)(skb->data+offset); | 335 | const struct tcphdr *th = (struct tcphdr *)(skb->data+offset); |
336 | struct ipv6_pinfo *np; | 336 | struct ipv6_pinfo *np; |
337 | struct sock *sk; | 337 | struct sock *sk; |
@@ -551,7 +551,7 @@ static void tcp_v6_reqsk_destructor(struct request_sock *req) | |||
551 | 551 | ||
552 | #ifdef CONFIG_TCP_MD5SIG | 552 | #ifdef CONFIG_TCP_MD5SIG |
553 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, | 553 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, |
554 | struct in6_addr *addr) | 554 | const struct in6_addr *addr) |
555 | { | 555 | { |
556 | struct tcp_sock *tp = tcp_sk(sk); | 556 | struct tcp_sock *tp = tcp_sk(sk); |
557 | int i; | 557 | int i; |
@@ -580,7 +580,7 @@ static struct tcp_md5sig_key *tcp_v6_reqsk_md5_lookup(struct sock *sk, | |||
580 | return tcp_v6_md5_do_lookup(sk, &inet6_rsk(req)->rmt_addr); | 580 | return tcp_v6_md5_do_lookup(sk, &inet6_rsk(req)->rmt_addr); |
581 | } | 581 | } |
582 | 582 | ||
583 | static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer, | 583 | static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer, |
584 | char *newkey, u8 newkeylen) | 584 | char *newkey, u8 newkeylen) |
585 | { | 585 | { |
586 | /* Add key to the list */ | 586 | /* Add key to the list */ |
@@ -645,7 +645,7 @@ static int tcp_v6_md5_add_func(struct sock *sk, struct sock *addr_sk, | |||
645 | newkey, newkeylen); | 645 | newkey, newkeylen); |
646 | } | 646 | } |
647 | 647 | ||
648 | static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer) | 648 | static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer) |
649 | { | 649 | { |
650 | struct tcp_sock *tp = tcp_sk(sk); | 650 | struct tcp_sock *tp = tcp_sk(sk); |
651 | int i; | 651 | int i; |
@@ -753,8 +753,8 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval, | |||
753 | } | 753 | } |
754 | 754 | ||
755 | static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | 755 | static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, |
756 | struct in6_addr *daddr, | 756 | const struct in6_addr *daddr, |
757 | struct in6_addr *saddr, int nbytes) | 757 | const struct in6_addr *saddr, int nbytes) |
758 | { | 758 | { |
759 | struct tcp6_pseudohdr *bp; | 759 | struct tcp6_pseudohdr *bp; |
760 | struct scatterlist sg; | 760 | struct scatterlist sg; |
@@ -771,7 +771,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
771 | } | 771 | } |
772 | 772 | ||
773 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 773 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
774 | struct in6_addr *daddr, struct in6_addr *saddr, | 774 | const struct in6_addr *daddr, struct in6_addr *saddr, |
775 | struct tcphdr *th) | 775 | struct tcphdr *th) |
776 | { | 776 | { |
777 | struct tcp_md5sig_pool *hp; | 777 | struct tcp_md5sig_pool *hp; |
@@ -807,7 +807,7 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
807 | struct sock *sk, struct request_sock *req, | 807 | struct sock *sk, struct request_sock *req, |
808 | struct sk_buff *skb) | 808 | struct sk_buff *skb) |
809 | { | 809 | { |
810 | struct in6_addr *saddr, *daddr; | 810 | const struct in6_addr *saddr, *daddr; |
811 | struct tcp_md5sig_pool *hp; | 811 | struct tcp_md5sig_pool *hp; |
812 | struct hash_desc *desc; | 812 | struct hash_desc *desc; |
813 | struct tcphdr *th = tcp_hdr(skb); | 813 | struct tcphdr *th = tcp_hdr(skb); |
@@ -819,7 +819,7 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
819 | saddr = &inet6_rsk(req)->loc_addr; | 819 | saddr = &inet6_rsk(req)->loc_addr; |
820 | daddr = &inet6_rsk(req)->rmt_addr; | 820 | daddr = &inet6_rsk(req)->rmt_addr; |
821 | } else { | 821 | } else { |
822 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 822 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
823 | saddr = &ip6h->saddr; | 823 | saddr = &ip6h->saddr; |
824 | daddr = &ip6h->daddr; | 824 | daddr = &ip6h->daddr; |
825 | } | 825 | } |
@@ -857,7 +857,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | |||
857 | { | 857 | { |
858 | __u8 *hash_location = NULL; | 858 | __u8 *hash_location = NULL; |
859 | struct tcp_md5sig_key *hash_expected; | 859 | struct tcp_md5sig_key *hash_expected; |
860 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 860 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
861 | struct tcphdr *th = tcp_hdr(skb); | 861 | struct tcphdr *th = tcp_hdr(skb); |
862 | int genhash; | 862 | int genhash; |
863 | u8 newhash[16]; | 863 | u8 newhash[16]; |
@@ -915,7 +915,7 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { | |||
915 | #endif | 915 | #endif |
916 | 916 | ||
917 | static void __tcp_v6_send_check(struct sk_buff *skb, | 917 | static void __tcp_v6_send_check(struct sk_buff *skb, |
918 | struct in6_addr *saddr, struct in6_addr *daddr) | 918 | const struct in6_addr *saddr, const struct in6_addr *daddr) |
919 | { | 919 | { |
920 | struct tcphdr *th = tcp_hdr(skb); | 920 | struct tcphdr *th = tcp_hdr(skb); |
921 | 921 | ||
@@ -939,7 +939,7 @@ static void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) | |||
939 | 939 | ||
940 | static int tcp_v6_gso_send_check(struct sk_buff *skb) | 940 | static int tcp_v6_gso_send_check(struct sk_buff *skb) |
941 | { | 941 | { |
942 | struct ipv6hdr *ipv6h; | 942 | const struct ipv6hdr *ipv6h; |
943 | struct tcphdr *th; | 943 | struct tcphdr *th; |
944 | 944 | ||
945 | if (!pskb_may_pull(skb, sizeof(*th))) | 945 | if (!pskb_may_pull(skb, sizeof(*th))) |
@@ -957,7 +957,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
957 | static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, | 957 | static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, |
958 | struct sk_buff *skb) | 958 | struct sk_buff *skb) |
959 | { | 959 | { |
960 | struct ipv6hdr *iph = skb_gro_network_header(skb); | 960 | const struct ipv6hdr *iph = skb_gro_network_header(skb); |
961 | 961 | ||
962 | switch (skb->ip_summed) { | 962 | switch (skb->ip_summed) { |
963 | case CHECKSUM_COMPLETE: | 963 | case CHECKSUM_COMPLETE: |
@@ -978,7 +978,7 @@ static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, | |||
978 | 978 | ||
979 | static int tcp6_gro_complete(struct sk_buff *skb) | 979 | static int tcp6_gro_complete(struct sk_buff *skb) |
980 | { | 980 | { |
981 | struct ipv6hdr *iph = ipv6_hdr(skb); | 981 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
982 | struct tcphdr *th = tcp_hdr(skb); | 982 | struct tcphdr *th = tcp_hdr(skb); |
983 | 983 | ||
984 | th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb), | 984 | th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb), |
@@ -1702,7 +1702,7 @@ ipv6_pktoptions: | |||
1702 | static int tcp_v6_rcv(struct sk_buff *skb) | 1702 | static int tcp_v6_rcv(struct sk_buff *skb) |
1703 | { | 1703 | { |
1704 | struct tcphdr *th; | 1704 | struct tcphdr *th; |
1705 | struct ipv6hdr *hdr; | 1705 | const struct ipv6hdr *hdr; |
1706 | struct sock *sk; | 1706 | struct sock *sk; |
1707 | int ret; | 1707 | int ret; |
1708 | struct net *net = dev_net(skb->dev); | 1708 | struct net *net = dev_net(skb->dev); |
@@ -2028,8 +2028,8 @@ static void get_openreq6(struct seq_file *seq, | |||
2028 | struct sock *sk, struct request_sock *req, int i, int uid) | 2028 | struct sock *sk, struct request_sock *req, int i, int uid) |
2029 | { | 2029 | { |
2030 | int ttd = req->expires - jiffies; | 2030 | int ttd = req->expires - jiffies; |
2031 | struct in6_addr *src = &inet6_rsk(req)->loc_addr; | 2031 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; |
2032 | struct in6_addr *dest = &inet6_rsk(req)->rmt_addr; | 2032 | const struct in6_addr *dest = &inet6_rsk(req)->rmt_addr; |
2033 | 2033 | ||
2034 | if (ttd < 0) | 2034 | if (ttd < 0) |
2035 | ttd = 0; | 2035 | ttd = 0; |
@@ -2057,7 +2057,7 @@ static void get_openreq6(struct seq_file *seq, | |||
2057 | 2057 | ||
2058 | static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | 2058 | static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) |
2059 | { | 2059 | { |
2060 | struct in6_addr *dest, *src; | 2060 | const struct in6_addr *dest, *src; |
2061 | __u16 destp, srcp; | 2061 | __u16 destp, srcp; |
2062 | int timer_active; | 2062 | int timer_active; |
2063 | unsigned long timer_expires; | 2063 | unsigned long timer_expires; |
@@ -2114,7 +2114,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
2114 | static void get_timewait6_sock(struct seq_file *seq, | 2114 | static void get_timewait6_sock(struct seq_file *seq, |
2115 | struct inet_timewait_sock *tw, int i) | 2115 | struct inet_timewait_sock *tw, int i) |
2116 | { | 2116 | { |
2117 | struct in6_addr *dest, *src; | 2117 | const struct in6_addr *dest, *src; |
2118 | __u16 destp, srcp; | 2118 | __u16 destp, srcp; |
2119 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); | 2119 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
2120 | int ttd = tw->tw_ttd - jiffies; | 2120 | int ttd = tw->tw_ttd - jiffies; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 15c37746845e..1bdc5f053db8 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -311,7 +311,7 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, | |||
311 | struct udp_table *udptable) | 311 | struct udp_table *udptable) |
312 | { | 312 | { |
313 | struct sock *sk; | 313 | struct sock *sk; |
314 | struct ipv6hdr *iph = ipv6_hdr(skb); | 314 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
315 | 315 | ||
316 | if (unlikely(sk = skb_steal_sock(skb))) | 316 | if (unlikely(sk = skb_steal_sock(skb))) |
317 | return sk; | 317 | return sk; |
@@ -463,9 +463,9 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
463 | struct udp_table *udptable) | 463 | struct udp_table *udptable) |
464 | { | 464 | { |
465 | struct ipv6_pinfo *np; | 465 | struct ipv6_pinfo *np; |
466 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; | 466 | const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; |
467 | struct in6_addr *saddr = &hdr->saddr; | 467 | const struct in6_addr *saddr = &hdr->saddr; |
468 | struct in6_addr *daddr = &hdr->daddr; | 468 | const struct in6_addr *daddr = &hdr->daddr; |
469 | struct udphdr *uh = (struct udphdr*)(skb->data+offset); | 469 | struct udphdr *uh = (struct udphdr*)(skb->data+offset); |
470 | struct sock *sk; | 470 | struct sock *sk; |
471 | int err; | 471 | int err; |
@@ -553,8 +553,8 @@ drop_no_sk_drops_inc: | |||
553 | } | 553 | } |
554 | 554 | ||
555 | static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, | 555 | static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, |
556 | __be16 loc_port, struct in6_addr *loc_addr, | 556 | __be16 loc_port, const struct in6_addr *loc_addr, |
557 | __be16 rmt_port, struct in6_addr *rmt_addr, | 557 | __be16 rmt_port, const struct in6_addr *rmt_addr, |
558 | int dif) | 558 | int dif) |
559 | { | 559 | { |
560 | struct hlist_nulls_node *node; | 560 | struct hlist_nulls_node *node; |
@@ -633,7 +633,7 @@ drop: | |||
633 | * so we don't need to lock the hashes. | 633 | * so we don't need to lock the hashes. |
634 | */ | 634 | */ |
635 | static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | 635 | static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, |
636 | struct in6_addr *saddr, struct in6_addr *daddr, | 636 | const struct in6_addr *saddr, const struct in6_addr *daddr, |
637 | struct udp_table *udptable) | 637 | struct udp_table *udptable) |
638 | { | 638 | { |
639 | struct sock *sk, *stack[256 / sizeof(struct sock *)]; | 639 | struct sock *sk, *stack[256 / sizeof(struct sock *)]; |
@@ -716,7 +716,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
716 | struct net *net = dev_net(skb->dev); | 716 | struct net *net = dev_net(skb->dev); |
717 | struct sock *sk; | 717 | struct sock *sk; |
718 | struct udphdr *uh; | 718 | struct udphdr *uh; |
719 | struct in6_addr *saddr, *daddr; | 719 | const struct in6_addr *saddr, *daddr; |
720 | u32 ulen = 0; | 720 | u32 ulen = 0; |
721 | 721 | ||
722 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) | 722 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) |
@@ -1278,7 +1278,7 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, | |||
1278 | 1278 | ||
1279 | static int udp6_ufo_send_check(struct sk_buff *skb) | 1279 | static int udp6_ufo_send_check(struct sk_buff *skb) |
1280 | { | 1280 | { |
1281 | struct ipv6hdr *ipv6h; | 1281 | const struct ipv6hdr *ipv6h; |
1282 | struct udphdr *uh; | 1282 | struct udphdr *uh; |
1283 | 1283 | ||
1284 | if (!pskb_may_pull(skb, sizeof(*uh))) | 1284 | if (!pskb_may_pull(skb, sizeof(*uh))) |
@@ -1382,7 +1382,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
1382 | { | 1382 | { |
1383 | struct inet_sock *inet = inet_sk(sp); | 1383 | struct inet_sock *inet = inet_sk(sp); |
1384 | struct ipv6_pinfo *np = inet6_sk(sp); | 1384 | struct ipv6_pinfo *np = inet6_sk(sp); |
1385 | struct in6_addr *dest, *src; | 1385 | const struct in6_addr *dest, *src; |
1386 | __u16 destp, srcp; | 1386 | __u16 destp, srcp; |
1387 | 1387 | ||
1388 | dest = &np->daddr; | 1388 | dest = &np->daddr; |
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index bbd48b101bae..3437d7d4eed6 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -41,10 +41,8 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
41 | { | 41 | { |
42 | struct ipv6hdr *top_iph; | 42 | struct ipv6hdr *top_iph; |
43 | struct ip_beet_phdr *ph; | 43 | struct ip_beet_phdr *ph; |
44 | struct iphdr *iphv4; | ||
45 | int optlen, hdr_len; | 44 | int optlen, hdr_len; |
46 | 45 | ||
47 | iphv4 = ip_hdr(skb); | ||
48 | hdr_len = 0; | 46 | hdr_len = 0; |
49 | optlen = XFRM_MODE_SKB_CB(skb)->optlen; | 47 | optlen = XFRM_MODE_SKB_CB(skb)->optlen; |
50 | if (unlikely(optlen)) | 48 | if (unlikely(optlen)) |
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 645cb968d450..4d6edff0498f 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) | 21 | static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) |
22 | { | 22 | { |
23 | struct ipv6hdr *outer_iph = ipv6_hdr(skb); | 23 | const struct ipv6hdr *outer_iph = ipv6_hdr(skb); |
24 | struct ipv6hdr *inner_iph = ipipv6_hdr(skb); | 24 | struct ipv6hdr *inner_iph = ipipv6_hdr(skb); |
25 | 25 | ||
26 | if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) | 26 | if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) |
@@ -55,8 +55,8 @@ static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
55 | dsfield &= ~INET_ECN_MASK; | 55 | dsfield &= ~INET_ECN_MASK; |
56 | ipv6_change_dsfield(top_iph, 0, dsfield); | 56 | ipv6_change_dsfield(top_iph, 0, dsfield); |
57 | top_iph->hop_limit = ip6_dst_hoplimit(dst->child); | 57 | top_iph->hop_limit = ip6_dst_hoplimit(dst->child); |
58 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); | 58 | ipv6_addr_copy(&top_iph->saddr, (const struct in6_addr *)&x->props.saddr); |
59 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); | 59 | ipv6_addr_copy(&top_iph->daddr, (const struct in6_addr *)&x->id.daddr); |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 05e34c8ec913..d879f7efbd10 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -124,7 +124,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
124 | struct flowi6 *fl6 = &fl->u.ip6; | 124 | struct flowi6 *fl6 = &fl->u.ip6; |
125 | int onlyproto = 0; | 125 | int onlyproto = 0; |
126 | u16 offset = skb_network_header_len(skb); | 126 | u16 offset = skb_network_header_len(skb); |
127 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 127 | const struct ipv6hdr *hdr = ipv6_hdr(skb); |
128 | struct ipv6_opt_hdr *exthdr; | 128 | struct ipv6_opt_hdr *exthdr; |
129 | const unsigned char *nh = skb_network_header(skb); | 129 | const unsigned char *nh = skb_network_header(skb); |
130 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; | 130 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 2969cad408de..a6770a04e3bd 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -68,7 +68,7 @@ static DEFINE_SPINLOCK(xfrm6_tunnel_spi_lock); | |||
68 | 68 | ||
69 | static struct kmem_cache *xfrm6_tunnel_spi_kmem __read_mostly; | 69 | static struct kmem_cache *xfrm6_tunnel_spi_kmem __read_mostly; |
70 | 70 | ||
71 | static inline unsigned xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr) | 71 | static inline unsigned xfrm6_tunnel_spi_hash_byaddr(const xfrm_address_t *addr) |
72 | { | 72 | { |
73 | unsigned h; | 73 | unsigned h; |
74 | 74 | ||
@@ -85,7 +85,7 @@ static inline unsigned xfrm6_tunnel_spi_hash_byspi(u32 spi) | |||
85 | return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; | 85 | return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; |
86 | } | 86 | } |
87 | 87 | ||
88 | static struct xfrm6_tunnel_spi *__xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr) | 88 | static struct xfrm6_tunnel_spi *__xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr) |
89 | { | 89 | { |
90 | struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); | 90 | struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); |
91 | struct xfrm6_tunnel_spi *x6spi; | 91 | struct xfrm6_tunnel_spi *x6spi; |
@@ -101,7 +101,7 @@ static struct xfrm6_tunnel_spi *__xfrm6_tunnel_spi_lookup(struct net *net, xfrm_ | |||
101 | return NULL; | 101 | return NULL; |
102 | } | 102 | } |
103 | 103 | ||
104 | __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr) | 104 | __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr) |
105 | { | 105 | { |
106 | struct xfrm6_tunnel_spi *x6spi; | 106 | struct xfrm6_tunnel_spi *x6spi; |
107 | u32 spi; | 107 | u32 spi; |
@@ -237,10 +237,10 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
237 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) | 237 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) |
238 | { | 238 | { |
239 | struct net *net = dev_net(skb->dev); | 239 | struct net *net = dev_net(skb->dev); |
240 | struct ipv6hdr *iph = ipv6_hdr(skb); | 240 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
241 | __be32 spi; | 241 | __be32 spi; |
242 | 242 | ||
243 | spi = xfrm6_tunnel_spi_lookup(net, (xfrm_address_t *)&iph->saddr); | 243 | spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); |
244 | return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? : 0; | 244 | return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? : 0; |
245 | } | 245 | } |
246 | 246 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index 7db86ffcf070..d62401c25684 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -712,7 +712,7 @@ static unsigned int pfkey_sockaddr_fill(const xfrm_address_t *xaddr, __be16 port | |||
712 | sin6->sin6_family = AF_INET6; | 712 | sin6->sin6_family = AF_INET6; |
713 | sin6->sin6_port = port; | 713 | sin6->sin6_port = port; |
714 | sin6->sin6_flowinfo = 0; | 714 | sin6->sin6_flowinfo = 0; |
715 | ipv6_addr_copy(&sin6->sin6_addr, (struct in6_addr *)xaddr->a6); | 715 | ipv6_addr_copy(&sin6->sin6_addr, (const struct in6_addr *)xaddr->a6); |
716 | sin6->sin6_scope_id = 0; | 716 | sin6->sin6_scope_id = 0; |
717 | return 128; | 717 | return 128; |
718 | } | 718 | } |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index c2e628dfaacc..7ef87f9eb675 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -169,7 +169,7 @@ static unsigned int sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
169 | } | 169 | } |
170 | case htons(ETH_P_IPV6): | 170 | case htons(ETH_P_IPV6): |
171 | { | 171 | { |
172 | struct ipv6hdr *iph; | 172 | const struct ipv6hdr *iph; |
173 | int poff; | 173 | int poff; |
174 | 174 | ||
175 | if (!pskb_network_may_pull(skb, sizeof(*iph))) | 175 | if (!pskb_network_may_pull(skb, sizeof(*iph))) |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 3a8eb79eb78b..741ed1648838 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -565,7 +565,7 @@ void sctp_err_finish(struct sock *sk, struct sctp_association *asoc) | |||
565 | */ | 565 | */ |
566 | void sctp_v4_err(struct sk_buff *skb, __u32 info) | 566 | void sctp_v4_err(struct sk_buff *skb, __u32 info) |
567 | { | 567 | { |
568 | struct iphdr *iph = (struct iphdr *)skb->data; | 568 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
569 | const int ihlen = iph->ihl * 4; | 569 | const int ihlen = iph->ihl * 4; |
570 | const int type = icmp_hdr(skb)->type; | 570 | const int type = icmp_hdr(skb)->type; |
571 | const int code = icmp_hdr(skb)->code; | 571 | const int code = icmp_hdr(skb)->code; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 865ce7ba4e14..321f175055bf 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -531,7 +531,7 @@ static int sctp_v6_is_any(const union sctp_addr *addr) | |||
531 | static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) | 531 | static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) |
532 | { | 532 | { |
533 | int type; | 533 | int type; |
534 | struct in6_addr *in6 = (struct in6_addr *)&addr->v6.sin6_addr; | 534 | const struct in6_addr *in6 = (const struct in6_addr *)&addr->v6.sin6_addr; |
535 | 535 | ||
536 | type = ipv6_addr_type(in6); | 536 | type = ipv6_addr_type(in6); |
537 | if (IPV6_ADDR_ANY == type) | 537 | if (IPV6_ADDR_ANY == type) |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index dd78536d40de..d70f85eb7864 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1036,15 +1036,15 @@ static struct xfrm_state *__find_acq_core(struct net *net, struct xfrm_mark *m, | |||
1036 | 1036 | ||
1037 | case AF_INET6: | 1037 | case AF_INET6: |
1038 | ipv6_addr_copy((struct in6_addr *)x->sel.daddr.a6, | 1038 | ipv6_addr_copy((struct in6_addr *)x->sel.daddr.a6, |
1039 | (struct in6_addr *)daddr); | 1039 | (const struct in6_addr *)daddr); |
1040 | ipv6_addr_copy((struct in6_addr *)x->sel.saddr.a6, | 1040 | ipv6_addr_copy((struct in6_addr *)x->sel.saddr.a6, |
1041 | (struct in6_addr *)saddr); | 1041 | (const struct in6_addr *)saddr); |
1042 | x->sel.prefixlen_d = 128; | 1042 | x->sel.prefixlen_d = 128; |
1043 | x->sel.prefixlen_s = 128; | 1043 | x->sel.prefixlen_s = 128; |
1044 | ipv6_addr_copy((struct in6_addr *)x->props.saddr.a6, | 1044 | ipv6_addr_copy((struct in6_addr *)x->props.saddr.a6, |
1045 | (struct in6_addr *)saddr); | 1045 | (const struct in6_addr *)saddr); |
1046 | ipv6_addr_copy((struct in6_addr *)x->id.daddr.a6, | 1046 | ipv6_addr_copy((struct in6_addr *)x->id.daddr.a6, |
1047 | (struct in6_addr *)daddr); | 1047 | (const struct in6_addr *)daddr); |
1048 | break; | 1048 | break; |
1049 | } | 1049 | } |
1050 | 1050 | ||
@@ -2092,8 +2092,8 @@ static void xfrm_audit_helper_sainfo(struct xfrm_state *x, | |||
2092 | static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, | 2092 | static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, |
2093 | struct audit_buffer *audit_buf) | 2093 | struct audit_buffer *audit_buf) |
2094 | { | 2094 | { |
2095 | struct iphdr *iph4; | 2095 | const struct iphdr *iph4; |
2096 | struct ipv6hdr *iph6; | 2096 | const struct ipv6hdr *iph6; |
2097 | 2097 | ||
2098 | switch (family) { | 2098 | switch (family) { |
2099 | case AF_INET: | 2099 | case AF_INET: |