• Daniel Borkmann's avatar
    packet: only allow extra vlan len on ethernet devices · 3c70c132
    Daniel Borkmann authored
    Packet sockets can be used by various net devices and are not
    really restricted to ARPHRD_ETHER device types. However, when
    currently checking for the extra 4 bytes that can be transmitted
    in VLAN case, our assumption is that we generally probe on
    ARPHRD_ETHER devices. Therefore, before looking into Ethernet
    header, check the device type first.
    
    This also fixes the issue where non-ARPHRD_ETHER devices could
    have no dev->hard_header_len in TX_RING SOCK_RAW case, and thus
    the check would test unfilled linear part of the skb (instead
    of non-linear).
    
    Fixes: 57f89bfa ("network: Allow af_packet to transmit +4 bytes for VLAN packets.")
    Fixes: 52f1454f ("packet: allow to transmit +4 byte in TX_RING slot for VLAN case")
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    3c70c132
af_packet.c 103 KB