From b079b0eda52abe666471d999bd7304e0003652b1 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Thu, 29 May 2014 16:18:41 +0200 Subject: [PATCH] Fix build error and a warning on OpenBSD --- src/common.c | 4 ++-- src/tun.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.c b/src/common.c index 5f202da..6b74c64 100644 --- a/src/common.c +++ b/src/common.c @@ -149,8 +149,8 @@ get_addr(char *host, int port, int addr_family, int flags, struct sockaddr_stora memset(&hints, 0, sizeof(hints)); hints.ai_family = addr_family; -#ifdef WINDOWS32 - /* AI_ADDRCONFIG misbehaves on windows */ +#if defined(WINDOWS32) || defined(OPENBSD) + /* AI_ADDRCONFIG misbehaves on windows, and does not exist in OpenBSD */ hints.ai_flags = flags; #else hints.ai_flags = AI_ADDRCONFIG | flags; diff --git a/src/tun.c b/src/tun.c index bc5c153..53f52dc 100644 --- a/src/tun.c +++ b/src/tun.c @@ -440,6 +440,7 @@ tun_setip(const char *ip, const char *other_ip, int netbits) int i; #ifndef LINUX int r; + struct in_addr netip; #endif #ifdef WINDOWS32 DWORD status; @@ -475,7 +476,6 @@ tun_setip(const char *ip, const char *other_ip, int netbits) fprintf(stderr, "Setting IP of %s to %s\n", if_name, ip); #ifndef LINUX - struct in_addr netip; netip.s_addr = inet_addr(ip); netip.s_addr = netip.s_addr & net.s_addr; r = system(cmdline);