X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_setup.c;h=813c58baca29fbf782a88d2133d9f01e00d72e4d;hp=70291bffe97111f5f4a30691e63c56172a669351;hb=f75e71bc693847af71f61fb72cd788e3e47f9bd3;hpb=292354912f346fe467f557f0dc026b519997289c diff --git a/src/net_setup.c b/src/net_setup.c index 70291bff..813c58ba 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -309,6 +309,16 @@ bool setup_myself(void) { && !get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport)) myport = xstrdup("655"); + if(!atoi(myport)) { + struct addrinfo *ai = str2addrinfo("localhost", myport, SOCK_DGRAM); + sockaddr_t sa; + if(!ai || !ai->ai_addr) + return false; + free(myport); + memcpy(&sa, ai->ai_addr, ai->ai_addrlen); + sockaddr2str(&sa, NULL, &myport); + } + /* Read in all the subnets specified in the host configuration file */ cfg = lookup_config(myself->connection->config_tree, "Subnet");