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
@@ -13,7 +13,7 @@
|
||||
int ip6_route_me_harder(struct sk_buff *skb)
|
||||
{
|
||||
struct net *net = dev_net(skb_dst(skb)->dev);
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
struct dst_entry *dst;
|
||||
struct flowi6 fl6 = {
|
||||
.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
|
||||
@@ -67,7 +67,7 @@ static void nf_ip6_saveroute(const struct sk_buff *skb,
|
||||
struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry);
|
||||
|
||||
if (entry->hook == NF_INET_LOCAL_OUT) {
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
|
||||
rt_info->daddr = iph->daddr;
|
||||
rt_info->saddr = iph->saddr;
|
||||
@@ -81,7 +81,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
|
||||
struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry);
|
||||
|
||||
if (entry->hook == NF_INET_LOCAL_OUT) {
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
|
||||
!ipv6_addr_equal(&iph->saddr, &rt_info->saddr) ||
|
||||
skb->mark != rt_info->mark)
|
||||
@@ -108,7 +108,7 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst,
|
||||
__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
||||
unsigned int dataoff, u_int8_t protocol)
|
||||
{
|
||||
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
__sum16 csum = 0;
|
||||
|
||||
switch (skb->ip_summed) {
|
||||
@@ -142,7 +142,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
|
||||
unsigned int dataoff, unsigned int len,
|
||||
u_int8_t protocol)
|
||||
{
|
||||
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||
__wsum hsum;
|
||||
__sum16 csum = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user