- Copyright (C) 2002-2003 Ivo Timmermans <ivo@o2w.nl>,
- 2002-2003 Guus Sliepen <guus@sliepen.eu.org>
+ Copyright (C) 2002-2005 Ivo Timmermans,
+ 2002-2006 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
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
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
device_info = _("raw socket");
if((device_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device_info,
strerror(errno));
device_info = _("raw socket");
if((device_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device_info,
strerror(errno));
- logger(LOG_ERR, _("Can't find interface %s: %s"), interface,
+ logger(LOG_ERR, _("Can't find interface %s: %s"), iface,
sa.sll_ifindex = ifr.ifr_ifindex;
if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) {
sa.sll_ifindex = ifr.ifr_ifindex;
if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) {
- logger(LOG_ERR, _("Could not bind to %s: %s"), device, strerror(errno));
- return -1;
+ logger(LOG_ERR, _("Could not bind %s to %s: %s"), device, iface, strerror(errno));
+ return false;
}
logger(LOG_INFO, _("%s is a %s"), device, device_info);
}
logger(LOG_INFO, _("%s is a %s"), device, device_info);
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
device, strerror(errno));
device_total_in += packet->len;
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len,
device_info);
device_total_in += packet->len;
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"), packet->len,
device_info);
if(write(device_fd, packet->data, packet->len) < 0) {
logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device,
strerror(errno));
if(write(device_fd, packet->data, packet->len) < 0) {
logger(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device,
strerror(errno));
cp();
logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);
cp();
logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);