On Tue, Apr 25, 2017 at 9:56 AM, Miroslav Lichvar <mlich...@redhat.com> wrote: > On Mon, Apr 24, 2017 at 11:18:13AM -0400, Willem de Bruijn wrote: >> On Mon, Apr 24, 2017 at 5:00 AM, Miroslav Lichvar <mlich...@redhat.com> >> wrote: >> > Would "skb->data - skb->head - >> > skb->mac_header + skb->len" always work as the L2 length for received >> > packets at the time when the cmsg is prepared? >> >> (skb->data - skb->head) - skb->mac_header computes the length >> of data before the mac, such as reserve? > > data - head includes the reserve, but mac_header does too, so I think > it should be just the length of MAC header and everything up to the > data. > >> Do you mean skb->data - >> skb->mac_header (or - skb_mac_offset(skb))? > > That would give me a pointer? If I used skb_mac_offset(), the total > length would be just skb->len - skb_mac_offset()?
It appears so. The only existing caller first checks skb_mac_header_was_set(skb).