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/ipv4/icmp.c | |
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/ipv4/icmp.c')
-rw-r--r-- | net/ipv4/icmp.c | 12 |
1 files changed, 6 insertions, 6 deletions
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: |