Re: [PATCH] Work around dhclient brokenness

Herbert Xu
2008-08-24T08:39:18Z

On Fri, Aug 15, 2008 at 02:47:12PM -0500, Anthony Liguori wrote:
>
> +static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
> + const uint8_t *buf, size_t size)
> +{
> + if ((hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && /* missing csum */
> + (size > 18 && size < 1500) && /* normal sized MTU */
> + (buf[12] == 0x08 && buf[13] == 0x00) && /* ethertype == IPv4 */
> + (buf[23] == 17)) { /* ip.protocol == UDP */
> + /* FIXME this cast is evil */
> + net_checksum_calculate((uint8_t *)buf, size);

If we're going to do this, how about just setting the checksum
to zero?

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt