X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fuml_socket%2Fdevice.c;h=a371e7b439eb1cb1efb0b8199aef2291054032f0;hp=59551b4f51b1d94a4d15c69d24dbb6babc8710cf;hb=2c7c87ec75c94d0b3cca9f7a5aeba34384f77cc1;hpb=798fa2f04c52b0639713f74b1195847bec40c16a diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c index 59551b4f..a371e7b4 100644 --- a/src/uml_socket/device.c +++ b/src/uml_socket/device.c @@ -23,10 +23,12 @@ #include #include "conf.h" +#include "device.h" #include "net.h" #include "logger.h" #include "utils.h" #include "route.h" +#include "xalloc.h" int device_fd = -1; static int listen_fd = -1; @@ -39,7 +41,7 @@ char *iface = NULL; static char *device_info; extern char *identname; -extern bool running; +extern volatile bool running; static uint64_t device_total_in = 0; static uint64_t device_total_out = 0; @@ -174,7 +176,7 @@ bool read_packet(vpn_packet_t *packet) { switch(state) { case 0: { struct sockaddr sa; - int salen = sizeof sa; + socklen_t salen = sizeof sa; request_fd = accept(listen_fd, &sa, &salen); if(request_fd < 0) { @@ -243,6 +245,10 @@ bool read_packet(vpn_packet_t *packet) { return true; } + + default: + logger(LOG_ERR, "Invalid value for state variable in " __FILE__); + abort(); } }