The original code did not deal with UDP binding failures, this new code
does one random port attempt and then sets port to 0 to get 'OS
default' behaviour, and ASSERTs that that has to work.
Patch also moves the local UDP port range definition to udp.h from
udp.c.