aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/net/addrconf.h22
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--include/net/inetpeer.h2
-rw-r--r--include/net/ip6_fib.h8
-rw-r--r--include/net/ip6_route.h18
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/ndisc.h3
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/xfrm.h6
9 files changed, 36 insertions, 34 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 23710aa6a181..7c4d92c0dd1d 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -61,16 +61,16 @@ extern int addrconf_set_dstaddr(struct net *net,
61 void __user *arg); 61 void __user *arg);
62 62
63extern int ipv6_chk_addr(struct net *net, 63extern int ipv6_chk_addr(struct net *net,
64 struct in6_addr *addr, 64 const struct in6_addr *addr,
65 struct net_device *dev, 65 struct net_device *dev,
66 int strict); 66 int strict);
67 67
68#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 68#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
69extern int ipv6_chk_home_addr(struct net *net, 69extern int ipv6_chk_home_addr(struct net *net,
70 struct in6_addr *addr); 70 const struct in6_addr *addr);
71#endif 71#endif
72 72
73extern int ipv6_chk_prefix(struct in6_addr *addr, 73extern int ipv6_chk_prefix(const struct in6_addr *addr,
74 struct net_device *dev); 74 struct net_device *dev);
75 75
76extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 76extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
@@ -89,9 +89,9 @@ extern int ipv6_get_lladdr(struct net_device *dev,
89extern int ipv6_rcv_saddr_equal(const struct sock *sk, 89extern int ipv6_rcv_saddr_equal(const struct sock *sk,
90 const struct sock *sk2); 90 const struct sock *sk2);
91extern void addrconf_join_solict(struct net_device *dev, 91extern void addrconf_join_solict(struct net_device *dev,
92 struct in6_addr *addr); 92 const struct in6_addr *addr);
93extern void addrconf_leave_solict(struct inet6_dev *idev, 93extern void addrconf_leave_solict(struct inet6_dev *idev,
94 struct in6_addr *addr); 94 const struct in6_addr *addr);
95 95
96static inline unsigned long addrconf_timeout_fixup(u32 timeout, 96static inline unsigned long addrconf_timeout_fixup(u32 timeout,
97 unsigned unit) 97 unsigned unit)
@@ -158,15 +158,15 @@ extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
158/* 158/*
159 * anycast prototypes (anycast.c) 159 * anycast prototypes (anycast.c)
160 */ 160 */
161extern int ipv6_sock_ac_join(struct sock *sk,int ifindex,struct in6_addr *addr); 161extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr);
162extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex,struct in6_addr *addr); 162extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr);
163extern void ipv6_sock_ac_close(struct sock *sk); 163extern void ipv6_sock_ac_close(struct sock *sk);
164extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); 164extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex);
165 165
166extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); 166extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
167extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); 167extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
168extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 168extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
169 struct in6_addr *addr); 169 const struct in6_addr *addr);
170 170
171 171
172/* Device notifier */ 172/* Device notifier */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index fccc2180c61b..3d982f72d48e 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -196,7 +196,7 @@ struct inet6_dev {
196 struct rcu_head rcu; 196 struct rcu_head rcu;
197}; 197};
198 198
199static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) 199static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf)
200{ 200{
201 /* 201 /*
202 * +-------+-------+-------+-------+-------+-------+ 202 * +-------+-------+-------+-------+-------+-------+
@@ -210,7 +210,7 @@ static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf)
210 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); 210 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
211} 211}
212 212
213static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf) 213static inline void ipv6_tr_mc_map(const struct in6_addr *addr, char *buf)
214{ 214{
215 /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */ 215 /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */
216 216
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index e6dd8da6b2ad..8a159cc3d68b 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -80,7 +80,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
80 return inet_getpeer(&daddr, create); 80 return inet_getpeer(&daddr, create);
81} 81}
82 82
83static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int create) 83static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create)
84{ 84{
85 struct inetpeer_addr daddr; 85 struct inetpeer_addr daddr;
86 86
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 98348d53b2b6..aca8ef4dd67c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -198,12 +198,12 @@ extern struct dst_entry *fib6_rule_lookup(struct net *net,
198 pol_lookup_t lookup); 198 pol_lookup_t lookup);
199 199
200extern struct fib6_node *fib6_lookup(struct fib6_node *root, 200extern struct fib6_node *fib6_lookup(struct fib6_node *root,
201 struct in6_addr *daddr, 201 const struct in6_addr *daddr,
202 struct in6_addr *saddr); 202 const struct in6_addr *saddr);
203 203
204struct fib6_node *fib6_locate(struct fib6_node *root, 204struct fib6_node *fib6_locate(struct fib6_node *root,
205 struct in6_addr *daddr, int dst_len, 205 const struct in6_addr *daddr, int dst_len,
206 struct in6_addr *saddr, int src_len); 206 const struct in6_addr *saddr, int src_len);
207 207
208extern void fib6_clean_all(struct net *net, 208extern void fib6_clean_all(struct net *net,
209 int (*func)(struct rt6_info *, void *arg), 209 int (*func)(struct rt6_info *, void *arg),
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 86b1cb486903..d5c21d4d9e7e 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -86,7 +86,7 @@ extern int ip6_del_rt(struct rt6_info *);
86 86
87extern int ip6_route_get_saddr(struct net *net, 87extern int ip6_route_get_saddr(struct net *net,
88 struct rt6_info *rt, 88 struct rt6_info *rt,
89 struct in6_addr *daddr, 89 const struct in6_addr *daddr,
90 unsigned int prefs, 90 unsigned int prefs,
91 struct in6_addr *saddr); 91 struct in6_addr *saddr);
92 92
@@ -112,9 +112,9 @@ extern int ip6_dst_hoplimit(struct dst_entry *dst);
112 * support functions for ND 112 * support functions for ND
113 * 113 *
114 */ 114 */
115extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr, 115extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr,
116 struct net_device *dev); 116 struct net_device *dev);
117extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr, 117extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr,
118 struct net_device *dev, 118 struct net_device *dev,
119 unsigned int pref); 119 unsigned int pref);
120 120
@@ -122,17 +122,17 @@ extern void rt6_purge_dflt_routers(struct net *net);
122 122
123extern int rt6_route_rcv(struct net_device *dev, 123extern int rt6_route_rcv(struct net_device *dev,
124 u8 *opt, int len, 124 u8 *opt, int len,
125 struct in6_addr *gwaddr); 125 const struct in6_addr *gwaddr);
126 126
127extern void rt6_redirect(struct in6_addr *dest, 127extern void rt6_redirect(const struct in6_addr *dest,
128 struct in6_addr *src, 128 const struct in6_addr *src,
129 struct in6_addr *saddr, 129 const struct in6_addr *saddr,
130 struct neighbour *neigh, 130 struct neighbour *neigh,
131 u8 *lladdr, 131 u8 *lladdr,
132 int on_link); 132 int on_link);
133 133
134extern void rt6_pmtu_discovery(struct in6_addr *daddr, 134extern void rt6_pmtu_discovery(const struct in6_addr *daddr,
135 struct in6_addr *saddr, 135 const struct in6_addr *saddr,
136 struct net_device *dev, 136 struct net_device *dev,
137 u32 pmtu); 137 u32 pmtu);
138 138
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 34200f9e6805..5da192653153 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -376,8 +376,8 @@ enum ip6_defrag_users {
376struct ip6_create_arg { 376struct ip6_create_arg {
377 __be32 id; 377 __be32 id;
378 u32 user; 378 u32 user;
379 struct in6_addr *src; 379 const struct in6_addr *src;
380 struct in6_addr *dst; 380 const struct in6_addr *dst;
381}; 381};
382 382
383void ip6_frag_init(struct inet_frag_queue *q, void *a); 383void ip6_frag_init(struct inet_frag_queue *q, void *a);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index e0e594f8e9d9..6144685d601b 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -102,7 +102,8 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
102 struct neighbour *neigh, 102 struct neighbour *neigh,
103 const struct in6_addr *target); 103 const struct in6_addr *target);
104 104
105extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); 105extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
106 struct net_device *dev, int dir);
106 107
107extern struct sk_buff *ndisc_build_skb(struct net_device *dev, 108extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
108 const struct in6_addr *daddr, 109 const struct in6_addr *daddr,
diff --git a/include/net/route.h b/include/net/route.h
index 3782cddd1383..b3962e249e14 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -191,7 +191,8 @@ static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 s
191 return ip_route_input_common(skb, dst, src, tos, devin, true); 191 return ip_route_input_common(skb, dst, src, tos, devin, true);
192} 192}
193 193
194extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); 194extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
195 unsigned short new_mtu, struct net_device *dev);
195extern void ip_rt_send_redirect(struct sk_buff *skb); 196extern void ip_rt_send_redirect(struct sk_buff *skb);
196 197
197extern unsigned inet_addr_type(struct net *net, __be32 addr); 198extern unsigned inet_addr_type(struct net *net, __be32 addr);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 65ea31348631..1cdd4b7b2861 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1475,7 +1475,7 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1475extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1475extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1476extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1476extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1477extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1477extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1478extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); 1478extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1479extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1479extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1480extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1480extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1481extern int xfrm6_output(struct sk_buff *skb); 1481extern int xfrm6_output(struct sk_buff *skb);
@@ -1569,8 +1569,8 @@ static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1569 case AF_INET: 1569 case AF_INET:
1570 return (__force u32)a->a4 - (__force u32)b->a4; 1570 return (__force u32)a->a4 - (__force u32)b->a4;
1571 case AF_INET6: 1571 case AF_INET6:
1572 return ipv6_addr_cmp((struct in6_addr *)a, 1572 return ipv6_addr_cmp((const struct in6_addr *)a,
1573 (struct in6_addr *)b); 1573 (const struct in6_addr *)b);
1574 } 1574 }
1575} 1575}
1576 1576