diff options
author | Tom Herbert <therbert@google.com> | 2014-06-04 20:19:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-05 01:46:38 -0400 |
commit | af5fcba7f38f3166392f4087ab734433c84f160b (patch) | |
tree | 8a6deba10cd458a72e159112ab6381bcaa352b3e /include/net/udp.h | |
parent | 6579867c8b02606e101a6c511c2511b027ed3f4a (diff) |
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/udp.h')
-rw-r--r-- | include/net/udp.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/udp.h b/include/net/udp.h index 5eb86874bcd6..2ecfc6e15609 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -147,6 +147,15 @@ static inline __wsum udp_csum(struct sk_buff *skb) | |||
147 | return csum; | 147 | return csum; |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline __sum16 udp_v4_check(int len, __be32 saddr, | ||
151 | __be32 daddr, __wsum base) | ||
152 | { | ||
153 | return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base); | ||
154 | } | ||
155 | |||
156 | void udp_set_csum(bool nocheck, struct sk_buff *skb, | ||
157 | __be32 saddr, __be32 daddr, int len); | ||
158 | |||
150 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ | 159 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ |
151 | static inline void udp_lib_hash(struct sock *sk) | 160 | static inline void udp_lib_hash(struct sock *sk) |
152 | { | 161 | { |