diff options
author | Tom Herbert <therbert@google.com> | 2014-06-04 17:19:48 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-04 22:46:38 -0700 |
commit | af5fcba7f38f3166392f4087ab734433c84f160b (patch) | |
tree | 8a6deba10cd458a72e159112ab6381bcaa352b3e /include/net/ip6_checksum.h | |
parent | 6579867c8b02606e101a6c511c2511b027ed3f4a (diff) | |
download | lwn-af5fcba7f38f3166392f4087ab734433c84f160b.tar.gz lwn-af5fcba7f38f3166392f4087ab734433c84f160b.zip |
udp: Generic functions to set checksum
Added udp_set_csum and udp6_set_csum functions to set UDP checksums
in packets. These are for simple UDP packets such as those that might
be created in UDP tunnels.
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_checksum.h')
-rw-r--r-- | include/net/ip6_checksum.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h index 8ac5c21f8456..55236cb71174 100644 --- a/include/net/ip6_checksum.h +++ b/include/net/ip6_checksum.h @@ -82,5 +82,17 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) } #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 |