X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ffd_device.c;h=6e85be0d4eb7916bcd73610a8d2f7a3a1b8466c5;hb=28b7a53b693f6b4e70218a926e68a36ece54cda1;hp=1325ee5a1f577c96d74f72dcc668d368e79e12f5;hpb=f71ab70351e8d5dfdc91c9808d142cf93d2a5d61;p=tinc diff --git a/src/fd_device.c b/src/fd_device.c index 1325ee5a..6e85be0d 100644 --- a/src/fd_device.c +++ b/src/fd_device.c @@ -1,7 +1,7 @@ /* fd_device.c -- Interaction with Android tun fd Copyright (C) 2001-2005 Ivo Timmermans, - 2001-2021 Guus Sliepen + 2001-2022 Guus Sliepen 2009 Grzegorz Dymarek 2016-2020 Pacien TRAN-GIRARD @@ -31,7 +31,6 @@ #include "logger.h" #include "net.h" #include "route.h" -#include "utils.h" struct unix_socket_addr { size_t size; @@ -43,7 +42,7 @@ static int read_fd(int socket) { struct iovec iov = {0}; char cmsgbuf[CMSG_SPACE(sizeof(device_fd))]; struct msghdr msg = {0}; - int ret; + ssize_t ret; struct cmsghdr *cmsgptr; iov.iov_base = &iobuf; @@ -54,7 +53,7 @@ static int read_fd(int socket) { msg.msg_controllen = sizeof(cmsgbuf); if((ret = recvmsg(socket, &msg, 0)) < 1) { - logger(DEBUG_ALWAYS, LOG_ERR, "Could not read from unix socket (error %d)!", ret); + logger(DEBUG_ALWAYS, LOG_ERR, "Could not read from unix socket (error %ld)!", (long)ret); return -1; } @@ -151,7 +150,7 @@ static bool setup_device(void) { return false; } - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) { + if(!get_config_string(lookup_config(&config_tree, "Device"), &device)) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not read device from configuration!"); return false; } @@ -202,7 +201,7 @@ static inline void set_etherheader(vpn_packet_t *packet, uint16_t ethertype) { } static bool read_packet(vpn_packet_t *packet) { - int lenin = read(device_fd, DATA(packet) + ETH_HLEN, MTU - ETH_HLEN); + ssize_t lenin = read(device_fd, DATA(packet) + ETH_HLEN, MTU - ETH_HLEN); if(lenin <= 0) { logger(DEBUG_ALWAYS, LOG_ERR, "Error while reading from fd/%d: %s!", device_fd, strerror(errno));