Skip to content

udpsrc: switch default value of reuse property

The reuse property end up setting the SO_REUSEADDR socket option for the UDP socket. This setting have surprising effects.

On Linux systems the man page (socket(7)) states:

SO_REUSEADDR
    Indicates that the rules used in validating addresses supplied
    in a bind(2) call should allow reuse of local addresses. For
    AF_INET sockets this means that a socket may bind, except when
    there is an active listening socket bound to the address.

But since UDP does not listen this ends up meaning that when an ephemeral port is allocated (setting the port to 0) the kernel is free to reuse any other UDP port.

Tests checking the likelihood of port conflict when using multiple udpsrc shows port conflicts starting to occur after ~100-300 udpsrc with port allocation enabled. See issue #3411 for more details.

Changing the default value of a property is not a small thing we risk breaking application that rely on the current default value. But since the effects of having reuse default TRUE on can also have damaging and hard-to-debug consequences, it might be worth to consider.

If we broadcast this change clear in release notes perhaps people notice and can adapt?

Closes #3411

Edited by Jonas Danielsson

Merge request reports