[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

SO_REUSEADDR porting issues on kFreeBSD targets



Hi porters!

(Please cc me on replies; I'm not subscribed to the list.)

I noticed today that remctl is currently failing to build on the Debian
kFreeBSD targets.  It looks like the same failure on both targets, and is
a test suite failure.  The test that's failing is this one:

    /* Test setting various socket options. */
    fd = socket(PF_INET6, SOCK_STREAM, IPPROTO_IP);
    if (fd == INVALID_SOCKET)
        sysbail("cannot create socket");
    network_set_reuseaddr(fd);
#ifdef SO_REUSEADDR
    flag = 0;
    flaglen = sizeof(flag);
    is_int(0, getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flag, &flaglen),
           "Getting SO_REUSEADDR works");
    is_int(1, flag, "...and it is set");
#else
    skip_block(2, "SO_REUSEADDR not supported");
#endif

SO_REUSEADDR is recognized as supported, and retrieving it is successful,
but the flag value is not 1 when retrieved.

The relevant code in network_set_reuseaddr is this:

void
network_set_reuseaddr(socket_type fd UNUSED)
{
#ifdef SO_REUSEADDR
    int flag = 1;

    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag)) < 0)
        syswarn("cannot mark bind address reusable");
#endif
}

Is there something weird about how SO_REUSEADDR works on kFreeBSD hosts?
Am I doing something wrong here?  (This test is relatively new, so it's
possible that I made some mistake in the test that I'm not seeing.)

Thanks!

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: