On Thu, Feb 03, 2022 at 10:22:46PM +1000, David Gwynne wrote:
> bpf should know better than this. it has all the information it needs to
> align the payload properly, it just doesnt make enough of an effort. can
> you try the diff below?

Diff seems to work.  regress/sbin/slaacd passes.
I have started a full regress run on armv7 and sparc64.

> +     if (len < hlen)
> +             return (EPERM);

This is not a permission problem.  Maybe EINVAL.

> +     /*
> +         * Get the length of the payload so we can align it properly.
> +      */

Whitespace misaligned.

> +     if (mlen > MAXMCLBYTES)
> +             return (EIO);

Should we use EMSGSIZE like in bpfwrite() if the data does not fit.

> +     mlen = max(max_linkhdr, hlen) + roundup(alen, sizeof(long));
...
> +     m_align(m, alen); /* Align the payload. */

sizeof(long) seems the correct alignment for mbuf.  In rev 1.237
of m_pullup() you introduced ALIGNBYTES.  This is architecture
dependent and the only place in the network stack where it is used.
Should it also be sizeof(long) there?

bluhm

Reply via email to