Commit b71d1d426d263b0b6cb5760322efebbfc89d4463
Committed by
David S. Miller
1 parent
5f8629c526
Exists in
master
and in
39 other branches
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>
Showing 64 changed files with 316 additions and 310 deletions Side-by-side Diff
- include/net/addrconf.h
- include/net/if_inet6.h
- include/net/inetpeer.h
- include/net/ip6_fib.h
- include/net/ip6_route.h
- include/net/ipv6.h
- include/net/ndisc.h
- include/net/route.h
- include/net/xfrm.h
- net/bridge/br_multicast.c
- net/bridge/br_netfilter.c
- net/core/dev.c
- net/core/netpoll.c
- net/dccp/ipv6.c
- net/ipv4/af_inet.c
- net/ipv4/ah4.c
- net/ipv4/esp4.c
- net/ipv4/icmp.c
- net/ipv4/inet_diag.c
- net/ipv4/inet_lro.c
- net/ipv4/ip_gre.c
- net/ipv4/ip_input.c
- net/ipv4/ip_sockglue.c
- net/ipv4/ipcomp.c
- net/ipv4/ipip.c
- net/ipv4/ipmr.c
- net/ipv4/netfilter/nf_nat_helper.c
- net/ipv4/raw.c
- net/ipv4/route.c
- net/ipv4/tcp_ipv4.c
- net/ipv4/udp.c
- net/ipv4/xfrm4_policy.c
- net/ipv4/xfrm4_state.c
- net/ipv6/addrconf.c
- net/ipv6/af_inet6.c
- net/ipv6/anycast.c
- net/ipv6/esp6.c
- net/ipv6/icmp.c
- net/ipv6/ip6_fib.c
- net/ipv6/ip6_input.c
- net/ipv6/ip6_output.c
- net/ipv6/ip6_tunnel.c
- net/ipv6/ip6mr.c
- net/ipv6/ipcomp6.c
- net/ipv6/mcast.c
- net/ipv6/mip6.c
- net/ipv6/ndisc.c
- net/ipv6/netfilter.c
- net/ipv6/raw.c
- net/ipv6/reassembly.c
- net/ipv6/route.c
- net/ipv6/sit.c
- net/ipv6/syncookies.c
- net/ipv6/tcp_ipv6.c
- net/ipv6/udp.c
- net/ipv6/xfrm6_mode_beet.c
- net/ipv6/xfrm6_mode_tunnel.c
- net/ipv6/xfrm6_policy.c
- net/ipv6/xfrm6_tunnel.c
- net/key/af_key.c
- net/sched/sch_sfq.c
- net/sctp/input.c
- net/sctp/ipv6.c
- net/xfrm/xfrm_state.c
include/net/addrconf.h
... | ... | @@ -61,16 +61,16 @@ |
61 | 61 | void __user *arg); |
62 | 62 | |
63 | 63 | extern int ipv6_chk_addr(struct net *net, |
64 | - struct in6_addr *addr, | |
64 | + const struct in6_addr *addr, | |
65 | 65 | struct net_device *dev, |
66 | 66 | int strict); |
67 | 67 | |
68 | 68 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
69 | 69 | extern int ipv6_chk_home_addr(struct net *net, |
70 | - struct in6_addr *addr); | |
70 | + const struct in6_addr *addr); | |
71 | 71 | #endif |
72 | 72 | |
73 | -extern int ipv6_chk_prefix(struct in6_addr *addr, | |
73 | +extern int ipv6_chk_prefix(const struct in6_addr *addr, | |
74 | 74 | struct net_device *dev); |
75 | 75 | |
76 | 76 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, |
77 | 77 | |
... | ... | @@ -89,9 +89,9 @@ |
89 | 89 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, |
90 | 90 | const struct sock *sk2); |
91 | 91 | extern void addrconf_join_solict(struct net_device *dev, |
92 | - struct in6_addr *addr); | |
92 | + const struct in6_addr *addr); | |
93 | 93 | extern void addrconf_leave_solict(struct inet6_dev *idev, |
94 | - struct in6_addr *addr); | |
94 | + const struct in6_addr *addr); | |
95 | 95 | |
96 | 96 | static inline unsigned long addrconf_timeout_fixup(u32 timeout, |
97 | 97 | unsigned unit) |
98 | 98 | |
99 | 99 | |
100 | 100 | |
... | ... | @@ -158,15 +158,15 @@ |
158 | 158 | /* |
159 | 159 | * anycast prototypes (anycast.c) |
160 | 160 | */ |
161 | -extern int ipv6_sock_ac_join(struct sock *sk,int ifindex,struct in6_addr *addr); | |
162 | -extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex,struct in6_addr *addr); | |
161 | +extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); | |
162 | +extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); | |
163 | 163 | extern void ipv6_sock_ac_close(struct sock *sk); |
164 | -extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); | |
164 | +extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex); | |
165 | 165 | |
166 | -extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); | |
167 | -extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); | |
166 | +extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); | |
167 | +extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); | |
168 | 168 | extern 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 | 172 | /* Device notifier */ |
include/net/if_inet6.h
... | ... | @@ -196,7 +196,7 @@ |
196 | 196 | struct rcu_head rcu; |
197 | 197 | }; |
198 | 198 | |
199 | -static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) | |
199 | +static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) | |
200 | 200 | { |
201 | 201 | /* |
202 | 202 | * +-------+-------+-------+-------+-------+-------+ |
... | ... | @@ -210,7 +210,7 @@ |
210 | 210 | memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); |
211 | 211 | } |
212 | 212 | |
213 | -static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf) | |
213 | +static inline void ipv6_tr_mc_map(const struct in6_addr *addr, char *buf) | |
214 | 214 | { |
215 | 215 | /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */ |
216 | 216 |
include/net/inetpeer.h
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | return inet_getpeer(&daddr, create); |
81 | 81 | } |
82 | 82 | |
83 | -static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int create) | |
83 | +static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create) | |
84 | 84 | { |
85 | 85 | struct inetpeer_addr daddr; |
86 | 86 |
include/net/ip6_fib.h
... | ... | @@ -198,12 +198,12 @@ |
198 | 198 | pol_lookup_t lookup); |
199 | 199 | |
200 | 200 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
201 | - struct in6_addr *daddr, | |
202 | - struct in6_addr *saddr); | |
201 | + const struct in6_addr *daddr, | |
202 | + const struct in6_addr *saddr); | |
203 | 203 | |
204 | 204 | struct fib6_node *fib6_locate(struct fib6_node *root, |
205 | - struct in6_addr *daddr, int dst_len, | |
206 | - struct in6_addr *saddr, int src_len); | |
205 | + const struct in6_addr *daddr, int dst_len, | |
206 | + const struct in6_addr *saddr, int src_len); | |
207 | 207 | |
208 | 208 | extern void fib6_clean_all(struct net *net, |
209 | 209 | int (*func)(struct rt6_info *, void *arg), |
include/net/ip6_route.h
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | |
87 | 87 | extern int ip6_route_get_saddr(struct net *net, |
88 | 88 | struct rt6_info *rt, |
89 | - struct in6_addr *daddr, | |
89 | + const struct in6_addr *daddr, | |
90 | 90 | unsigned int prefs, |
91 | 91 | struct in6_addr *saddr); |
92 | 92 | |
93 | 93 | |
... | ... | @@ -112,9 +112,9 @@ |
112 | 112 | * support functions for ND |
113 | 113 | * |
114 | 114 | */ |
115 | -extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr, | |
115 | +extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr, | |
116 | 116 | struct net_device *dev); |
117 | -extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr, | |
117 | +extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr, | |
118 | 118 | struct net_device *dev, |
119 | 119 | unsigned int pref); |
120 | 120 | |
121 | 121 | |
122 | 122 | |
... | ... | @@ -122,17 +122,17 @@ |
122 | 122 | |
123 | 123 | extern int rt6_route_rcv(struct net_device *dev, |
124 | 124 | u8 *opt, int len, |
125 | - struct in6_addr *gwaddr); | |
125 | + const struct in6_addr *gwaddr); | |
126 | 126 | |
127 | -extern void rt6_redirect(struct in6_addr *dest, | |
128 | - struct in6_addr *src, | |
129 | - struct in6_addr *saddr, | |
127 | +extern void rt6_redirect(const struct in6_addr *dest, | |
128 | + const struct in6_addr *src, | |
129 | + const struct in6_addr *saddr, | |
130 | 130 | struct neighbour *neigh, |
131 | 131 | u8 *lladdr, |
132 | 132 | int on_link); |
133 | 133 | |
134 | -extern void rt6_pmtu_discovery(struct in6_addr *daddr, | |
135 | - struct in6_addr *saddr, | |
134 | +extern void rt6_pmtu_discovery(const struct in6_addr *daddr, | |
135 | + const struct in6_addr *saddr, | |
136 | 136 | struct net_device *dev, |
137 | 137 | u32 pmtu); |
138 | 138 |
include/net/ipv6.h
... | ... | @@ -376,8 +376,8 @@ |
376 | 376 | struct ip6_create_arg { |
377 | 377 | __be32 id; |
378 | 378 | u32 user; |
379 | - struct in6_addr *src; | |
380 | - struct in6_addr *dst; | |
379 | + const struct in6_addr *src; | |
380 | + const struct in6_addr *dst; | |
381 | 381 | }; |
382 | 382 | |
383 | 383 | void ip6_frag_init(struct inet_frag_queue *q, void *a); |
include/net/ndisc.h
... | ... | @@ -102,7 +102,8 @@ |
102 | 102 | struct neighbour *neigh, |
103 | 103 | const struct in6_addr *target); |
104 | 104 | |
105 | -extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); | |
105 | +extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, | |
106 | + struct net_device *dev, int dir); | |
106 | 107 | |
107 | 108 | extern struct sk_buff *ndisc_build_skb(struct net_device *dev, |
108 | 109 | const struct in6_addr *daddr, |
include/net/route.h
... | ... | @@ -191,7 +191,8 @@ |
191 | 191 | return ip_route_input_common(skb, dst, src, tos, devin, true); |
192 | 192 | } |
193 | 193 | |
194 | -extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); | |
194 | +extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, | |
195 | + unsigned short new_mtu, struct net_device *dev); | |
195 | 196 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
196 | 197 | |
197 | 198 | extern unsigned inet_addr_type(struct net *net, __be32 addr); |
include/net/xfrm.h
... | ... | @@ -1475,7 +1475,7 @@ |
1475 | 1475 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
1476 | 1476 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
1477 | 1477 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); |
1478 | -extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); | |
1478 | +extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); | |
1479 | 1479 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1480 | 1480 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1481 | 1481 | extern int xfrm6_output(struct sk_buff *skb); |
... | ... | @@ -1569,8 +1569,8 @@ |
1569 | 1569 | case AF_INET: |
1570 | 1570 | return (__force u32)a->a4 - (__force u32)b->a4; |
1571 | 1571 | case AF_INET6: |
1572 | - return ipv6_addr_cmp((struct in6_addr *)a, | |
1573 | - (struct in6_addr *)b); | |
1572 | + return ipv6_addr_cmp((const struct in6_addr *)a, | |
1573 | + (const struct in6_addr *)b); | |
1574 | 1574 | } |
1575 | 1575 | } |
1576 | 1576 |
net/bridge/br_multicast.c
... | ... | @@ -413,7 +413,7 @@ |
413 | 413 | |
414 | 414 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
415 | 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 | 418 | struct sk_buff *skb; |
419 | 419 | struct ipv6hdr *ip6h; |
... | ... | @@ -1115,7 +1115,7 @@ |
1115 | 1115 | struct net_bridge_port *port, |
1116 | 1116 | struct sk_buff *skb) |
1117 | 1117 | { |
1118 | - struct iphdr *iph = ip_hdr(skb); | |
1118 | + const struct iphdr *iph = ip_hdr(skb); | |
1119 | 1119 | struct igmphdr *ih = igmp_hdr(skb); |
1120 | 1120 | struct net_bridge_mdb_entry *mp; |
1121 | 1121 | struct igmpv3_query *ih3; |
... | ... | @@ -1190,7 +1190,7 @@ |
1190 | 1190 | struct net_bridge_port *port, |
1191 | 1191 | struct sk_buff *skb) |
1192 | 1192 | { |
1193 | - struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
1193 | + const struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
1194 | 1194 | struct mld_msg *mld = (struct mld_msg *) icmp6_hdr(skb); |
1195 | 1195 | struct net_bridge_mdb_entry *mp; |
1196 | 1196 | struct mld2_query *mld2q; |
... | ... | @@ -1198,7 +1198,7 @@ |
1198 | 1198 | struct net_bridge_port_group __rcu **pp; |
1199 | 1199 | unsigned long max_delay; |
1200 | 1200 | unsigned long now = jiffies; |
1201 | - struct in6_addr *group = NULL; | |
1201 | + const struct in6_addr *group = NULL; | |
1202 | 1202 | int err = 0; |
1203 | 1203 | |
1204 | 1204 | spin_lock(&br->multicast_lock); |
... | ... | @@ -1356,7 +1356,7 @@ |
1356 | 1356 | struct sk_buff *skb) |
1357 | 1357 | { |
1358 | 1358 | struct sk_buff *skb2 = skb; |
1359 | - struct iphdr *iph; | |
1359 | + const struct iphdr *iph; | |
1360 | 1360 | struct igmphdr *ih; |
1361 | 1361 | unsigned len; |
1362 | 1362 | unsigned offset; |
... | ... | @@ -1452,7 +1452,7 @@ |
1452 | 1452 | struct sk_buff *skb) |
1453 | 1453 | { |
1454 | 1454 | struct sk_buff *skb2; |
1455 | - struct ipv6hdr *ip6h; | |
1455 | + const struct ipv6hdr *ip6h; | |
1456 | 1456 | struct icmp6hdr *icmp6h; |
1457 | 1457 | u8 nexthdr; |
1458 | 1458 | unsigned len; |
net/bridge/br_netfilter.c
... | ... | @@ -219,7 +219,7 @@ |
219 | 219 | static int br_parse_ip_options(struct sk_buff *skb) |
220 | 220 | { |
221 | 221 | struct ip_options *opt; |
222 | - struct iphdr *iph; | |
222 | + const struct iphdr *iph; | |
223 | 223 | struct net_device *dev = skb->dev; |
224 | 224 | u32 len; |
225 | 225 | |
... | ... | @@ -554,7 +554,7 @@ |
554 | 554 | const struct net_device *out, |
555 | 555 | int (*okfn)(struct sk_buff *)) |
556 | 556 | { |
557 | - struct ipv6hdr *hdr; | |
557 | + const struct ipv6hdr *hdr; | |
558 | 558 | u32 pkt_len; |
559 | 559 | |
560 | 560 | if (skb->len < sizeof(struct ipv6hdr)) |
net/core/dev.c
... | ... | @@ -2502,8 +2502,8 @@ |
2502 | 2502 | __u32 __skb_get_rxhash(struct sk_buff *skb) |
2503 | 2503 | { |
2504 | 2504 | int nhoff, hash = 0, poff; |
2505 | - struct ipv6hdr *ip6; | |
2506 | - struct iphdr *ip; | |
2505 | + const struct ipv6hdr *ip6; | |
2506 | + const struct iphdr *ip; | |
2507 | 2507 | u8 ip_proto; |
2508 | 2508 | u32 addr1, addr2, ihl; |
2509 | 2509 | union { |
... | ... | @@ -2518,7 +2518,7 @@ |
2518 | 2518 | if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) |
2519 | 2519 | goto done; |
2520 | 2520 | |
2521 | - ip = (struct iphdr *) (skb->data + nhoff); | |
2521 | + ip = (const struct iphdr *) (skb->data + nhoff); | |
2522 | 2522 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) |
2523 | 2523 | ip_proto = 0; |
2524 | 2524 | else |
... | ... | @@ -2531,7 +2531,7 @@ |
2531 | 2531 | if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) |
2532 | 2532 | goto done; |
2533 | 2533 | |
2534 | - ip6 = (struct ipv6hdr *) (skb->data + nhoff); | |
2534 | + ip6 = (const struct ipv6hdr *) (skb->data + nhoff); | |
2535 | 2535 | ip_proto = ip6->nexthdr; |
2536 | 2536 | addr1 = (__force u32) ip6->saddr.s6_addr32[3]; |
2537 | 2537 | addr2 = (__force u32) ip6->daddr.s6_addr32[3]; |
net/core/netpoll.c
net/dccp/ipv6.c
... | ... | @@ -54,8 +54,8 @@ |
54 | 54 | |
55 | 55 | /* add pseudo-header to DCCP checksum stored in skb->csum */ |
56 | 56 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, |
57 | - struct in6_addr *saddr, | |
58 | - struct in6_addr *daddr) | |
57 | + const struct in6_addr *saddr, | |
58 | + const struct in6_addr *daddr) | |
59 | 59 | { |
60 | 60 | return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum); |
61 | 61 | } |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
88 | 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 | 91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); |
92 | 92 | struct dccp_sock *dp; |
93 | 93 | struct ipv6_pinfo *np; |
... | ... | @@ -296,7 +296,7 @@ |
296 | 296 | |
297 | 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 | 300 | struct sk_buff *skb; |
301 | 301 | struct flowi6 fl6; |
302 | 302 | struct net *net = dev_net(skb_dst(rxskb)->dev); |
net/ipv4/af_inet.c
... | ... | @@ -1186,7 +1186,7 @@ |
1186 | 1186 | |
1187 | 1187 | static int inet_gso_send_check(struct sk_buff *skb) |
1188 | 1188 | { |
1189 | - struct iphdr *iph; | |
1189 | + const struct iphdr *iph; | |
1190 | 1190 | const struct net_protocol *ops; |
1191 | 1191 | int proto; |
1192 | 1192 | int ihl; |
... | ... | @@ -1293,7 +1293,7 @@ |
1293 | 1293 | const struct net_protocol *ops; |
1294 | 1294 | struct sk_buff **pp = NULL; |
1295 | 1295 | struct sk_buff *p; |
1296 | - struct iphdr *iph; | |
1296 | + const struct iphdr *iph; | |
1297 | 1297 | unsigned int hlen; |
1298 | 1298 | unsigned int off; |
1299 | 1299 | unsigned int id; |
net/ipv4/ah4.c
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | * into IP header for icv calculation. Options are already checked |
74 | 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 | 78 | unsigned char * optptr = (unsigned char*)(iph+1); |
79 | 79 | int l = iph->ihl*4 - sizeof(struct iphdr); |
... | ... | @@ -396,7 +396,7 @@ |
396 | 396 | static void ah4_err(struct sk_buff *skb, u32 info) |
397 | 397 | { |
398 | 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 | 400 | struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+(iph->ihl<<2)); |
401 | 401 | struct xfrm_state *x; |
402 | 402 | |
... | ... | @@ -404,7 +404,8 @@ |
404 | 404 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) |
405 | 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 | 409 | if (!x) |
409 | 410 | return; |
410 | 411 | printk(KERN_DEBUG "pmtu discovery on SA AH/%08x/%08x\n", |
net/ipv4/esp4.c
... | ... | @@ -276,7 +276,7 @@ |
276 | 276 | |
277 | 277 | static int esp_input_done2(struct sk_buff *skb, int err) |
278 | 278 | { |
279 | - struct iphdr *iph; | |
279 | + const struct iphdr *iph; | |
280 | 280 | struct xfrm_state *x = xfrm_input_state(skb); |
281 | 281 | struct esp_data *esp = x->data; |
282 | 282 | struct crypto_aead *aead = esp->aead; |
... | ... | @@ -484,7 +484,7 @@ |
484 | 484 | static void esp4_err(struct sk_buff *skb, u32 info) |
485 | 485 | { |
486 | 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 | 488 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); |
489 | 489 | struct xfrm_state *x; |
490 | 490 | |
... | ... | @@ -492,7 +492,8 @@ |
492 | 492 | icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) |
493 | 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 | 497 | if (!x) |
497 | 498 | return; |
498 | 499 | NETDEBUG(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%08x\n", |
net/ipv4/icmp.c
... | ... | @@ -373,7 +373,7 @@ |
373 | 373 | } |
374 | 374 | |
375 | 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 | 377 | __be32 saddr, u8 tos, |
378 | 378 | int type, int code, |
379 | 379 | struct icmp_bxm *param) |
... | ... | @@ -637,7 +637,7 @@ |
637 | 637 | |
638 | 638 | static void icmp_unreach(struct sk_buff *skb) |
639 | 639 | { |
640 | - struct iphdr *iph; | |
640 | + const struct iphdr *iph; | |
641 | 641 | struct icmphdr *icmph; |
642 | 642 | int hash, protocol; |
643 | 643 | const struct net_protocol *ipprot; |
... | ... | @@ -656,7 +656,7 @@ |
656 | 656 | goto out_err; |
657 | 657 | |
658 | 658 | icmph = icmp_hdr(skb); |
659 | - iph = (struct iphdr *)skb->data; | |
659 | + iph = (const struct iphdr *)skb->data; | |
660 | 660 | |
661 | 661 | if (iph->ihl < 5) /* Mangled header, drop. */ |
662 | 662 | goto out_err; |
... | ... | @@ -729,7 +729,7 @@ |
729 | 729 | if (!pskb_may_pull(skb, iph->ihl * 4 + 8)) |
730 | 730 | goto out; |
731 | 731 | |
732 | - iph = (struct iphdr *)skb->data; | |
732 | + iph = (const struct iphdr *)skb->data; | |
733 | 733 | protocol = iph->protocol; |
734 | 734 | |
735 | 735 | /* |
... | ... | @@ -758,7 +758,7 @@ |
758 | 758 | |
759 | 759 | static void icmp_redirect(struct sk_buff *skb) |
760 | 760 | { |
761 | - struct iphdr *iph; | |
761 | + const struct iphdr *iph; | |
762 | 762 | |
763 | 763 | if (skb->len < sizeof(struct iphdr)) |
764 | 764 | goto out_err; |
... | ... | @@ -769,7 +769,7 @@ |
769 | 769 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) |
770 | 770 | goto out; |
771 | 771 | |
772 | - iph = (struct iphdr *)skb->data; | |
772 | + iph = (const struct iphdr *)skb->data; | |
773 | 773 | |
774 | 774 | switch (icmp_hdr(skb)->code & 7) { |
775 | 775 | case ICMP_REDIR_NET: |
net/ipv4/inet_diag.c
... | ... | @@ -124,7 +124,7 @@ |
124 | 124 | |
125 | 125 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
126 | 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 | 129 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
130 | 130 | &np->rcv_saddr); |
net/ipv4/inet_lro.c
... | ... | @@ -51,8 +51,8 @@ |
51 | 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, | |
55 | - int len, struct net_lro_desc *lro_desc) | |
54 | +static int lro_tcp_ip_check(const struct iphdr *iph, const struct tcphdr *tcph, | |
55 | + int len, const struct net_lro_desc *lro_desc) | |
56 | 56 | { |
57 | 57 | /* check ip header: don't aggregate padded frames */ |
58 | 58 | if (ntohs(iph->tot_len) != len) |
net/ipv4/ip_gre.c
... | ... | @@ -462,7 +462,7 @@ |
462 | 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 | 466 | __be16 *p = (__be16*)(skb->data+(iph->ihl<<2)); |
467 | 467 | int grehlen = (iph->ihl<<2) + 4; |
468 | 468 | const int type = icmp_hdr(skb)->type; |
... | ... | @@ -534,7 +534,7 @@ |
534 | 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 | 539 | if (INET_ECN_is_ce(iph->tos)) { |
540 | 540 | if (skb->protocol == htons(ETH_P_IP)) { |
541 | 541 | |
542 | 542 | |
... | ... | @@ -546,19 +546,19 @@ |
546 | 546 | } |
547 | 547 | |
548 | 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 | 551 | u8 inner = 0; |
552 | 552 | if (skb->protocol == htons(ETH_P_IP)) |
553 | 553 | inner = old_iph->tos; |
554 | 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 | 556 | return INET_ECN_encapsulate(tos, inner); |
557 | 557 | } |
558 | 558 | |
559 | 559 | static int ipgre_rcv(struct sk_buff *skb) |
560 | 560 | { |
561 | - struct iphdr *iph; | |
561 | + const struct iphdr *iph; | |
562 | 562 | u8 *h; |
563 | 563 | __be16 flags; |
564 | 564 | __sum16 csum = 0; |
... | ... | @@ -697,8 +697,8 @@ |
697 | 697 | { |
698 | 698 | struct ip_tunnel *tunnel = netdev_priv(dev); |
699 | 699 | struct pcpu_tstats *tstats; |
700 | - struct iphdr *old_iph = ip_hdr(skb); | |
701 | - struct iphdr *tiph; | |
700 | + const struct iphdr *old_iph = ip_hdr(skb); | |
701 | + const struct iphdr *tiph; | |
702 | 702 | u8 tos; |
703 | 703 | __be16 df; |
704 | 704 | struct rtable *rt; /* Route to the other host */ |
... | ... | @@ -714,7 +714,7 @@ |
714 | 714 | |
715 | 715 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { |
716 | 716 | gre_hlen = 0; |
717 | - tiph = (struct iphdr *)skb->data; | |
717 | + tiph = (const struct iphdr *)skb->data; | |
718 | 718 | } else { |
719 | 719 | gre_hlen = tunnel->hlen; |
720 | 720 | tiph = &tunnel->parms.iph; |
721 | 721 | |
... | ... | @@ -735,14 +735,14 @@ |
735 | 735 | } |
736 | 736 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
737 | 737 | else if (skb->protocol == htons(ETH_P_IPV6)) { |
738 | - struct in6_addr *addr6; | |
738 | + const struct in6_addr *addr6; | |
739 | 739 | int addr_type; |
740 | 740 | struct neighbour *neigh = skb_dst(skb)->neighbour; |
741 | 741 | |
742 | 742 | if (neigh == NULL) |
743 | 743 | goto tx_error; |
744 | 744 | |
745 | - addr6 = (struct in6_addr *)&neigh->primary_key; | |
745 | + addr6 = (const struct in6_addr *)&neigh->primary_key; | |
746 | 746 | addr_type = ipv6_addr_type(addr6); |
747 | 747 | |
748 | 748 | if (addr_type == IPV6_ADDR_ANY) { |
... | ... | @@ -766,7 +766,7 @@ |
766 | 766 | if (skb->protocol == htons(ETH_P_IP)) |
767 | 767 | tos = old_iph->tos; |
768 | 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 | 772 | rt = ip_route_output_gre(dev_net(dev), dst, tiph->saddr, |
... | ... | @@ -881,7 +881,7 @@ |
881 | 881 | iph->ttl = old_iph->ttl; |
882 | 882 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
883 | 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 | 885 | #endif |
886 | 886 | else |
887 | 887 | iph->ttl = ip4_dst_hoplimit(&rt->dst); |
... | ... | @@ -927,7 +927,7 @@ |
927 | 927 | { |
928 | 928 | struct net_device *tdev = NULL; |
929 | 929 | struct ip_tunnel *tunnel; |
930 | - struct iphdr *iph; | |
930 | + const struct iphdr *iph; | |
931 | 931 | int hlen = LL_MAX_HEADER; |
932 | 932 | int mtu = ETH_DATA_LEN; |
933 | 933 | int addend = sizeof(struct iphdr) + 4; |
... | ... | @@ -1180,7 +1180,7 @@ |
1180 | 1180 | |
1181 | 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 | 1184 | memcpy(haddr, &iph->saddr, 4); |
1185 | 1185 | return 4; |
1186 | 1186 | } |
net/ipv4/ip_input.c
... | ... | @@ -268,7 +268,7 @@ |
268 | 268 | static inline int ip_rcv_options(struct sk_buff *skb) |
269 | 269 | { |
270 | 270 | struct ip_options *opt; |
271 | - struct iphdr *iph; | |
271 | + const struct iphdr *iph; | |
272 | 272 | struct net_device *dev = skb->dev; |
273 | 273 | |
274 | 274 | /* It looks as overkill, because not all |
... | ... | @@ -374,7 +374,7 @@ |
374 | 374 | */ |
375 | 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 | 378 | u32 len; |
379 | 379 | |
380 | 380 | /* When the interface is in promisc. mode, drop all the crap |
net/ipv4/ip_sockglue.c
... | ... | @@ -131,7 +131,7 @@ |
131 | 131 | static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
132 | 132 | { |
133 | 133 | struct sockaddr_in sin; |
134 | - struct iphdr *iph = ip_hdr(skb); | |
134 | + const struct iphdr *iph = ip_hdr(skb); | |
135 | 135 | __be16 *ports = (__be16 *)skb_transport_header(skb); |
136 | 136 | |
137 | 137 | if (skb_transport_offset(skb) + 4 > skb->len) |
net/ipv4/ipcomp.c
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | { |
28 | 28 | struct net *net = dev_net(skb->dev); |
29 | 29 | __be32 spi; |
30 | - struct iphdr *iph = (struct iphdr *)skb->data; | |
30 | + const struct iphdr *iph = (const struct iphdr *)skb->data; | |
31 | 31 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); |
32 | 32 | struct xfrm_state *x; |
33 | 33 | |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | return; |
37 | 37 | |
38 | 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 | 40 | spi, IPPROTO_COMP, AF_INET); |
41 | 41 | if (!x) |
42 | 42 | return; |
net/ipv4/ipip.c
... | ... | @@ -319,7 +319,7 @@ |
319 | 319 | 8 bytes of packet payload. It means, that precise relaying of |
320 | 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 | 323 | const int type = icmp_hdr(skb)->type; |
324 | 324 | const int code = icmp_hdr(skb)->code; |
325 | 325 | struct ip_tunnel *t; |
326 | 326 | |
... | ... | @@ -433,12 +433,12 @@ |
433 | 433 | { |
434 | 434 | struct ip_tunnel *tunnel = netdev_priv(dev); |
435 | 435 | struct pcpu_tstats *tstats; |
436 | - struct iphdr *tiph = &tunnel->parms.iph; | |
436 | + const struct iphdr *tiph = &tunnel->parms.iph; | |
437 | 437 | u8 tos = tunnel->parms.iph.tos; |
438 | 438 | __be16 df = tiph->frag_off; |
439 | 439 | struct rtable *rt; /* Route to the other host */ |
440 | 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 | 442 | struct iphdr *iph; /* Our new IP header */ |
443 | 443 | unsigned int max_headroom; /* The extra header space needed */ |
444 | 444 | __be32 dst = tiph->daddr; |
... | ... | @@ -572,7 +572,7 @@ |
572 | 572 | { |
573 | 573 | struct net_device *tdev = NULL; |
574 | 574 | struct ip_tunnel *tunnel; |
575 | - struct iphdr *iph; | |
575 | + const struct iphdr *iph; | |
576 | 576 | |
577 | 577 | tunnel = netdev_priv(dev); |
578 | 578 | iph = &tunnel->parms.iph; |
net/ipv4/ipmr.c
... | ... | @@ -1549,7 +1549,7 @@ |
1549 | 1549 | static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) |
1550 | 1550 | { |
1551 | 1551 | struct iphdr *iph; |
1552 | - struct iphdr *old_iph = ip_hdr(skb); | |
1552 | + const struct iphdr *old_iph = ip_hdr(skb); | |
1553 | 1553 | |
1554 | 1554 | skb_push(skb, sizeof(struct iphdr)); |
1555 | 1555 | skb->transport_header = skb->network_header; |
net/ipv4/netfilter/nf_nat_helper.c
... | ... | @@ -153,7 +153,7 @@ |
153 | 153 | } |
154 | 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 | 157 | int datalen, __sum16 *check, int oldlen) |
158 | 158 | { |
159 | 159 | struct rtable *rt = skb_rtable(skb); |
net/ipv4/raw.c
... | ... | @@ -154,7 +154,7 @@ |
154 | 154 | * RFC 1122: SHOULD pass TOS value up to the transport layer. |
155 | 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 | 159 | struct sock *sk; |
160 | 160 | struct hlist_head *head; |
... | ... | @@ -247,7 +247,7 @@ |
247 | 247 | } |
248 | 248 | |
249 | 249 | if (inet->recverr) { |
250 | - struct iphdr *iph = (struct iphdr *)skb->data; | |
250 | + const struct iphdr *iph = (const struct iphdr *)skb->data; | |
251 | 251 | u8 *payload = skb->data + (iph->ihl << 2); |
252 | 252 | |
253 | 253 | if (inet->hdrincl) |
... | ... | @@ -265,7 +265,7 @@ |
265 | 265 | { |
266 | 266 | int hash; |
267 | 267 | struct sock *raw_sk; |
268 | - struct iphdr *iph; | |
268 | + const struct iphdr *iph; | |
269 | 269 | struct net *net; |
270 | 270 | |
271 | 271 | hash = protocol & (RAW_HTABLE_SIZE - 1); |
... | ... | @@ -273,7 +273,7 @@ |
273 | 273 | read_lock(&raw_v4_hashinfo.lock); |
274 | 274 | raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); |
275 | 275 | if (raw_sk != NULL) { |
276 | - iph = (struct iphdr *)skb->data; | |
276 | + iph = (const struct iphdr *)skb->data; | |
277 | 277 | net = dev_net(skb->dev); |
278 | 278 | |
279 | 279 | while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, |
... | ... | @@ -281,7 +281,7 @@ |
281 | 281 | skb->dev->ifindex)) != NULL) { |
282 | 282 | raw_err(raw_sk, skb, info); |
283 | 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 | 287 | read_unlock(&raw_v4_hashinfo.lock); |
net/ipv4/route.c
... | ... | @@ -1507,7 +1507,7 @@ |
1507 | 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 | 1511 | unsigned short new_mtu, |
1512 | 1512 | struct net_device *dev) |
1513 | 1513 | { |
net/ipv4/tcp_ipv4.c
... | ... | @@ -279,7 +279,7 @@ |
279 | 279 | /* |
280 | 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 | 284 | struct dst_entry *dst; |
285 | 285 | struct inet_sock *inet = inet_sk(sk); |
... | ... | @@ -341,7 +341,7 @@ |
341 | 341 | |
342 | 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 | 345 | struct tcphdr *th = (struct tcphdr *)(icmp_skb->data + (iph->ihl << 2)); |
346 | 346 | struct inet_connection_sock *icsk; |
347 | 347 | struct tcp_sock *tp; |
... | ... | @@ -2527,7 +2527,7 @@ |
2527 | 2527 | |
2528 | 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 | 2532 | switch (skb->ip_summed) { |
2533 | 2533 | case CHECKSUM_COMPLETE: |
... | ... | @@ -2548,7 +2548,7 @@ |
2548 | 2548 | |
2549 | 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 | 2552 | struct tcphdr *th = tcp_hdr(skb); |
2553 | 2553 | |
2554 | 2554 | th->check = ~tcp_v4_check(skb->len - skb_transport_offset(skb), |
net/ipv4/udp.c
... | ... | @@ -578,7 +578,7 @@ |
578 | 578 | void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) |
579 | 579 | { |
580 | 580 | struct inet_sock *inet; |
581 | - struct iphdr *iph = (struct iphdr *)skb->data; | |
581 | + const struct iphdr *iph = (const struct iphdr *)skb->data; | |
582 | 582 | struct udphdr *uh = (struct udphdr *)(skb->data+(iph->ihl<<2)); |
583 | 583 | const int type = icmp_hdr(skb)->type; |
584 | 584 | const int code = icmp_hdr(skb)->code; |
net/ipv4/xfrm4_policy.c
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | static void |
103 | 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 | 106 | u8 *xprth = skb_network_header(skb) + iph->ihl * 4; |
107 | 107 | struct flowi4 *fl4 = &fl->u.ip4; |
108 | 108 |
net/ipv4/xfrm4_state.c
net/ipv6/addrconf.c
... | ... | @@ -1283,7 +1283,7 @@ |
1283 | 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 | 1287 | struct net_device *dev, int strict) |
1288 | 1288 | { |
1289 | 1289 | struct inet6_ifaddr *ifp; |
... | ... | @@ -1326,7 +1326,7 @@ |
1326 | 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 | 1331 | struct inet6_dev *idev; |
1332 | 1332 | struct inet6_ifaddr *ifa; |
... | ... | @@ -1457,7 +1457,7 @@ |
1457 | 1457 | |
1458 | 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 | 1462 | struct in6_addr maddr; |
1463 | 1463 | |
... | ... | @@ -1468,7 +1468,7 @@ |
1468 | 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 | 1473 | struct in6_addr maddr; |
1474 | 1474 | |
... | ... | @@ -2113,7 +2113,7 @@ |
2113 | 2113 | /* |
2114 | 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 | 2117 | unsigned int plen, __u8 ifa_flags, __u32 prefered_lft, |
2118 | 2118 | __u32 valid_lft) |
2119 | 2119 | { |
... | ... | @@ -2187,7 +2187,7 @@ |
2187 | 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 | 2191 | unsigned int plen) |
2192 | 2192 | { |
2193 | 2193 | struct inet6_ifaddr *ifp; |
... | ... | @@ -2350,7 +2350,7 @@ |
2350 | 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 | 2355 | struct inet6_ifaddr * ifp; |
2356 | 2356 | u32 addr_flags = IFA_F_PERMANENT; |
... | ... | @@ -3121,7 +3121,7 @@ |
3121 | 3121 | |
3122 | 3122 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
3123 | 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 | 3126 | int ret = 0; |
3127 | 3127 | struct inet6_ifaddr *ifp = NULL; |
net/ipv6/af_inet6.c
net/ipv6/anycast.c
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | |
45 | 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 | 49 | /* Big ac list lock for all the sockets */ |
50 | 50 | static DEFINE_RWLOCK(ipv6_sk_ac_lock); |
... | ... | @@ -54,7 +54,7 @@ |
54 | 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 | 59 | struct ipv6_pinfo *np = inet6_sk(sk); |
60 | 60 | struct net_device *dev = NULL; |
... | ... | @@ -145,7 +145,7 @@ |
145 | 145 | /* |
146 | 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 | 150 | struct ipv6_pinfo *np = inet6_sk(sk); |
151 | 151 | struct net_device *dev; |
... | ... | @@ -252,7 +252,7 @@ |
252 | 252 | /* |
253 | 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 | 257 | struct ifacaddr6 *aca; |
258 | 258 | struct inet6_dev *idev; |
... | ... | @@ -324,7 +324,7 @@ |
324 | 324 | /* |
325 | 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 | 329 | struct ifacaddr6 *aca, *prev_aca; |
330 | 330 | |
... | ... | @@ -358,7 +358,7 @@ |
358 | 358 | } |
359 | 359 | |
360 | 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 | 363 | struct inet6_dev *idev = __in6_dev_get(dev); |
364 | 364 | |
... | ... | @@ -371,7 +371,7 @@ |
371 | 371 | * check if the interface has this anycast address |
372 | 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 | 376 | struct inet6_dev *idev; |
377 | 377 | struct ifacaddr6 *aca; |
... | ... | @@ -392,7 +392,7 @@ |
392 | 392 | * check if given interface (or any, if dev==0) has this anycast address |
393 | 393 | */ |
394 | 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 | 397 | int found = 0; |
398 | 398 |
net/ipv6/esp6.c
... | ... | @@ -430,7 +430,7 @@ |
430 | 430 | u8 type, u8 code, int offset, __be32 info) |
431 | 431 | { |
432 | 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 | 434 | struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset); |
435 | 435 | struct xfrm_state *x; |
436 | 436 | |
... | ... | @@ -438,7 +438,8 @@ |
438 | 438 | type != ICMPV6_PKT_TOOBIG) |
439 | 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 | 443 | if (!x) |
443 | 444 | return; |
444 | 445 | printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%pI6\n", |
net/ipv6/icmp.c
... | ... | @@ -372,7 +372,7 @@ |
372 | 372 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
373 | 373 | struct sock *sk; |
374 | 374 | struct ipv6_pinfo *np; |
375 | - struct in6_addr *saddr = NULL; | |
375 | + const struct in6_addr *saddr = NULL; | |
376 | 376 | struct dst_entry *dst; |
377 | 377 | struct icmp6hdr tmp_hdr; |
378 | 378 | struct flowi6 fl6; |
... | ... | @@ -521,7 +521,7 @@ |
521 | 521 | struct sock *sk; |
522 | 522 | struct inet6_dev *idev; |
523 | 523 | struct ipv6_pinfo *np; |
524 | - struct in6_addr *saddr = NULL; | |
524 | + const struct in6_addr *saddr = NULL; | |
525 | 525 | struct icmp6hdr *icmph = icmp6_hdr(skb); |
526 | 526 | struct icmp6hdr tmp_hdr; |
527 | 527 | struct flowi6 fl6; |
... | ... | @@ -645,8 +645,8 @@ |
645 | 645 | { |
646 | 646 | struct net_device *dev = skb->dev; |
647 | 647 | struct inet6_dev *idev = __in6_dev_get(dev); |
648 | - struct in6_addr *saddr, *daddr; | |
649 | - struct ipv6hdr *orig_hdr; | |
648 | + const struct in6_addr *saddr, *daddr; | |
649 | + const struct ipv6hdr *orig_hdr; | |
650 | 650 | struct icmp6hdr *hdr; |
651 | 651 | u8 type; |
652 | 652 |
net/ipv6/ip6_fib.c
... | ... | @@ -134,9 +134,9 @@ |
134 | 134 | # define BITOP_BE32_SWIZZLE 0 |
135 | 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 | 141 | * Here, |
142 | 142 | * 1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f) |
... | ... | @@ -822,7 +822,7 @@ |
822 | 822 | |
823 | 823 | struct lookup_args { |
824 | 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 | 828 | static struct fib6_node * fib6_lookup_1(struct fib6_node *root, |
... | ... | @@ -881,8 +881,8 @@ |
881 | 881 | return NULL; |
882 | 882 | } |
883 | 883 | |
884 | -struct fib6_node * fib6_lookup(struct fib6_node *root, struct in6_addr *daddr, | |
885 | - struct in6_addr *saddr) | |
884 | +struct fib6_node * fib6_lookup(struct fib6_node *root, const struct in6_addr *daddr, | |
885 | + const struct in6_addr *saddr) | |
886 | 886 | { |
887 | 887 | struct fib6_node *fn; |
888 | 888 | struct lookup_args args[] = { |
... | ... | @@ -916,7 +916,7 @@ |
916 | 916 | |
917 | 917 | |
918 | 918 | static struct fib6_node * fib6_locate_1(struct fib6_node *root, |
919 | - struct in6_addr *addr, | |
919 | + const struct in6_addr *addr, | |
920 | 920 | int plen, int offset) |
921 | 921 | { |
922 | 922 | struct fib6_node *fn; |
... | ... | @@ -946,8 +946,8 @@ |
946 | 946 | } |
947 | 947 | |
948 | 948 | struct fib6_node * fib6_locate(struct fib6_node *root, |
949 | - struct in6_addr *daddr, int dst_len, | |
950 | - struct in6_addr *saddr, int src_len) | |
949 | + const struct in6_addr *daddr, int dst_len, | |
950 | + const struct in6_addr *saddr, int src_len) | |
951 | 951 | { |
952 | 952 | struct fib6_node *fn; |
953 | 953 |
net/ipv6/ip6_input.c
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | |
58 | 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 | 61 | u32 pkt_len; |
62 | 62 | struct inet6_dev *idev; |
63 | 63 | struct net *net = dev_net(skb->dev); |
... | ... | @@ -186,7 +186,7 @@ |
186 | 186 | int ret; |
187 | 187 | |
188 | 188 | if (ipprot->flags & INET6_PROTO_FINAL) { |
189 | - struct ipv6hdr *hdr; | |
189 | + const struct ipv6hdr *hdr; | |
190 | 190 | |
191 | 191 | /* Free reference early: we don't need it any more, |
192 | 192 | and it may hold ip_conntrack module loaded |
... | ... | @@ -242,7 +242,7 @@ |
242 | 242 | |
243 | 243 | int ip6_mc_input(struct sk_buff *skb) |
244 | 244 | { |
245 | - struct ipv6hdr *hdr; | |
245 | + const struct ipv6hdr *hdr; | |
246 | 246 | int deliver; |
247 | 247 | |
248 | 248 | IP6_UPD_PO_STATS_BH(dev_net(skb_dst(skb)->dev), |
net/ipv6/ip6_output.c
... | ... | @@ -869,9 +869,9 @@ |
869 | 869 | return err; |
870 | 870 | } |
871 | 871 | |
872 | -static inline int ip6_rt_check(struct rt6key *rt_key, | |
873 | - struct in6_addr *fl_addr, | |
874 | - struct in6_addr *addr_cache) | |
872 | +static inline int ip6_rt_check(const struct rt6key *rt_key, | |
873 | + const struct in6_addr *fl_addr, | |
874 | + const struct in6_addr *addr_cache) | |
875 | 875 | { |
876 | 876 | return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && |
877 | 877 | (addr_cache == NULL || !ipv6_addr_equal(fl_addr, addr_cache)); |
... | ... | @@ -879,7 +879,7 @@ |
879 | 879 | |
880 | 880 | static struct dst_entry *ip6_sk_dst_check(struct sock *sk, |
881 | 881 | struct dst_entry *dst, |
882 | - struct flowi6 *fl6) | |
882 | + const struct flowi6 *fl6) | |
883 | 883 | { |
884 | 884 | struct ipv6_pinfo *np = inet6_sk(sk); |
885 | 885 | struct rt6_info *rt = (struct rt6_info *)dst; |
net/ipv6/ip6_tunnel.c
... | ... | @@ -162,7 +162,7 @@ |
162 | 162 | for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) |
163 | 163 | |
164 | 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 | 167 | unsigned int h0 = HASH(remote); |
168 | 168 | unsigned int h1 = HASH(local); |
169 | 169 | |
... | ... | @@ -194,10 +194,10 @@ |
194 | 194 | **/ |
195 | 195 | |
196 | 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; | |
200 | - struct in6_addr *local = &p->laddr; | |
199 | + const struct in6_addr *remote = &p->raddr; | |
200 | + const struct in6_addr *local = &p->laddr; | |
201 | 201 | unsigned h = 0; |
202 | 202 | int prio = 0; |
203 | 203 | |
... | ... | @@ -321,8 +321,8 @@ |
321 | 321 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, |
322 | 322 | struct ip6_tnl_parm *p, int create) |
323 | 323 | { |
324 | - struct in6_addr *remote = &p->raddr; | |
325 | - struct in6_addr *local = &p->laddr; | |
324 | + const struct in6_addr *remote = &p->raddr; | |
325 | + const struct in6_addr *local = &p->laddr; | |
326 | 326 | struct ip6_tnl __rcu **tp; |
327 | 327 | struct ip6_tnl *t; |
328 | 328 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
... | ... | @@ -374,7 +374,7 @@ |
374 | 374 | static __u16 |
375 | 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 | 378 | __u8 nexthdr = ipv6h->nexthdr; |
379 | 379 | __u16 off = sizeof (*ipv6h); |
380 | 380 | |
... | ... | @@ -435,7 +435,7 @@ |
435 | 435 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, |
436 | 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 | 439 | struct ip6_tnl *t; |
440 | 440 | int rel_msg = 0; |
441 | 441 | u8 rel_type = ICMPV6_DEST_UNREACH; |
... | ... | @@ -535,7 +535,7 @@ |
535 | 535 | __u32 rel_info = ntohl(info); |
536 | 536 | int err; |
537 | 537 | struct sk_buff *skb2; |
538 | - struct iphdr *eiph; | |
538 | + const struct iphdr *eiph; | |
539 | 539 | struct rtable *rt; |
540 | 540 | |
541 | 541 | err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, |
... | ... | @@ -669,8 +669,8 @@ |
669 | 669 | return 0; |
670 | 670 | } |
671 | 671 | |
672 | -static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | |
673 | - struct ipv6hdr *ipv6h, | |
672 | +static void ip4ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, | |
673 | + const struct ipv6hdr *ipv6h, | |
674 | 674 | struct sk_buff *skb) |
675 | 675 | { |
676 | 676 | __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK; |
... | ... | @@ -682,8 +682,8 @@ |
682 | 682 | IP_ECN_set_ce(ip_hdr(skb)); |
683 | 683 | } |
684 | 684 | |
685 | -static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | |
686 | - struct ipv6hdr *ipv6h, | |
685 | +static void ip6ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, | |
686 | + const struct ipv6hdr *ipv6h, | |
687 | 687 | struct sk_buff *skb) |
688 | 688 | { |
689 | 689 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) |
690 | 690 | |
... | ... | @@ -726,12 +726,12 @@ |
726 | 726 | |
727 | 727 | static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, |
728 | 728 | __u8 ipproto, |
729 | - void (*dscp_ecn_decapsulate)(struct ip6_tnl *t, | |
730 | - struct ipv6hdr *ipv6h, | |
729 | + void (*dscp_ecn_decapsulate)(const struct ip6_tnl *t, | |
730 | + const struct ipv6hdr *ipv6h, | |
731 | 731 | struct sk_buff *skb)) |
732 | 732 | { |
733 | 733 | struct ip6_tnl *t; |
734 | - struct ipv6hdr *ipv6h = ipv6_hdr(skb); | |
734 | + const struct ipv6hdr *ipv6h = ipv6_hdr(skb); | |
735 | 735 | |
736 | 736 | rcu_read_lock(); |
737 | 737 | |
... | ... | @@ -828,7 +828,7 @@ |
828 | 828 | **/ |
829 | 829 | |
830 | 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 | 833 | return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); |
834 | 834 | } |
... | ... | @@ -1005,7 +1005,7 @@ |
1005 | 1005 | ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
1006 | 1006 | { |
1007 | 1007 | struct ip6_tnl *t = netdev_priv(dev); |
1008 | - struct iphdr *iph = ip_hdr(skb); | |
1008 | + const struct iphdr *iph = ip_hdr(skb); | |
1009 | 1009 | int encap_limit = -1; |
1010 | 1010 | struct flowi6 fl6; |
1011 | 1011 | __u8 dsfield; |
net/ipv6/ip6mr.c
... | ... | @@ -989,8 +989,8 @@ |
989 | 989 | } |
990 | 990 | |
991 | 991 | static struct mfc6_cache *ip6mr_cache_find(struct mr6_table *mrt, |
992 | - struct in6_addr *origin, | |
993 | - struct in6_addr *mcastgrp) | |
992 | + const struct in6_addr *origin, | |
993 | + const struct in6_addr *mcastgrp) | |
994 | 994 | { |
995 | 995 | int line = MFC6_HASH(mcastgrp, origin); |
996 | 996 | struct mfc6_cache *c; |
net/ipv6/ipcomp6.c
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | { |
56 | 56 | struct net *net = dev_net(skb->dev); |
57 | 57 | __be32 spi; |
58 | - struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | |
58 | + const struct ipv6hdr *iph = (const struct ipv6hdr *)skb->data; | |
59 | 59 | struct ip_comp_hdr *ipcomph = |
60 | 60 | (struct ip_comp_hdr *)(skb->data + offset); |
61 | 61 | struct xfrm_state *x; |
... | ... | @@ -64,7 +64,8 @@ |
64 | 64 | return; |
65 | 65 | |
66 | 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 | 69 | if (!x) |
69 | 70 | return; |
70 | 71 |
net/ipv6/mcast.c
... | ... | @@ -92,16 +92,16 @@ |
92 | 92 | static void mld_ifc_timer_expire(unsigned long data); |
93 | 93 | static void mld_ifc_event(struct inet6_dev *idev); |
94 | 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 | 96 | static void mld_clear_delrec(struct inet6_dev *idev); |
97 | 97 | static int sf_setstate(struct ifmcaddr6 *pmc); |
98 | 98 | static void sf_markstate(struct ifmcaddr6 *pmc); |
99 | 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, | |
101 | - int sfmode, int sfcount, struct in6_addr *psfsrc, | |
100 | +static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |
101 | + int sfmode, int sfcount, const struct in6_addr *psfsrc, | |
102 | 102 | int delta); |
103 | -static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, | |
104 | - int sfmode, int sfcount, struct in6_addr *psfsrc, | |
103 | +static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |
104 | + int sfmode, int sfcount, const struct in6_addr *psfsrc, | |
105 | 105 | int delta); |
106 | 106 | static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, |
107 | 107 | struct inet6_dev *idev); |
... | ... | @@ -250,7 +250,7 @@ |
250 | 250 | |
251 | 251 | /* called with rcu_read_lock() */ |
252 | 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 | 254 | int ifindex) |
255 | 255 | { |
256 | 256 | struct net_device *dev = NULL; |
... | ... | @@ -451,7 +451,7 @@ |
451 | 451 | |
452 | 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 | 455 | struct ipv6_mc_socklist *pmc; |
456 | 456 | struct inet6_dev *idev; |
457 | 457 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
... | ... | @@ -542,7 +542,7 @@ |
542 | 542 | struct group_filter __user *optval, int __user *optlen) |
543 | 543 | { |
544 | 544 | int err, i, count, copycount; |
545 | - struct in6_addr *group; | |
545 | + const struct in6_addr *group; | |
546 | 546 | struct ipv6_mc_socklist *pmc; |
547 | 547 | struct inet6_dev *idev; |
548 | 548 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
... | ... | @@ -752,7 +752,7 @@ |
752 | 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 | 757 | struct ifmcaddr6 *pmc, *pmc_prev; |
758 | 758 | struct ip6_sf_list *psf, *psf_next; |
... | ... | @@ -1052,7 +1052,7 @@ |
1052 | 1052 | |
1053 | 1053 | /* mark EXCLUDE-mode sources */ |
1054 | 1054 | static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, |
1055 | - struct in6_addr *srcs) | |
1055 | + const struct in6_addr *srcs) | |
1056 | 1056 | { |
1057 | 1057 | struct ip6_sf_list *psf; |
1058 | 1058 | int i, scount; |
... | ... | @@ -1080,7 +1080,7 @@ |
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, |
1083 | - struct in6_addr *srcs) | |
1083 | + const struct in6_addr *srcs) | |
1084 | 1084 | { |
1085 | 1085 | struct ip6_sf_list *psf; |
1086 | 1086 | int i, scount; |
... | ... | @@ -1115,7 +1115,7 @@ |
1115 | 1115 | { |
1116 | 1116 | struct mld2_query *mlh2 = NULL; |
1117 | 1117 | struct ifmcaddr6 *ma; |
1118 | - struct in6_addr *group; | |
1118 | + const struct in6_addr *group; | |
1119 | 1119 | unsigned long max_delay; |
1120 | 1120 | struct inet6_dev *idev; |
1121 | 1121 | struct mld_msg *mld; |
... | ... | @@ -1821,7 +1821,7 @@ |
1821 | 1821 | } |
1822 | 1822 | |
1823 | 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 | 1826 | struct ip6_sf_list *psf, *psf_prev; |
1827 | 1827 | int rv = 0; |
... | ... | @@ -1857,8 +1857,8 @@ |
1857 | 1857 | return rv; |
1858 | 1858 | } |
1859 | 1859 | |
1860 | -static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, | |
1861 | - int sfmode, int sfcount, struct in6_addr *psfsrc, | |
1860 | +static int ip6_mc_del_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |
1861 | + int sfmode, int sfcount, const struct in6_addr *psfsrc, | |
1862 | 1862 | int delta) |
1863 | 1863 | { |
1864 | 1864 | struct ifmcaddr6 *pmc; |
... | ... | @@ -1918,7 +1918,7 @@ |
1918 | 1918 | * Add multicast single-source filter to the interface list |
1919 | 1919 | */ |
1920 | 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 | 1923 | struct ip6_sf_list *psf, *psf_prev; |
1924 | 1924 | |
... | ... | @@ -2021,8 +2021,8 @@ |
2021 | 2021 | /* |
2022 | 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, | |
2025 | - int sfmode, int sfcount, struct in6_addr *psfsrc, | |
2024 | +static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |
2025 | + int sfmode, int sfcount, const struct in6_addr *psfsrc, | |
2026 | 2026 | int delta) |
2027 | 2027 | { |
2028 | 2028 | struct ifmcaddr6 *pmc; |
net/ipv6/mip6.c
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | |
127 | 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 | 130 | struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; |
131 | 131 | int err = destopt->nexthdr; |
132 | 132 | |
... | ... | @@ -181,8 +181,8 @@ |
181 | 181 | } |
182 | 182 | |
183 | 183 | static inline int mip6_report_rl_allow(struct timeval *stamp, |
184 | - struct in6_addr *dst, | |
185 | - struct in6_addr *src, int iif) | |
184 | + const struct in6_addr *dst, | |
185 | + const struct in6_addr *src, int iif) | |
186 | 186 | { |
187 | 187 | int allow = 0; |
188 | 188 | |
... | ... | @@ -349,7 +349,7 @@ |
349 | 349 | |
350 | 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 | 353 | struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; |
354 | 354 | int err = rt2->rt_hdr.nexthdr; |
355 | 355 |
net/ipv6/ndisc.c
... | ... | @@ -324,7 +324,7 @@ |
324 | 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 | 329 | switch (dev->type) { |
330 | 330 | case ARPHRD_ETHER: |
... | ... | @@ -748,8 +748,8 @@ |
748 | 748 | static void ndisc_recv_ns(struct sk_buff *skb) |
749 | 749 | { |
750 | 750 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
751 | - struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | |
752 | - struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | |
751 | + const struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | |
752 | + const struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | |
753 | 753 | u8 *lladdr = NULL; |
754 | 754 | u32 ndoptlen = skb->tail - (skb->transport_header + |
755 | 755 | offsetof(struct nd_msg, opt)); |
... | ... | @@ -924,8 +924,8 @@ |
924 | 924 | static void ndisc_recv_na(struct sk_buff *skb) |
925 | 925 | { |
926 | 926 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
927 | - struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | |
928 | - struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | |
927 | + const struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | |
928 | + const struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | |
929 | 929 | u8 *lladdr = NULL; |
930 | 930 | u32 ndoptlen = skb->tail - (skb->transport_header + |
931 | 931 | offsetof(struct nd_msg, opt)); |
... | ... | @@ -1038,7 +1038,7 @@ |
1038 | 1038 | unsigned long ndoptlen = skb->len - sizeof(*rs_msg); |
1039 | 1039 | struct neighbour *neigh; |
1040 | 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 | 1042 | struct ndisc_options ndopts; |
1043 | 1043 | u8 *lladdr = NULL; |
1044 | 1044 | |
... | ... | @@ -1435,8 +1435,8 @@ |
1435 | 1435 | { |
1436 | 1436 | struct inet6_dev *in6_dev; |
1437 | 1437 | struct icmp6hdr *icmph; |
1438 | - struct in6_addr *dest; | |
1439 | - struct in6_addr *target; /* new first hop to destination */ | |
1438 | + const struct in6_addr *dest; | |
1439 | + const struct in6_addr *target; /* new first hop to destination */ | |
1440 | 1440 | struct neighbour *neigh; |
1441 | 1441 | int on_link = 0; |
1442 | 1442 | struct ndisc_options ndopts; |
... | ... | @@ -1469,7 +1469,7 @@ |
1469 | 1469 | } |
1470 | 1470 | |
1471 | 1471 | icmph = icmp6_hdr(skb); |
1472 | - target = (struct in6_addr *) (icmph + 1); | |
1472 | + target = (const struct in6_addr *) (icmph + 1); | |
1473 | 1473 | dest = target + 1; |
1474 | 1474 | |
1475 | 1475 | if (ipv6_addr_is_multicast(dest)) { |
net/ipv6/netfilter.c
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | int ip6_route_me_harder(struct sk_buff *skb) |
14 | 14 | { |
15 | 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 | 17 | struct dst_entry *dst; |
18 | 18 | struct flowi6 fl6 = { |
19 | 19 | .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); |
68 | 68 | |
69 | 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 | 72 | rt_info->daddr = iph->daddr; |
73 | 73 | rt_info->saddr = iph->saddr; |
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry); |
82 | 82 | |
83 | 83 | if (entry->hook == NF_INET_LOCAL_OUT) { |
84 | - struct ipv6hdr *iph = ipv6_hdr(skb); | |
84 | + const struct ipv6hdr *iph = ipv6_hdr(skb); | |
85 | 85 | if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || |
86 | 86 | !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || |
87 | 87 | skb->mark != rt_info->mark) |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
109 | 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 | 112 | __sum16 csum = 0; |
113 | 113 | |
114 | 114 | switch (skb->ip_summed) { |
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | unsigned int dataoff, unsigned int len, |
143 | 143 | u_int8_t protocol) |
144 | 144 | { |
145 | - struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
145 | + const struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
146 | 146 | __wsum hsum; |
147 | 147 | __sum16 csum = 0; |
148 | 148 |
net/ipv6/raw.c
... | ... | @@ -67,8 +67,8 @@ |
67 | 67 | }; |
68 | 68 | |
69 | 69 | static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, |
70 | - unsigned short num, struct in6_addr *loc_addr, | |
71 | - struct in6_addr *rmt_addr, int dif) | |
70 | + unsigned short num, const struct in6_addr *loc_addr, | |
71 | + const struct in6_addr *rmt_addr, int dif) | |
72 | 72 | { |
73 | 73 | struct hlist_node *node; |
74 | 74 | int is_multicast = ipv6_addr_is_multicast(loc_addr); |
... | ... | @@ -154,8 +154,8 @@ |
154 | 154 | */ |
155 | 155 | static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) |
156 | 156 | { |
157 | - struct in6_addr *saddr; | |
158 | - struct in6_addr *daddr; | |
157 | + const struct in6_addr *saddr; | |
158 | + const struct in6_addr *daddr; | |
159 | 159 | struct sock *sk; |
160 | 160 | int delivered = 0; |
161 | 161 | __u8 hash; |
... | ... | @@ -348,7 +348,7 @@ |
348 | 348 | { |
349 | 349 | struct sock *sk; |
350 | 350 | int hash; |
351 | - struct in6_addr *saddr, *daddr; | |
351 | + const struct in6_addr *saddr, *daddr; | |
352 | 352 | struct net *net; |
353 | 353 | |
354 | 354 | hash = nexthdr & (RAW_HTABLE_SIZE - 1); |
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | sk = sk_head(&raw_v6_hashinfo.ht[hash]); |
358 | 358 | if (sk != NULL) { |
359 | 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 | 361 | saddr = &ip6h->saddr; |
362 | 362 | daddr = &ip6h->daddr; |
363 | 363 | net = dev_net(skb->dev); |
... | ... | @@ -1231,7 +1231,7 @@ |
1231 | 1231 | static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) |
1232 | 1232 | { |
1233 | 1233 | struct ipv6_pinfo *np = inet6_sk(sp); |
1234 | - struct in6_addr *dest, *src; | |
1234 | + const struct in6_addr *dest, *src; | |
1235 | 1235 | __u16 destp, srcp; |
1236 | 1236 | |
1237 | 1237 | dest = &np->daddr; |
net/ipv6/reassembly.c
... | ... | @@ -224,7 +224,7 @@ |
224 | 224 | } |
225 | 225 | |
226 | 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 | 229 | struct inet_frag_queue *q; |
230 | 230 | struct ip6_create_arg arg; |
... | ... | @@ -535,7 +535,7 @@ |
535 | 535 | { |
536 | 536 | struct frag_hdr *fhdr; |
537 | 537 | struct frag_queue *fq; |
538 | - struct ipv6hdr *hdr = ipv6_hdr(skb); | |
538 | + const struct ipv6hdr *hdr = ipv6_hdr(skb); | |
539 | 539 | struct net *net = dev_net(skb_dst(skb)->dev); |
540 | 540 | |
541 | 541 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS); |
net/ipv6/route.c
... | ... | @@ -89,12 +89,12 @@ |
89 | 89 | |
90 | 90 | #ifdef CONFIG_IPV6_ROUTE_INFO |
91 | 91 | static struct rt6_info *rt6_add_route_info(struct net *net, |
92 | - struct in6_addr *prefix, int prefixlen, | |
93 | - struct in6_addr *gwaddr, int ifindex, | |
92 | + const struct in6_addr *prefix, int prefixlen, | |
93 | + const struct in6_addr *gwaddr, int ifindex, | |
94 | 94 | unsigned pref); |
95 | 95 | static struct rt6_info *rt6_get_route_info(struct net *net, |
96 | - struct in6_addr *prefix, int prefixlen, | |
97 | - struct in6_addr *gwaddr, int ifindex); | |
96 | + const struct in6_addr *prefix, int prefixlen, | |
97 | + const struct in6_addr *gwaddr, int ifindex); | |
98 | 98 | #endif |
99 | 99 | |
100 | 100 | static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) |
... | ... | @@ -283,7 +283,7 @@ |
283 | 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 | 288 | return ipv6_addr_type(daddr) & |
289 | 289 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); |
... | ... | @@ -295,7 +295,7 @@ |
295 | 295 | |
296 | 296 | static inline struct rt6_info *rt6_device_match(struct net *net, |
297 | 297 | struct rt6_info *rt, |
298 | - struct in6_addr *saddr, | |
298 | + const struct in6_addr *saddr, | |
299 | 299 | int oif, |
300 | 300 | int flags) |
301 | 301 | { |
... | ... | @@ -507,7 +507,7 @@ |
507 | 507 | |
508 | 508 | #ifdef CONFIG_IPV6_ROUTE_INFO |
509 | 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 | 512 | struct net *net = dev_net(dev); |
513 | 513 | struct route_info *rinfo = (struct route_info *) opt; |
... | ... | @@ -670,8 +670,8 @@ |
670 | 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, | |
674 | - struct in6_addr *saddr) | |
673 | +static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, const struct in6_addr *daddr, | |
674 | + const struct in6_addr *saddr) | |
675 | 675 | { |
676 | 676 | struct rt6_info *rt; |
677 | 677 | |
... | ... | @@ -739,7 +739,7 @@ |
739 | 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 | 744 | struct rt6_info *rt = ip6_rt_copy(ort); |
745 | 745 | if (rt) { |
... | ... | @@ -830,7 +830,7 @@ |
830 | 830 | |
831 | 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 | 834 | struct net *net = dev_net(skb->dev); |
835 | 835 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
836 | 836 | struct flowi6 fl6 = { |
... | ... | @@ -1272,7 +1272,7 @@ |
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | if (cfg->fc_flags & RTF_GATEWAY) { |
1275 | - struct in6_addr *gw_addr; | |
1275 | + const struct in6_addr *gw_addr; | |
1276 | 1276 | int gwa_type; |
1277 | 1277 | |
1278 | 1278 | gw_addr = &cfg->fc_gateway; |
... | ... | @@ -1512,9 +1512,9 @@ |
1512 | 1512 | return rt; |
1513 | 1513 | }; |
1514 | 1514 | |
1515 | -static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | |
1516 | - struct in6_addr *src, | |
1517 | - struct in6_addr *gateway, | |
1515 | +static struct rt6_info *ip6_route_redirect(const struct in6_addr *dest, | |
1516 | + const struct in6_addr *src, | |
1517 | + const struct in6_addr *gateway, | |
1518 | 1518 | struct net_device *dev) |
1519 | 1519 | { |
1520 | 1520 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
... | ... | @@ -1536,8 +1536,8 @@ |
1536 | 1536 | flags, __ip6_route_redirect); |
1537 | 1537 | } |
1538 | 1538 | |
1539 | -void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, | |
1540 | - struct in6_addr *saddr, | |
1539 | +void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, | |
1540 | + const struct in6_addr *saddr, | |
1541 | 1541 | struct neighbour *neigh, u8 *lladdr, int on_link) |
1542 | 1542 | { |
1543 | 1543 | struct rt6_info *rt, *nrt = NULL; |
... | ... | @@ -1611,7 +1611,7 @@ |
1611 | 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 | 1615 | struct net *net, u32 pmtu, int ifindex) |
1616 | 1616 | { |
1617 | 1617 | struct rt6_info *rt, *nrt; |
... | ... | @@ -1696,7 +1696,7 @@ |
1696 | 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 | 1700 | struct net_device *dev, u32 pmtu) |
1701 | 1701 | { |
1702 | 1702 | struct net *net = dev_net(dev); |
... | ... | @@ -1756,8 +1756,8 @@ |
1756 | 1756 | |
1757 | 1757 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1758 | 1758 | static struct rt6_info *rt6_get_route_info(struct net *net, |
1759 | - struct in6_addr *prefix, int prefixlen, | |
1760 | - struct in6_addr *gwaddr, int ifindex) | |
1759 | + const struct in6_addr *prefix, int prefixlen, | |
1760 | + const struct in6_addr *gwaddr, int ifindex) | |
1761 | 1761 | { |
1762 | 1762 | struct fib6_node *fn; |
1763 | 1763 | struct rt6_info *rt = NULL; |
... | ... | @@ -1788,8 +1788,8 @@ |
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | static struct rt6_info *rt6_add_route_info(struct net *net, |
1791 | - struct in6_addr *prefix, int prefixlen, | |
1792 | - struct in6_addr *gwaddr, int ifindex, | |
1791 | + const struct in6_addr *prefix, int prefixlen, | |
1792 | + const struct in6_addr *gwaddr, int ifindex, | |
1793 | 1793 | unsigned pref) |
1794 | 1794 | { |
1795 | 1795 | struct fib6_config cfg = { |
... | ... | @@ -1817,7 +1817,7 @@ |
1817 | 1817 | } |
1818 | 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 | 1822 | struct rt6_info *rt; |
1823 | 1823 | struct fib6_table *table; |
... | ... | @@ -1839,7 +1839,7 @@ |
1839 | 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 | 1843 | struct net_device *dev, |
1844 | 1844 | unsigned int pref) |
1845 | 1845 | { |
... | ... | @@ -2049,7 +2049,7 @@ |
2049 | 2049 | |
2050 | 2050 | int ip6_route_get_saddr(struct net *net, |
2051 | 2051 | struct rt6_info *rt, |
2052 | - struct in6_addr *daddr, | |
2052 | + const struct in6_addr *daddr, | |
2053 | 2053 | unsigned int prefs, |
2054 | 2054 | struct in6_addr *saddr) |
2055 | 2055 | { |
net/ipv6/sit.c
... | ... | @@ -452,7 +452,7 @@ |
452 | 452 | } |
453 | 453 | |
454 | 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 | 457 | struct ip_tunnel_prl_entry *p; |
458 | 458 | int ok = 1; |
... | ... | @@ -465,7 +465,8 @@ |
465 | 465 | else |
466 | 466 | skb->ndisc_nodetype = NDISC_NODETYPE_NODEFAULT; |
467 | 467 | } else { |
468 | - struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; | |
468 | + const struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; | |
469 | + | |
469 | 470 | if (ipv6_addr_is_isatap(addr6) && |
470 | 471 | (addr6->s6_addr32[3] == iph->saddr) && |
471 | 472 | ipv6_chk_prefix(addr6, t->dev)) |
... | ... | @@ -499,7 +500,7 @@ |
499 | 500 | 8 bytes of packet payload. It means, that precise relaying of |
500 | 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 | 504 | const int type = icmp_hdr(skb)->type; |
504 | 505 | const int code = icmp_hdr(skb)->code; |
505 | 506 | struct ip_tunnel *t; |
... | ... | @@ -557,7 +558,7 @@ |
557 | 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 | 563 | if (INET_ECN_is_ce(iph->tos)) |
563 | 564 | IP6_ECN_set_ce(ipv6_hdr(skb)); |
... | ... | @@ -565,7 +566,7 @@ |
565 | 566 | |
566 | 567 | static int ipip6_rcv(struct sk_buff *skb) |
567 | 568 | { |
568 | - struct iphdr *iph; | |
569 | + const struct iphdr *iph; | |
569 | 570 | struct ip_tunnel *tunnel; |
570 | 571 | |
571 | 572 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) |
... | ... | @@ -621,7 +622,7 @@ |
621 | 622 | * comes from 6rd / 6to4 (RFC 3056) addr space. |
622 | 623 | */ |
623 | 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 | 627 | __be32 dst = 0; |
627 | 628 | |
... | ... | @@ -664,8 +665,8 @@ |
664 | 665 | { |
665 | 666 | struct ip_tunnel *tunnel = netdev_priv(dev); |
666 | 667 | struct pcpu_tstats *tstats; |
667 | - struct iphdr *tiph = &tunnel->parms.iph; | |
668 | - struct ipv6hdr *iph6 = ipv6_hdr(skb); | |
668 | + const struct iphdr *tiph = &tunnel->parms.iph; | |
669 | + const struct ipv6hdr *iph6 = ipv6_hdr(skb); | |
669 | 670 | u8 tos = tunnel->parms.iph.tos; |
670 | 671 | __be16 df = tiph->frag_off; |
671 | 672 | struct rtable *rt; /* Route to the other host */ |
... | ... | @@ -674,7 +675,7 @@ |
674 | 675 | unsigned int max_headroom; /* The extra header space needed */ |
675 | 676 | __be32 dst = tiph->daddr; |
676 | 677 | int mtu; |
677 | - struct in6_addr *addr6; | |
678 | + const struct in6_addr *addr6; | |
678 | 679 | int addr_type; |
679 | 680 | |
680 | 681 | if (skb->protocol != htons(ETH_P_IPV6)) |
... | ... | @@ -693,7 +694,7 @@ |
693 | 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 | 698 | addr_type = ipv6_addr_type(addr6); |
698 | 699 | |
699 | 700 | if ((addr_type & IPV6_ADDR_UNICAST) && |
... | ... | @@ -718,7 +719,7 @@ |
718 | 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 | 723 | addr_type = ipv6_addr_type(addr6); |
723 | 724 | |
724 | 725 | if (addr_type == IPV6_ADDR_ANY) { |
... | ... | @@ -849,7 +850,7 @@ |
849 | 850 | { |
850 | 851 | struct net_device *tdev = NULL; |
851 | 852 | struct ip_tunnel *tunnel; |
852 | - struct iphdr *iph; | |
853 | + const struct iphdr *iph; | |
853 | 854 | |
854 | 855 | tunnel = netdev_priv(dev); |
855 | 856 | iph = &tunnel->parms.iph; |
net/ipv6/syncookies.c
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS], |
67 | 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 | 70 | __be16 sport, __be16 dport, u32 count, int c) |
71 | 71 | { |
72 | 72 | __u32 *tmp = __get_cpu_var(ipv6_cookie_scratch); |
... | ... | @@ -86,7 +86,8 @@ |
86 | 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 | 91 | __be16 sport, __be16 dport, __u32 sseq, |
91 | 92 | __u32 count, __u32 data) |
92 | 93 | { |
... | ... | @@ -96,8 +97,8 @@ |
96 | 97 | & COOKIEMASK)); |
97 | 98 | } |
98 | 99 | |
99 | -static __u32 check_tcp_syn_cookie(__u32 cookie, struct in6_addr *saddr, | |
100 | - struct in6_addr *daddr, __be16 sport, | |
100 | +static __u32 check_tcp_syn_cookie(__u32 cookie, const struct in6_addr *saddr, | |
101 | + const struct in6_addr *daddr, __be16 sport, | |
101 | 102 | __be16 dport, __u32 sseq, __u32 count, |
102 | 103 | __u32 maxdiff) |
103 | 104 | { |
... | ... | @@ -116,7 +117,7 @@ |
116 | 117 | |
117 | 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 | 121 | const struct tcphdr *th = tcp_hdr(skb); |
121 | 122 | int mssind; |
122 | 123 | const __u16 mss = *mssp; |
... | ... | @@ -138,7 +139,7 @@ |
138 | 139 | |
139 | 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 | 143 | const struct tcphdr *th = tcp_hdr(skb); |
143 | 144 | __u32 seq = ntohl(th->seq) - 1; |
144 | 145 | __u32 mssind = check_tcp_syn_cookie(cookie, &iph->saddr, &iph->daddr, |
net/ipv6/tcp_ipv6.c
... | ... | @@ -76,8 +76,8 @@ |
76 | 76 | |
77 | 77 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
78 | 78 | static void __tcp_v6_send_check(struct sk_buff *skb, |
79 | - struct in6_addr *saddr, | |
80 | - struct in6_addr *daddr); | |
79 | + const struct in6_addr *saddr, | |
80 | + const struct in6_addr *daddr); | |
81 | 81 | |
82 | 82 | static const struct inet_connection_sock_af_ops ipv6_mapped; |
83 | 83 | static const struct inet_connection_sock_af_ops ipv6_specific; |
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; |
87 | 87 | #else |
88 | 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 | 91 | return NULL; |
92 | 92 | } |
... | ... | @@ -106,8 +106,8 @@ |
106 | 106 | } |
107 | 107 | |
108 | 108 | static __inline__ __sum16 tcp_v6_check(int len, |
109 | - struct in6_addr *saddr, | |
110 | - struct in6_addr *daddr, | |
109 | + const struct in6_addr *saddr, | |
110 | + const struct in6_addr *daddr, | |
111 | 111 | __wsum base) |
112 | 112 | { |
113 | 113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); |
... | ... | @@ -331,7 +331,7 @@ |
331 | 331 | static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
332 | 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 | 335 | const struct tcphdr *th = (struct tcphdr *)(skb->data+offset); |
336 | 336 | struct ipv6_pinfo *np; |
337 | 337 | struct sock *sk; |
... | ... | @@ -551,7 +551,7 @@ |
551 | 551 | |
552 | 552 | #ifdef CONFIG_TCP_MD5SIG |
553 | 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 | 556 | struct tcp_sock *tp = tcp_sk(sk); |
557 | 557 | int i; |
... | ... | @@ -580,7 +580,7 @@ |
580 | 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 | 584 | char *newkey, u8 newkeylen) |
585 | 585 | { |
586 | 586 | /* Add key to the list */ |
... | ... | @@ -645,7 +645,7 @@ |
645 | 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 | 650 | struct tcp_sock *tp = tcp_sk(sk); |
651 | 651 | int i; |
... | ... | @@ -753,8 +753,8 @@ |
753 | 753 | } |
754 | 754 | |
755 | 755 | static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, |
756 | - struct in6_addr *daddr, | |
757 | - struct in6_addr *saddr, int nbytes) | |
756 | + const struct in6_addr *daddr, | |
757 | + const struct in6_addr *saddr, int nbytes) | |
758 | 758 | { |
759 | 759 | struct tcp6_pseudohdr *bp; |
760 | 760 | struct scatterlist sg; |
... | ... | @@ -771,7 +771,7 @@ |
771 | 771 | } |
772 | 772 | |
773 | 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 | 775 | struct tcphdr *th) |
776 | 776 | { |
777 | 777 | struct tcp_md5sig_pool *hp; |
... | ... | @@ -807,7 +807,7 @@ |
807 | 807 | struct sock *sk, struct request_sock *req, |
808 | 808 | struct sk_buff *skb) |
809 | 809 | { |
810 | - struct in6_addr *saddr, *daddr; | |
810 | + const struct in6_addr *saddr, *daddr; | |
811 | 811 | struct tcp_md5sig_pool *hp; |
812 | 812 | struct hash_desc *desc; |
813 | 813 | struct tcphdr *th = tcp_hdr(skb); |
... | ... | @@ -819,7 +819,7 @@ |
819 | 819 | saddr = &inet6_rsk(req)->loc_addr; |
820 | 820 | daddr = &inet6_rsk(req)->rmt_addr; |
821 | 821 | } else { |
822 | - struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
822 | + const struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
823 | 823 | saddr = &ip6h->saddr; |
824 | 824 | daddr = &ip6h->daddr; |
825 | 825 | } |
... | ... | @@ -857,7 +857,7 @@ |
857 | 857 | { |
858 | 858 | __u8 *hash_location = NULL; |
859 | 859 | struct tcp_md5sig_key *hash_expected; |
860 | - struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
860 | + const struct ipv6hdr *ip6h = ipv6_hdr(skb); | |
861 | 861 | struct tcphdr *th = tcp_hdr(skb); |
862 | 862 | int genhash; |
863 | 863 | u8 newhash[16]; |
... | ... | @@ -915,7 +915,7 @@ |
915 | 915 | #endif |
916 | 916 | |
917 | 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 | 920 | struct tcphdr *th = tcp_hdr(skb); |
921 | 921 | |
... | ... | @@ -939,7 +939,7 @@ |
939 | 939 | |
940 | 940 | static int tcp_v6_gso_send_check(struct sk_buff *skb) |
941 | 941 | { |
942 | - struct ipv6hdr *ipv6h; | |
942 | + const struct ipv6hdr *ipv6h; | |
943 | 943 | struct tcphdr *th; |
944 | 944 | |
945 | 945 | if (!pskb_may_pull(skb, sizeof(*th))) |
... | ... | @@ -957,7 +957,7 @@ |
957 | 957 | static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, |
958 | 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 | 962 | switch (skb->ip_summed) { |
963 | 963 | case CHECKSUM_COMPLETE: |
... | ... | @@ -978,7 +978,7 @@ |
978 | 978 | |
979 | 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 | 982 | struct tcphdr *th = tcp_hdr(skb); |
983 | 983 | |
984 | 984 | th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb), |
... | ... | @@ -1702,7 +1702,7 @@ |
1702 | 1702 | static int tcp_v6_rcv(struct sk_buff *skb) |
1703 | 1703 | { |
1704 | 1704 | struct tcphdr *th; |
1705 | - struct ipv6hdr *hdr; | |
1705 | + const struct ipv6hdr *hdr; | |
1706 | 1706 | struct sock *sk; |
1707 | 1707 | int ret; |
1708 | 1708 | struct net *net = dev_net(skb->dev); |
... | ... | @@ -2028,8 +2028,8 @@ |
2028 | 2028 | struct sock *sk, struct request_sock *req, int i, int uid) |
2029 | 2029 | { |
2030 | 2030 | int ttd = req->expires - jiffies; |
2031 | - struct in6_addr *src = &inet6_rsk(req)->loc_addr; | |
2032 | - struct in6_addr *dest = &inet6_rsk(req)->rmt_addr; | |
2031 | + const struct in6_addr *src = &inet6_rsk(req)->loc_addr; | |
2032 | + const struct in6_addr *dest = &inet6_rsk(req)->rmt_addr; | |
2033 | 2033 | |
2034 | 2034 | if (ttd < 0) |
2035 | 2035 | ttd = 0; |
... | ... | @@ -2057,7 +2057,7 @@ |
2057 | 2057 | |
2058 | 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 | 2061 | __u16 destp, srcp; |
2062 | 2062 | int timer_active; |
2063 | 2063 | unsigned long timer_expires; |
... | ... | @@ -2114,7 +2114,7 @@ |
2114 | 2114 | static void get_timewait6_sock(struct seq_file *seq, |
2115 | 2115 | struct inet_timewait_sock *tw, int i) |
2116 | 2116 | { |
2117 | - struct in6_addr *dest, *src; | |
2117 | + const struct in6_addr *dest, *src; | |
2118 | 2118 | __u16 destp, srcp; |
2119 | 2119 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
2120 | 2120 | int ttd = tw->tw_ttd - jiffies; |
net/ipv6/udp.c
... | ... | @@ -311,7 +311,7 @@ |
311 | 311 | struct udp_table *udptable) |
312 | 312 | { |
313 | 313 | struct sock *sk; |
314 | - struct ipv6hdr *iph = ipv6_hdr(skb); | |
314 | + const struct ipv6hdr *iph = ipv6_hdr(skb); | |
315 | 315 | |
316 | 316 | if (unlikely(sk = skb_steal_sock(skb))) |
317 | 317 | return sk; |
... | ... | @@ -463,9 +463,9 @@ |
463 | 463 | struct udp_table *udptable) |
464 | 464 | { |
465 | 465 | struct ipv6_pinfo *np; |
466 | - struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; | |
467 | - struct in6_addr *saddr = &hdr->saddr; | |
468 | - struct in6_addr *daddr = &hdr->daddr; | |
466 | + const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; | |
467 | + const struct in6_addr *saddr = &hdr->saddr; | |
468 | + const struct in6_addr *daddr = &hdr->daddr; | |
469 | 469 | struct udphdr *uh = (struct udphdr*)(skb->data+offset); |
470 | 470 | struct sock *sk; |
471 | 471 | int err; |
... | ... | @@ -553,8 +553,8 @@ |
553 | 553 | } |
554 | 554 | |
555 | 555 | static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, |
556 | - __be16 loc_port, struct in6_addr *loc_addr, | |
557 | - __be16 rmt_port, struct in6_addr *rmt_addr, | |
556 | + __be16 loc_port, const struct in6_addr *loc_addr, | |
557 | + __be16 rmt_port, const struct in6_addr *rmt_addr, | |
558 | 558 | int dif) |
559 | 559 | { |
560 | 560 | struct hlist_nulls_node *node; |
... | ... | @@ -633,7 +633,7 @@ |
633 | 633 | * so we don't need to lock the hashes. |
634 | 634 | */ |
635 | 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 | 637 | struct udp_table *udptable) |
638 | 638 | { |
639 | 639 | struct sock *sk, *stack[256 / sizeof(struct sock *)]; |
... | ... | @@ -716,7 +716,7 @@ |
716 | 716 | struct net *net = dev_net(skb->dev); |
717 | 717 | struct sock *sk; |
718 | 718 | struct udphdr *uh; |
719 | - struct in6_addr *saddr, *daddr; | |
719 | + const struct in6_addr *saddr, *daddr; | |
720 | 720 | u32 ulen = 0; |
721 | 721 | |
722 | 722 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) |
... | ... | @@ -1278,7 +1278,7 @@ |
1278 | 1278 | |
1279 | 1279 | static int udp6_ufo_send_check(struct sk_buff *skb) |
1280 | 1280 | { |
1281 | - struct ipv6hdr *ipv6h; | |
1281 | + const struct ipv6hdr *ipv6h; | |
1282 | 1282 | struct udphdr *uh; |
1283 | 1283 | |
1284 | 1284 | if (!pskb_may_pull(skb, sizeof(*uh))) |
... | ... | @@ -1382,7 +1382,7 @@ |
1382 | 1382 | { |
1383 | 1383 | struct inet_sock *inet = inet_sk(sp); |
1384 | 1384 | struct ipv6_pinfo *np = inet6_sk(sp); |
1385 | - struct in6_addr *dest, *src; | |
1385 | + const struct in6_addr *dest, *src; | |
1386 | 1386 | __u16 destp, srcp; |
1387 | 1387 | |
1388 | 1388 | dest = &np->daddr; |
net/ipv6/xfrm6_mode_beet.c
net/ipv6/xfrm6_mode_tunnel.c
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | |
21 | 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 | 24 | struct ipv6hdr *inner_iph = ipipv6_hdr(skb); |
25 | 25 | |
26 | 26 | if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) |
... | ... | @@ -55,8 +55,8 @@ |
55 | 55 | dsfield &= ~INET_ECN_MASK; |
56 | 56 | ipv6_change_dsfield(top_iph, 0, dsfield); |
57 | 57 | top_iph->hop_limit = ip6_dst_hoplimit(dst->child); |
58 | - ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); | |
59 | - ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); | |
58 | + ipv6_addr_copy(&top_iph->saddr, (const struct in6_addr *)&x->props.saddr); | |
59 | + ipv6_addr_copy(&top_iph->daddr, (const struct in6_addr *)&x->id.daddr); | |
60 | 60 | return 0; |
61 | 61 | } |
62 | 62 |
net/ipv6/xfrm6_policy.c
... | ... | @@ -124,7 +124,7 @@ |
124 | 124 | struct flowi6 *fl6 = &fl->u.ip6; |
125 | 125 | int onlyproto = 0; |
126 | 126 | u16 offset = skb_network_header_len(skb); |
127 | - struct ipv6hdr *hdr = ipv6_hdr(skb); | |
127 | + const struct ipv6hdr *hdr = ipv6_hdr(skb); | |
128 | 128 | struct ipv6_opt_hdr *exthdr; |
129 | 129 | const unsigned char *nh = skb_network_header(skb); |
130 | 130 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; |
net/ipv6/xfrm6_tunnel.c
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | |
69 | 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 | 73 | unsigned h; |
74 | 74 | |
... | ... | @@ -85,7 +85,7 @@ |
85 | 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 | 90 | struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); |
91 | 91 | struct xfrm6_tunnel_spi *x6spi; |
... | ... | @@ -101,7 +101,7 @@ |
101 | 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 | 106 | struct xfrm6_tunnel_spi *x6spi; |
107 | 107 | u32 spi; |
108 | 108 | |
... | ... | @@ -237,10 +237,10 @@ |
237 | 237 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) |
238 | 238 | { |
239 | 239 | struct net *net = dev_net(skb->dev); |
240 | - struct ipv6hdr *iph = ipv6_hdr(skb); | |
240 | + const struct ipv6hdr *iph = ipv6_hdr(skb); | |
241 | 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 | 244 | return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? : 0; |
245 | 245 | } |
246 | 246 |
net/key/af_key.c
... | ... | @@ -712,7 +712,7 @@ |
712 | 712 | sin6->sin6_family = AF_INET6; |
713 | 713 | sin6->sin6_port = port; |
714 | 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 | 716 | sin6->sin6_scope_id = 0; |
717 | 717 | return 128; |
718 | 718 | } |
net/sched/sch_sfq.c
net/sctp/input.c
... | ... | @@ -565,7 +565,7 @@ |
565 | 565 | */ |
566 | 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 | 569 | const int ihlen = iph->ihl * 4; |
570 | 570 | const int type = icmp_hdr(skb)->type; |
571 | 571 | const int code = icmp_hdr(skb)->code; |
net/sctp/ipv6.c
... | ... | @@ -531,7 +531,7 @@ |
531 | 531 | static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) |
532 | 532 | { |
533 | 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 | 536 | type = ipv6_addr_type(in6); |
537 | 537 | if (IPV6_ADDR_ANY == type) |
net/xfrm/xfrm_state.c
... | ... | @@ -1036,15 +1036,15 @@ |
1036 | 1036 | |
1037 | 1037 | case AF_INET6: |
1038 | 1038 | ipv6_addr_copy((struct in6_addr *)x->sel.daddr.a6, |
1039 | - (struct in6_addr *)daddr); | |
1039 | + (const struct in6_addr *)daddr); | |
1040 | 1040 | ipv6_addr_copy((struct in6_addr *)x->sel.saddr.a6, |
1041 | - (struct in6_addr *)saddr); | |
1041 | + (const struct in6_addr *)saddr); | |
1042 | 1042 | x->sel.prefixlen_d = 128; |
1043 | 1043 | x->sel.prefixlen_s = 128; |
1044 | 1044 | ipv6_addr_copy((struct in6_addr *)x->props.saddr.a6, |
1045 | - (struct in6_addr *)saddr); | |
1045 | + (const struct in6_addr *)saddr); | |
1046 | 1046 | ipv6_addr_copy((struct in6_addr *)x->id.daddr.a6, |
1047 | - (struct in6_addr *)daddr); | |
1047 | + (const struct in6_addr *)daddr); | |
1048 | 1048 | break; |
1049 | 1049 | } |
1050 | 1050 | |
... | ... | @@ -2092,8 +2092,8 @@ |
2092 | 2092 | static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, |
2093 | 2093 | struct audit_buffer *audit_buf) |
2094 | 2094 | { |
2095 | - struct iphdr *iph4; | |
2096 | - struct ipv6hdr *iph6; | |
2095 | + const struct iphdr *iph4; | |
2096 | + const struct ipv6hdr *iph6; | |
2097 | 2097 | |
2098 | 2098 | switch (family) { |
2099 | 2099 | case AF_INET: |