X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fuml_socket%2Fdevice.c;h=e9b07663acaf4fd2f9140228a35342b7e6a8d9e9;hb=a22041922f160667573e9a5ae3f4195e1668906a;hp=3523f6471f277521cfd3966d144ef4e0f3bae5f6;hpb=4c85542894f7fca823b119b05e07179deb24229a;p=tinc diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c index 3523f647..e9b07663 100644 --- a/src/uml_socket/device.c +++ b/src/uml_socket/device.c @@ -41,8 +41,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 +169,7 @@ void close_device(void) { } bool read_packet(vpn_packet_t *packet) { - int lenin; + int inlen; switch(state) { case 0: { @@ -197,7 +197,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 +227,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 +272,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); }