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>
This commit is contained in:
committed by
David S. Miller
parent
5f8629c526
commit
b71d1d426d
@@ -67,8 +67,8 @@ static struct raw_hashinfo raw_v6_hashinfo = {
|
||||
};
|
||||
|
||||
static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
|
||||
unsigned short num, struct in6_addr *loc_addr,
|
||||
struct in6_addr *rmt_addr, int dif)
|
||||
unsigned short num, const struct in6_addr *loc_addr,
|
||||
const struct in6_addr *rmt_addr, int dif)
|
||||
{
|
||||
struct hlist_node *node;
|
||||
int is_multicast = ipv6_addr_is_multicast(loc_addr);
|
||||
@@ -154,8 +154,8 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister);
|
||||
*/
|
||||
static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
|
||||
{
|
||||
struct in6_addr *saddr;
|
||||
struct in6_addr *daddr;
|
||||
const struct in6_addr *saddr;
|
||||
const struct in6_addr *daddr;
|
||||
struct sock *sk;
|
||||
int delivered = 0;
|
||||
__u8 hash;
|
||||
@@ -348,7 +348,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
|
||||
{
|
||||
struct sock *sk;
|
||||
int hash;
|
||||
struct in6_addr *saddr, *daddr;
|
||||
const struct in6_addr *saddr, *daddr;
|
||||
struct net *net;
|
||||
|
||||
hash = nexthdr & (RAW_HTABLE_SIZE - 1);
|
||||
@@ -357,7 +357,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
|
||||
sk = sk_head(&raw_v6_hashinfo.ht[hash]);
|
||||
if (sk != NULL) {
|
||||
/* Note: ipv6_hdr(skb) != skb->data */
|
||||
struct ipv6hdr *ip6h = (struct ipv6hdr *)skb->data;
|
||||
const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
|
||||
saddr = &ip6h->saddr;
|
||||
daddr = &ip6h->daddr;
|
||||
net = dev_net(skb->dev);
|
||||
@@ -1231,7 +1231,7 @@ struct proto rawv6_prot = {
|
||||
static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sp);
|
||||
struct in6_addr *dest, *src;
|
||||
const struct in6_addr *dest, *src;
|
||||
__u16 destp, srcp;
|
||||
|
||||
dest = &np->daddr;
|
||||
|
Reference in New Issue
Block a user