• Jason A. Donenfeld's avatar
    tun: implement header_ops->parse_protocol for AF_PACKET · b9815eb1
    Jason A. Donenfeld authored
    The tun driver passes up skb->protocol to userspace in the form of PI headers.
    For AF_PACKET injection, we need to support its call chain of:
    
        packet_sendmsg -> packet_snd -> packet_parse_headers ->
          dev_parse_header_protocol -> parse_protocol
    
    Without a valid parse_protocol, this returns zero, and the tun driver
    then gives userspace bogus values that it can't deal with.
    
    Note that this isn't the case with tap, because tap already benefits
    from the shared infrastructure for ethernet headers. But with tun,
    there's nothing.
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b9815eb1
tun.c 85.7 KB