Moving validation of UDP checksum to be done in UDP not encap layer.
Signed-off-by: Tom Herbert <redacted>
---
net/ipv4/udp.c | 4 ++++
net/ipv6/udp.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f2d05d7..54ea0a3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1495,6 +1495,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
int ret;
+ /* Verify checksum before giving to encap */
+ if (udp_lib_checksum_complete(skb))
+ goto csum_error;
+
ret = encap_rcv(sk, skb);
if (ret <= 0) {
UDP_INC_STATS_BH(sock_net(sk),diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index fc2be63..7edf096 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -634,6 +634,10 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
int ret;
+ /* Verify checksum before giving to encap */
+ if (udp_lib_checksum_complete(skb))
+ goto csum_error;
+
ret = encap_rcv(sk, skb);
if (ret <= 0) {
UDP_INC_STATS_BH(sock_net(sk),--
1.9.1.423.g4596e3a