X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=c4f2127ec0dee48bfe9a4f79c8ee48cfb35aef60;hb=fcf5b53e785fd191dd951b77ad831fe6ac78dce4;hp=6d15fcf1d6ad0a3342b46d6b9481dff1e41b88ce;hpb=c786ed116805c0bc911f592c03dc0d5562287283;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 6d15fcf1..c4f2127e 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -1037,7 +1037,7 @@ static bool setup_myself(void) { /* If no Port option was specified, set myport to the port used by the first listening socket. */ - if(!port_specified) { + if(!port_specified || atoi(myport) == 0) { sockaddr_t sa; socklen_t salen = sizeof sa; if(!getsockname(listen_socket[0].udp.fd, &sa.sa, &salen)) {