In upstream linux kernel networking stack udp_set_csum() is called
with only udp header applied but in case of compat layer it can
be called with IP header. So following patch take the offset into
account.

Signed-off-by: Pravin B Shelar <pshe...@ovn.org>
---
 datapath/linux/compat/udp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/datapath/linux/compat/udp.c b/datapath/linux/compat/udp.c
index f0362b6..0152830 100644
--- a/datapath/linux/compat/udp.c
+++ b/datapath/linux/compat/udp.c
@@ -26,12 +26,13 @@ void rpl_udp_set_csum(bool nocheck, struct sk_buff *skb,
                skb->csum_offset = offsetof(struct udphdr, check);
                uh->check = ~udp_v4_check(len, saddr, daddr, 0);
        } else {
+               int l4_offset = skb_transport_offset(skb);
                __wsum csum;
 
                BUG_ON(skb->ip_summed == CHECKSUM_PARTIAL);
 
                uh->check = 0;
-               csum = skb_checksum(skb, 0, len, 0);
+               csum = skb_checksum(skb, l4_offset, len, 0);
                uh->check = udp_v4_check(len, saddr, daddr, csum);
                if (uh->check == 0)
                        uh->check = CSUM_MANGLED_0;
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to