aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-04-22 00:53:02 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-22 14:04:14 -0400
commitb71d1d426d263b0b6cb5760322efebbfc89d4463 (patch)
tree226ca7390bd6187ec9139d2ccedd26fd94d8e57a /net/ipv6/ip6_tunnel.c
parent5f8629c526b4f7e529a6d27bbd802c0dc7fcc357 (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/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c36
1 files changed, 18 insertions, 18 deletions
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
164static struct ip6_tnl * 164static struct ip6_tnl *
165ip6_tnl_lookup(struct net *net, struct in6_addr *remote, struct in6_addr *local) 165ip6_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
196static struct ip6_tnl __rcu ** 196static struct ip6_tnl __rcu **
197ip6_tnl_bucket(struct ip6_tnl_net *ip6n, struct ip6_tnl_parm *p) 197ip6_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:
321static struct ip6_tnl *ip6_tnl_locate(struct net *net, 321static 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)
374static __u16 374static __u16
375parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) 375parse_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
435ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, 435ip6_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
672static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, 672static 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
685static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, 685static 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
727static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, 727static 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
830static inline int 830static inline int
831ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr) 831ip6_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
1005ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 1005ip4ip6_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;