CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2016/10/09 20:44:17

Modified files:
        sys/net        : if_ethersubr.c if_vlan.c 

Log message:
ensure prepended ethernet headers are placed on ETHER_ALIGN boundaries,
even if m_prepend allocates a new mbuf in front of the current one.

this is done by asking M_PREPEND for ETHER_HDR_LEN + ETHER_ALIGN bytes,
and then calling m_adj(ETHER_ALIGN) after.

in the case M_PREPEND does not allocate a new mbuf and ends up with the
same layout as before.

in the allocation case, the requested length is provided on a long
boundary. an ETHER_HDR_LEN request would therefore be 6 bytes
allocated on a long boundary, when we want it to be at ETHER_ALIGN.
by asking for ETHER_HDR_LEN plus ETHER_ALIGN, we can m_adj ETHER_ALIGN
off to get us to the ETHER_ALIGN offset.

ok yasuoka@ mikeb@

Reply via email to