• Stephen Hemminger's avatar
    [UDP]: Select handling of bad checksums. · edea8fef
    Stephen Hemminger authored
    Alternate workaround for blocking usage of select() by UDP applications.
    The problem is Linux optimizes the UDP receive checksum path so that checksum
    validation is not performed until the application read. This is a performance win
    but can cause applications that do select with blocking file descriptors to get false
    positives if the received message has a checksum error.
    There is a long running thread about this on LKML.
    
    This patch makes these applications work, but keeps the one-pass performance gain
    for those applications smart enough to use non-blocking file descriptors with
    select/poll. There is still a possibility to get a false positive if application does
    select on non-blocking fd then makes it blocking before doing the receive, but that
    is unlikely.
    
    Tested by injecting bad packets with SOCK_RAW.
    Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    edea8fef
udp.h 2.77 KB