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
@@ -66,7 +66,7 @@ static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
|
||||
static DEFINE_PER_CPU(__u32 [16 + 5 + SHA_WORKSPACE_WORDS],
|
||||
ipv6_cookie_scratch);
|
||||
|
||||
static u32 cookie_hash(struct in6_addr *saddr, struct in6_addr *daddr,
|
||||
static u32 cookie_hash(const struct in6_addr *saddr, const struct in6_addr *daddr,
|
||||
__be16 sport, __be16 dport, u32 count, int c)
|
||||
{
|
||||
__u32 *tmp = __get_cpu_var(ipv6_cookie_scratch);
|
||||
@@ -86,7 +86,8 @@ static u32 cookie_hash(struct in6_addr *saddr, struct in6_addr *daddr,
|
||||
return tmp[17];
|
||||
}
|
||||
|
||||
static __u32 secure_tcp_syn_cookie(struct in6_addr *saddr, struct in6_addr *daddr,
|
||||
static __u32 secure_tcp_syn_cookie(const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
__be16 sport, __be16 dport, __u32 sseq,
|
||||
__u32 count, __u32 data)
|
||||
{
|
||||
@@ -96,8 +97,8 @@ static __u32 secure_tcp_syn_cookie(struct in6_addr *saddr, struct in6_addr *dadd
|
||||
& COOKIEMASK));
|
||||
}
|
||||
|
||||
static __u32 check_tcp_syn_cookie(__u32 cookie, struct in6_addr *saddr,
|
||||
struct in6_addr *daddr, __be16 sport,
|
||||
static __u32 check_tcp_syn_cookie(__u32 cookie, const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr, __be16 sport,
|
||||
__be16 dport, __u32 sseq, __u32 count,
|
||||
__u32 maxdiff)
|
||||
{
|
||||
@@ -116,7 +117,7 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, struct in6_addr *saddr,
|
||||
|
||||
__u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp)
|
||||
{
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct tcphdr *th = tcp_hdr(skb);
|
||||
int mssind;
|
||||
const __u16 mss = *mssp;
|
||||
@@ -138,7 +139,7 @@ __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp)
|
||||
|
||||
static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
|
||||
{
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
const struct tcphdr *th = tcp_hdr(skb);
|
||||
__u32 seq = ntohl(th->seq) - 1;
|
||||
__u32 mssind = check_tcp_syn_cookie(cookie, &iph->saddr, &iph->daddr,
|
||||
|
Reference in New Issue
Block a user