X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fraw_socket%2Fdevice.c;h=c246d1bb0e7b2b5f615210328315c7353d9b8c06;hb=e37ef57a956507cc29e80930201731562b4266e5;hp=33857ba11ac5c37bb1ad35ce2568219dbd096e0a;hpb=de78d79db84c486afcc353884ec1770866beb653;p=tinc diff --git a/src/raw_socket/device.c b/src/raw_socket/device.c index 33857ba1..c246d1bb 100644 --- a/src/raw_socket/device.c +++ b/src/raw_socket/device.c @@ -39,8 +39,7 @@ char *device_info; static int device_total_in = 0; static int device_total_out = 0; -bool setup_device(void) -{ +bool setup_device(void) { struct ifreq ifr; struct sockaddr_ll sa; @@ -85,26 +84,24 @@ bool setup_device(void) return true; } -void close_device(void) -{ +void close_device(void) { cp(); close(device_fd); } -bool read_packet(vpn_packet_t *packet) -{ - int lenin; +bool read_packet(vpn_packet_t *packet) { + int inlen; cp(); - if((lenin = read(device_fd, packet->data, MTU)) <= 0) { + if((inlen = read(device_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); return false; } - packet->len = lenin; + packet->len = inlen; device_total_in += packet->len; @@ -114,8 +111,7 @@ bool read_packet(vpn_packet_t *packet) return true; } -bool write_packet(vpn_packet_t *packet) -{ +bool write_packet(vpn_packet_t *packet) { cp(); ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), @@ -132,8 +128,7 @@ bool write_packet(vpn_packet_t *packet) return true; } -void dump_device_stats(void) -{ +void dump_device_stats(void) { cp(); logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);