X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fraw_socket%2Fdevice.c;h=e52097eb5964ed3cb5836ebbfcd29bdd3969a48d;hb=a227843b739d279b63adcf3736ebb03d856080c4;hp=6c56ed647cf0d0c576652e8a449952b2966a867d;hpb=ab7c61b06f6c6e991225f2fcc32d02b8e1084aee;p=tinc diff --git a/src/raw_socket/device.c b/src/raw_socket/device.c index 6c56ed64..e52097eb 100644 --- a/src/raw_socket/device.c +++ b/src/raw_socket/device.c @@ -38,13 +38,10 @@ static 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; - cp(); - if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) iface = xstrdup("eth0"); @@ -83,22 +80,16 @@ bool setup_device(void) return true; } -void close_device(void) -{ - cp(); - +void close_device(void) { close(device_fd); free(device); free(iface); } -bool read_packet(vpn_packet_t *packet) -{ +bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - if((lenin = read(device_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); @@ -115,10 +106,7 @@ bool read_packet(vpn_packet_t *packet) return true; } -bool write_packet(vpn_packet_t *packet) -{ - cp(); - +bool write_packet(vpn_packet_t *packet) { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -133,10 +121,7 @@ bool write_packet(vpn_packet_t *packet) return true; } -void dump_device_stats(void) -{ - cp(); - +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);