Closed GoogleCodeExporter closed 9 years ago
When connecting to a server on a different location, hostnames are easier to remeber. I just did a simple thing. diff -r 68258e42ad74 vtunerc.c --- a/vtunerc.c Tue Nov 08 00:20:57 2011 +0100 +++ b/vtunerc.c Tue Nov 08 10:56:18 2011 +0100 @@ -466,6 +466,17 @@ int main(int argc, char **argv) { ERROR(MSG_MAIN, "Network parameter requires at least IP address (rv=%d)\n", c); exit(1); } + struct hostent *he; + struct in_addr **addr_list; + if((he = gethostbyname(direct_ip)) == NULL) + { + ERROR(MSG_MAIN, "Failed to parse IP/Hostname: %s\n", direct_ip); + return 0; + } + addr_list = (struct in_addr **)he->h_addr_list; + strcpy(direct_ip,inet_ntoa(*addr_list[0])); + + INFO(MSG_MAIN, "direct connection: ip='%s' port=%d\n", direct_ip, discover_port); break;
Original issue reported on code.google.com by kriss...@gmail.com on 8 Nov 2011 at 9:57
kriss...@gmail.com
This issue was closed by revision e2ee32525c74.
Original comment by jpetrous on 8 Nov 2011 at 8:46
jpetrous
Thanks for you patch. Applied. /Honza
Original comment by jpetrous on 8 Nov 2011 at 8:48
Original issue reported on code.google.com by
kriss...@gmail.com
on 8 Nov 2011 at 9:57