X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fbsd%2Fdevice.c;h=0c1a62f4b569f1ef372d3ac405d67e09ddf4b8b2;hb=28b7a53b6;hp=db506e5a17074342c5b52b66e91a50b57336a427;hpb=8156f3760973c17256a93ab48016b8b84f5444de;p=tinc diff --git a/src/bsd/device.c b/src/bsd/device.c index db506e5a..0c1a62f4 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction BSD tun/tap device Copyright (C) 2001-2005 Ivo Timmermans, - 2001-2021 Guus Sliepen + 2001-2022 Guus Sliepen 2009 Grzegorz Dymarek This program is free software; you can redistribute it and/or modify @@ -76,7 +76,9 @@ static bool setup_utun(void) { return false; } - struct ctl_info info = {}; + struct ctl_info info; + + memset(&info, 0, sizeof(info)); strlcpy(info.ctl_name, UTUN_CONTROL_NAME, sizeof(info.ctl_name)); @@ -85,7 +87,7 @@ static bool setup_utun(void) { return false; } - int unit = -1; + long unit = -1; char *p = strstr(device, "utun"), *e = NULL; if(p) { @@ -125,13 +127,13 @@ static bool setup_utun(void) { #endif static bool setup_device(void) { - get_config_string(lookup_config(config_tree, "Device"), &device); + get_config_string(lookup_config(&config_tree, "Device"), &device); // Find out if it's supposed to be a tun or a tap device char *type; - if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) { + if(get_config_string(lookup_config(&config_tree, "DeviceType"), &type)) { if(!strcasecmp(type, "tun")) /* use default */; @@ -233,7 +235,7 @@ static bool setup_device(void) { realname = device; } - if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) { + if(!get_config_string(lookup_config(&config_tree, "Interface"), &iface)) { iface = xstrdup(strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname); } else if(strcmp(iface, strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname)) { logger(DEBUG_ALWAYS, LOG_WARNING, "Warning: Interface does not match Device. $INTERFACE might be set incorrectly."); @@ -351,7 +353,7 @@ static void close_device(void) { } static bool read_packet(vpn_packet_t *packet) { - int inlen; + ssize_t inlen; switch(device_type) { case DEVICE_TYPE_TUN: