• Eric Dumazet's avatar
    net/packet: implement shortcut in tpacket_rcv() · 2c51c627
    Eric Dumazet authored
    tpacket_rcv() can be hit under DDOS quite hard, since
    it will always grab a socket spinlock, to eventually find
    there is no room for an additional packet.
    
    Using tcpdump [1] on a busy host can lead to catastrophic consequences,
    because of all cpus spinning on a contended spinlock.
    
    This replicates a similar strategy used in packet_rcv()
    
    [1] Also some applications mistakenly use af_packet socket
    bound to ETH_P_ALL only to send packets.
    Receive queue is never drained and immediately full.
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2c51c627
af_packet.c 107 KB