• Yoshiki Komachi's avatar
    af_packet: fix the tx skb protocol in raw sockets with ETH_P_ALL · 18bed891
    Yoshiki Komachi authored
    I am using "protocol ip" filters in TC to manipulate TC flower
    classifiers, which are only available with "protocol ip". However,
    I faced an issue that packets sent via raw sockets with ETH_P_ALL
    did not match the ip filters even if they did satisfy the condition
    (e.g., DHCP offer from dhcpd).
    
    I have determined that the behavior was caused by an unexpected
    value stored in skb->protocol, namely, ETH_P_ALL instead of ETH_P_IP,
    when packets were sent via raw sockets with ETH_P_ALL set.
    
    IMHO, storing ETH_P_ALL in skb->protocol is not appropriate for
    packets sent via raw sockets because ETH_P_ALL is not a real ether
    type used on wire, but a virtual one.
    
    This patch fixes the tx protocol selection in cases of transmission
    via raw sockets created with ETH_P_ALL so that it asks the driver to
    extract protocol from the Ethernet header.
    
    Fixes: 75c65772 ("net/packet: Ask driver for protocol if not provided by user")
    Signed-off-by: default avatarYoshiki Komachi <komachi.yoshiki@lab.ntt.co.jp>
    Acked-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    18bed891
af_packet.c 107 KB