device.c -- Interaction with Solaris tun device
Copyright (C) 2001-2005 Ivo Timmermans,
2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
- 2001-2014 Guus Sliepen <guus@tinc-vpn.org>
+ 2001-2022 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
/* Remove muxes just in case they are left over from a crashed tincd */
- struct lifreq ifr = {};
+ struct lifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.lifr_name, iface, sizeof(ifr.lifr_name));
if(ioctl(ip_fd, SIOCGLIFMUXID, &ifr) >= 0) {
int arp_fd = -1;
if(device_type == DEVICE_TYPE_TAP) {
- struct lifreq ifr = {};
+ struct lifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
if(ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "Could not set flags on %s %s!", device_info, device);
close(arp_fd);
}
- struct lifreq ifr = {};
+ struct lifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.lifr_name, iface, sizeof(ifr.lifr_name));
static void close_device(void) {
if(iface) {
- struct lifreq ifr = {};
+ struct lifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.lifr_name, iface, sizeof(ifr.lifr_name));
if(ioctl(ip_fd, SIOCGLIFMUXID, &ifr) >= 0) {
sbuf.buf = (char *)DATA(packet);
if((result = getmsg(device_fd, NULL, &sbuf, &f)) < 0) {
- logger(LOG_ERR, "Error while reading from %s %s: %s", device_info, device, strerror(errno));
+ logger(DEBUG_TRAFFIC, LOG_ERR, "Error while reading from %s %s: %s", device_info, device, strerror(errno));
return false;
}
sbuf.buf = (char *)DATA(packet) + 14;
if(putmsg(device_fd, NULL, &sbuf, 0) < 0) {
- logger(LOG_ERR, "Can't write to %s %s: %s", device_info, device, strerror(errno));
+ logger(DEBUG_TRAFFIC, LOG_ERR, "Can't write to %s %s: %s", device_info, device, strerror(errno));
return false;
}
sbuf.buf = (char *)DATA(packet);
if(putmsg(device_fd, NULL, &sbuf, 0) < 0) {
- logger(LOG_ERR, "Can't write to %s %s: %s", device_info, device, strerror(errno));
+ logger(DEBUG_TRAFFIC, LOG_ERR, "Can't write to %s %s: %s", device_info, device, strerror(errno));
return false;
}