Re: [PATCH v3] ipvs: add checksum support for gue encapsulation

From: Julian Anastasov
Date: Wed May 29 2019 - 18:26:48 EST



Hello,

On Wed, 29 May 2019, Jacky Hu wrote:

> gueh = (struct guehdr *)skb->data;
>
> gueh->control = 0;
> gueh->version = 0;
> - gueh->hlen = 0;
> + gueh->hlen = optlen >> 2;
> gueh->flags = 0;
> gueh->proto_ctype = *next_protocol;
>
> + data = &gueh[1];
> +
> + if (need_priv) {
> + __be32 *flags = data;
> + u16 csum_start = skb_checksum_start_offset(skb);
> + __be16 *pd = data;

Packet tests show another problem. Fix is to defer
pd assignment after data += GUE_LEN_PRIV:

__be16 *pd;

> +
> + gueh->flags |= GUE_FLAG_PRIV;
> + *flags = 0;
> + data += GUE_LEN_PRIV;
> +
> + if (csum_start < hdrlen)
> + return -EINVAL;
> +
> + csum_start -= hdrlen;

pd = data;

> + pd[0] = htons(csum_start);
> + pd[1] = htons(csum_start + skb->csum_offset);
> +
> + if (!skb_is_gso(skb)) {
> + skb->ip_summed = CHECKSUM_NONE;
> + skb->encapsulation = 0;
> + }
> +
> + *flags |= GUE_PFLAG_REMCSUM;
> + data += GUE_PLEN_REMCSUM;
> + }
> +

Regards

--
Julian Anastasov <ja@xxxxxx>