SO_SNDTIMEO: 2.4 kernel bugs

From: Chris Evans (chris@scary.beasts.org)
Date: Fri Feb 16 2001 - 20:35:15 EST

  • Next message: Jack Bowling: "too long mac address for --mac-source netfilter option"

    Hi,

    I was glad to see Linux gain SO_SNDTIMEO in kernel 2.4. It is a very use
    feature which can avoid complexity and pain in userspace programs.

    Unfortunately, it seems to be very buggy. Here are two buggy scenarios.

    1)
    Create a socketpair(), PF_UNIX, SOCK_STREAM.
    Set a 5 second SO_SNDTIMEO on the socket.
    write() 100k down the socket in one write(), i.e. enough to cause the
    write to have to block.
    --> BUG!!! The call blocks indefinitely instead of returning after 5
    seconds

    (Note that the same test but with SO_RCVTIMEO and a read() works as
    expected - I get EAGAIN after 5 seconds).

    2)
    Create a localhost listening socket - AF_INET, SOCK_STREAM.
    Connect to the listening port
    Set a 5 second SO_SNDTIMEO on the socket.
    write() 1Mb down the socket in one write(), i.e. enough to cause it to
    have to block
    -> The write() will return after 5 seconds with a partial write count.
    GOOD!
    Repeat the write() - send another 1Mb.
    --> BUG!! The call blocks indefinitely instead of returning with EAGAIN
    after 5s.

    I hope this is detailled enough. I'm trying to gain access to a FreeBSD
    box to compare results..

    Cheers
    Chris

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Fri Feb 16 2001 - 20:36:49 EST