X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fuml_socket%2Fdevice.c;h=d8f13a5565d883e7a9730a86063d5d05af242100;hb=33f241d97852d7a171f1aaf1bda7f66356ff889e;hp=3523f6471f277521cfd3966d144ef4e0f3bae5f6;hpb=4c85542894f7fca823b119b05e07179deb24229a;p=meshlink diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c index 3523f647..d8f13a55 100644 --- a/src/uml_socket/device.c +++ b/src/uml_socket/device.c @@ -23,6 +23,7 @@ #include #include "conf.h" +#include "device.h" #include "net.h" #include "logger.h" #include "utils.h" @@ -41,8 +42,8 @@ static char *device_info; extern char *identname; extern bool running; -static int device_total_in = 0; -static int device_total_out = 0; +static uint64_t device_total_in = 0; +static uint64_t device_total_out = 0; enum request_type { REQ_NEW_CONTROL }; @@ -169,7 +170,7 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; switch(state) { case 0: { @@ -197,7 +198,7 @@ bool read_packet(vpn_packet_t *packet) { } case 1: { - if((lenin = read(request_fd, &request, sizeof request)) != sizeof request) { + if((inlen = read(request_fd, &request, sizeof request)) != sizeof request) { logger(LOG_ERR, "Error while reading request from %s %s: %s", device_info, device, strerror(errno)); running = false; @@ -227,14 +228,14 @@ bool read_packet(vpn_packet_t *packet) { } case 2: { - if((lenin = read(data_fd, packet->data, MTU)) <= 0) { + if((inlen = read(data_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, "Error while reading from %s %s: %s", device_info, device, strerror(errno)); running = false; return false; } - packet->len = lenin; + packet->len = inlen; device_total_in += packet->len; @@ -272,6 +273,6 @@ bool write_packet(vpn_packet_t *packet) { void dump_device_stats(void) { logger(LOG_DEBUG, "Statistics for %s %s:", device_info, device); - logger(LOG_DEBUG, " total bytes in: %10d", device_total_in); - logger(LOG_DEBUG, " total bytes out: %10d", device_total_out); + logger(LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in); + logger(LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out); }