diff options
Diffstat (limited to 'include/net/ip6_checksum.h')
| -rw-r--r-- | include/net/ip6_checksum.h | 23 | 
1 files changed, 22 insertions, 1 deletions
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h index 7686e3f5033..55236cb7117 100644 --- a/include/net/ip6_checksum.h +++ b/include/net/ip6_checksum.h @@ -41,6 +41,13 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,  			__wsum csum);  #endif +static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto) +{ +	return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, +					    &ipv6_hdr(skb)->daddr, +					    skb->len, proto, 0)); +} +  static __inline__ __sum16 tcp_v6_check(int len,  				   const struct in6_addr *saddr,  				   const struct in6_addr *daddr, @@ -66,12 +73,26 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,  	}  } +#if IS_ENABLED(CONFIG_IPV6)  static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)  {  	struct ipv6_pinfo *np = inet6_sk(sk); -	__tcp_v6_send_check(skb, &np->saddr, &np->daddr); +	__tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);  } +#endif + +static inline __sum16 udp_v6_check(int len, +				   const struct in6_addr *saddr, +				   const struct in6_addr *daddr, +				   __wsum base) +{ +	return csum_ipv6_magic(saddr, daddr, len, IPPROTO_UDP, base); +} + +void udp6_set_csum(bool nocheck, struct sk_buff *skb, +		   const struct in6_addr *saddr, +		   const struct in6_addr *daddr, int len);  int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);  #endif  | 
