lib/socket: randomize the generated local port
lib/socket: randomize the generated local port

Instead of always trying the same order of ports when
looking for an unused port, randomize the order (naively).

As libnl-1 uses the same function, it is likely that two applications
that are using both libraries generate the same ports. By chosing a
different order how to select the local port, the chances are smaller
for this to happen (however, it cannot avoid it entirely. The user
and/or libnl3 still has to cope with the situation, that somebody
else might already use the port).

Signed-off-by: Thomas Haller <16e26612e4159990a6b3691e92592e691ff74132@redhat.com>

houstar/libnl,cyclops8456/libnl3,honsys/libnl,HolyShitMan/libnl-1,dsahern/libnl,thom311/libnl,kolyshkin/libnl,vyos/libnl3,tklauser/libnl,claudelee/libnl,cfriedt/libnl,greearb/libnl-ct,greearb/libnl-ct,dsahern/libnl,HolyShitMan/libnl-1,mshirley/libnl,congwang/libnl,tgraf/libnl,kolyshkin/libnl,baloo/libnl,mshirley/libnl,greearb/libnl-ct,vyos/libnl3,kolyshkin/libnl,honsys/libnl,honsys/libnl,UnicronNL/libnl3,cyclops8456/libnl3,tklauser/libnl,cyclops8456/libnl3,UnicronNL/libnl3,houstar/libnl,claudelee/libnl,congwang/libnl,dsahern/libnl,congwang/libnl,cfriedt/libnl,congwang/libnl,vyos/libnl3,mshirley/libnl,tklauser/libnl,dsahern/libnl,cfriedt/libnl,claudelee/libnl,HolyShitMan/libnl-1,honsys/libnl,vyos/libnl3,tgraf/libnl,baloo/libnl,UnicronNL/libnl3,kolyshkin/libnl,houstar/libnl,thom311/libnl,baloo/libnl,thom311/libnl,UnicronNL/libnl3,tgraf/libnl,tgraf/libnl,claudelee/libnl,cyclops8456/libnl3,mshirley/libnl,baloo/libnl,houstar/libnl,HolyShitMan/libnl-1,tklauser/libnl,cfriedt/libnl