summaryrefslogtreecommitdiff
path: root/src/uanytun.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-24 15:08:05 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-24 15:08:05 +0000
commitfc38f3fd9ab074f8d5d80c661861b286cac0caee (patch)
tree5a770098b14fc525d900c446026d871c56dd579e /src/uanytun.c
parentfixed addrlen bug @ getaddrinfo (diff)
fixed some name resolution issues
Diffstat (limited to 'src/uanytun.c')
-rw-r--r--src/uanytun.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index 7ac7c44..d7873d8 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -418,14 +418,20 @@ int main(int argc, char* argv[])
exit(ret);
}
char* local_string = udp_get_local_end_string(&sock);
- log_printf(NOTICE, "listening on: %s", local_string);
- free(local_string);
+ if(local_string) {
+ log_printf(NOTICE, "listening on: %s", local_string);
+ free(local_string);
+ }
+
if(opt.remote_addr_) {
- udp_set_remote(&sock, opt.remote_addr_, opt.remote_port_);
- char* remote_string = udp_get_remote_end_string(&sock);
- log_printf(NOTICE, "set remote end to: %s", remote_string);
- free(remote_string);
+ if(!udp_set_remote(&sock, opt.remote_addr_, opt.remote_port_)) {
+ char* remote_string = udp_get_remote_end_string(&sock);
+ if(remote_string) {
+ log_printf(NOTICE, "set remote end to: %s", remote_string);
+ free(remote_string);
+ }
+ }
}