lkml.org 
[lkml]   [2014]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum issues
Date


> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, April 9, 2014 10:01 AM
> To: KY Srinivasan
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com
> Subject: Re: [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum
> issues
>
> From: "K. Y. Srinivasan" <kys@microsoft.com>
> Date: Tue, 8 Apr 2014 12:46:11 -0700
>
> > } else if (net_trans_info & INFO_UDP) {
> > - csum_info->transmit.udp_checksum = 1;
> > + /* UDP checksum offload is not supported on ws2008r2.
> > + * Furthermore, on ws2012 and ws2012r2, there are some
> > + * issues with udp checksum offload from Linux guests.
> > + * (these are host issues).
> > + * For now compute the checksum here.
> > + */
> > + struct udphdr *uh = udp_hdr(skb);
> > + u16 udp_len = ntohs(uh->len);
> > +
> > + uh->check = 0;
> > + uh->check = csum_tcpudp_magic(ip_hdr(skb)->saddr,
> > + ip_hdr(skb)->daddr,
> > + udp_len, IPPROTO_UDP,
> > + csum_partial(uh, udp_len, 0));
> > + if (uh->check == 0)
> > + uh->check = CSUM_MANGLED_0;
> > +
> > + csum_info->transmit.udp_checksum = 0;
>
> You absolutely cannot mangle packet header contents without first COW'ing
> the SKB to make sure it's writable.
>
> Otherwise network taps like tcpdump, and any other entity with a reference
> to the packet, can see inconsistent state.

Thanks Dave. I will COW the SKB before changing the checksum value. I do have a question though.
I looked at a bunch of hardware drivers and they modify the header information, specially checksum
field and I could not see where they had COWed the skb. I was grepping for skb_cow in these drivers.


Regards,

K. Y


\
 
 \ /
  Last update: 2014-04-09 20:41    [W:0.080 / U:12.964 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site