From d7f89a79448dd1633342ea5ee344d403c8e6890b Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 12:49:59 +0100 Subject: [PATCH 1/6] Only declare the origpriority variable if we support priority. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following compiler warning when building for Windows: net_packet.c: In function ‘send_udppacket’: net_packet.c:633:6: error: unused variable ‘origpriority’ [-Werror=unused-variable] int origpriority = origpkt->priority; ^ --- src/net_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net_packet.c b/src/net_packet.c index 6b3183da..b7ef5193 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -629,8 +629,8 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) { size_t outlen; #if defined(SOL_IP) && defined(IP_TOS) static int priority = 0; -#endif int origpriority = origpkt->priority; +#endif if(!n->status.reachable) { logger(DEBUG_TRAFFIC, LOG_INFO, "Trying to send UDP packet to unreachable node %s (%s)", n->name, n->hostname); From f693cb7295298ecd6993a4feac1faf9129aa204d Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 12:52:25 +0100 Subject: [PATCH 2/6] Remove an unnecessary pointer dereference in execute_script(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following compiler warning when building for Windows: script.c: In function ‘execute_script’: script.c:52:5: error: value computed is not used [-Werror=unused-value] *q++; ^ --- src/script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script.c b/src/script.c index 9a43d531..6389cb4b 100644 --- a/src/script.c +++ b/src/script.c @@ -49,7 +49,7 @@ bool execute_script(const char *name, char **envp) { if(q) { memcpy(ext, p, q - p); ext[q - p] = 0; - *q++; + q++; } else { strcpy(ext, p); } From 2d2e94406c5f595eff67a01ee6bb1190f77c37ff Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 12:54:45 +0100 Subject: [PATCH 3/6] Fix callback signature for TAP-Win32 device_handle_read(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following compiler warning when building for Windows: mingw/device.c: In function ‘setup_device’: mingw/device.c:186:2: error: passing argument 2 of ‘io_add_event’ from incompatible pointer type [-Werror] io_add_event(&device_read_io, device_handle_read, NULL, CreateEvent(NULL, TRUE, FALSE, NULL)); ^ In file included from mingw/../net.h:27:0, from mingw/../subnet.h:24, from mingw/../conf.h:34, from mingw/device.c:26: mingw/../event.h:61:13: note: expected ‘io_cb_t’ but argument is of type ‘void (*)(void *)’ extern void io_add_event(io_t *io, io_cb_t cb, void* data, WSAEVENT event); --- src/mingw/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mingw/device.c b/src/mingw/device.c index 33b13da6..10f7abce 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -60,7 +60,7 @@ static void device_issue_read() { } } -static void device_handle_read(void *data) { +static void device_handle_read(void *data, int flags) { ResetEvent(device_read_overlapped.hEvent); DWORD len; From 6e221a828f87a511aecee9d9263a1db0836701c4 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 12:57:11 +0100 Subject: [PATCH 4/6] Remove unused variable in TAP-Win32 setup_device(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following compiler warning when building for Windows: mingw/device.c: In function ‘setup_device’: mingw/device.c:92:9: error: unused variable ‘thread’ [-Werror=unused-variable] HANDLE thread; ^ --- src/mingw/device.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mingw/device.c b/src/mingw/device.c index 10f7abce..5e449d50 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -89,7 +89,6 @@ static bool setup_device(void) { bool found = false; int err; - HANDLE thread; get_config_string(lookup_config(config_tree, "Device"), &device); get_config_string(lookup_config(config_tree, "Interface"), &iface); From 5217c16db4babd64580c2fd7aa36180bb9bd838c Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 13:27:05 +0100 Subject: [PATCH 5/6] Remove unused device stats variables. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes a bunch of variables that are never actually used anywhere. This fixes the following compiler warning when building for Windows: mingw/device.c:46:17: error: ‘device_total_in’ defined but not used [-Werror=unused-variable] static uint64_t device_total_in = 0; ^ --- src/device.h | 5 ----- src/mingw/device.c | 5 ----- 2 files changed, 10 deletions(-) diff --git a/src/device.h b/src/device.h index ad91a0e6..8046a255 100644 --- a/src/device.h +++ b/src/device.h @@ -27,11 +27,6 @@ extern int device_fd; extern char *device; extern char *iface; -extern uint64_t device_in_packets; -extern uint64_t device_in_bytes; -extern uint64_t device_out_packets; -extern uint64_t device_out_bytes; - typedef struct devops_t { bool (*setup)(void); void (*close)(void); diff --git a/src/mingw/device.c b/src/mingw/device.c index 5e449d50..b6dffbc9 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -43,9 +43,6 @@ char *device = NULL; char *iface = NULL; static char *device_info = NULL; -static uint64_t device_total_in = 0; -static uint64_t device_total_out = 0; - extern char *myport; static void device_issue_read() { @@ -234,8 +231,6 @@ static bool write_packet(vpn_packet_t *packet) { return false; } - device_total_out += packet->len; - return true; } From b2a6381ab28dbae4bf976627afccbf6c2fcb0625 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 12 Jul 2014 13:32:23 +0100 Subject: [PATCH 6/6] Resolve KEY_EVENT conflict between Windows and ncurses. This fixes the following compiler warning when building for Windows: In file included from top.c:24:0: /usr/local/mingw/ncurses/include/curses.h:1478:0: error: "KEY_EVENT" redefined [-Werror] #define KEY_EVENT 0633 /* We were interrupted by an event */ ^ In file included from /usr/share/mingw-w64/include/windows.h:74:0, from /usr/share/mingw-w64/include/winsock2.h:23, from have.h:46, from system.h:26, from top.c:20: /usr/share/mingw-w64/include/wincon.h:101:0: note: this is the location of the previous definition #define KEY_EVENT 0x1 ^ --- src/top.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/top.c b/src/top.c index 2824261c..40b80479 100644 --- a/src/top.c +++ b/src/top.c @@ -21,6 +21,7 @@ #ifdef HAVE_CURSES +#undef KEY_EVENT /* There are conflicting declarations for KEY_EVENT in Windows wincon.h and curses.h. */ #include #include "control_common.h"