Remove redundant spaces.

This commit is contained in:
Guus Sliepen 2002-09-09 22:33:31 +00:00
parent 9f38e39463
commit 6f9f6779e6
35 changed files with 270 additions and 255 deletions

View file

@ -29,7 +29,7 @@
library for inclusion into tinc (http://tinc.nl.linux.org/) by library for inclusion into tinc (http://tinc.nl.linux.org/) by
Guus Sliepen <guus@sliepen.eu.org>. Guus Sliepen <guus@sliepen.eu.org>.
$Id: avl_tree.c,v 1.1.2.10 2002/09/09 21:49:16 guus Exp $ $Id: avl_tree.c,v 1.1.2.11 2002/09/09 22:32:24 guus Exp $
*/ */
#include <stdio.h> #include <stdio.h>

View file

@ -29,7 +29,7 @@
library for inclusion into tinc (http://tinc.nl.linux.org/) by library for inclusion into tinc (http://tinc.nl.linux.org/) by
Guus Sliepen <guus@sliepen.eu.org>. Guus Sliepen <guus@sliepen.eu.org>.
$Id: avl_tree.h,v 1.1.2.6 2002/09/09 21:49:16 guus Exp $ $Id: avl_tree.h,v 1.1.2.7 2002/09/09 22:32:27 guus Exp $
*/ */

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.c,v 1.1.2.12 2002/09/09 21:49:16 guus Exp $ $Id: list.c,v 1.1.2.13 2002/09/09 22:32:27 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.h,v 1.1.2.7 2002/09/09 21:49:16 guus Exp $ $Id: list.h,v 1.1.2.8 2002/09/09 22:32:27 guus Exp $
*/ */
#ifndef __TINC_LIST_H__ #ifndef __TINC_LIST_H__

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c,v 1.9.4.59 2002/09/09 21:24:25 guus Exp $ $Id: conf.c,v 1.9.4.60 2002/09/09 22:32:30 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: connection.c,v 1.1.2.33 2002/09/09 21:24:31 guus Exp $ $Id: connection.c,v 1.1.2.34 2002/09/09 22:32:30 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.2 2002/09/09 21:25:18 guus Exp $ $Id: device.c,v 1.1.2.3 2002/09/09 22:33:21 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.3 2002/09/09 21:25:19 guus Exp $ $Id: device.c,v 1.1.2.4 2002/09/09 22:33:23 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: edge.c,v 1.1.2.16 2002/09/09 21:24:31 guus Exp $ $Id: edge.c,v 1.1.2.17 2002/09/09 22:32:30 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: event.c,v 1.1.4.5 2002/09/09 21:24:31 guus Exp $ $Id: event.c,v 1.1.4.6 2002/09/09 22:32:30 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: event.h,v 1.1.4.3 2002/09/09 21:24:34 guus Exp $ $Id: event.h,v 1.1.4.4 2002/09/09 22:32:36 guus Exp $
*/ */
#ifndef __TINC_EVENT_H__ #ifndef __TINC_EVENT_H__

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.6 2002/09/09 21:25:19 guus Exp $ $Id: device.c,v 1.1.2.7 2002/09/09 22:33:23 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.11 2002/09/09 21:25:23 guus Exp $ $Id: device.c,v 1.1.2.12 2002/09/09 22:33:24 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -73,7 +73,9 @@ int setup_device(void)
{ {
struct ifreq ifr; struct ifreq ifr;
cp if(!get_config_string(lookup_config(config_tree, "Device"), &device)) cp();
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE; device = DEFAULT_DEVICE;
if(!get_config_string(lookup_config(config_tree, "Interface"), &interface)) if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
@ -82,13 +84,13 @@ int setup_device(void)
#else #else
interface = rindex(device, '/') ? rindex(device, '/') + 1 : device; interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
#endif #endif
cp device_fd = open(device, O_RDWR | O_NONBLOCK); device_fd = open(device, O_RDWR | O_NONBLOCK);
if(device_fd < 0) { if(device_fd < 0) {
syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno)); syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
return -1; return -1;
} }
cp
/* Set default MAC address for ethertap devices */ /* Set default MAC address for ethertap devices */
mymac.type = SUBNET_MAC; mymac.type = SUBNET_MAC;
mymac.net.mac.address.x[0] = 0xfe; mymac.net.mac.address.x[0] = 0xfe;
@ -102,10 +104,12 @@ int setup_device(void)
/* Ok now check if this is an old ethertap or a new tun/tap thingie */ /* Ok now check if this is an old ethertap or a new tun/tap thingie */
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
cp ifr.ifr_flags = IFF_TAP | IFF_NO_PI; ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
if(interface) if(interface)
strncpy(ifr.ifr_name, interface, IFNAMSIZ); strncpy(ifr.ifr_name, interface, IFNAMSIZ);
cp if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
device_info = _("Linux tun/tap device"); device_info = _("Linux tun/tap device");
device_type = DEVICE_TYPE_TUNTAP; device_type = DEVICE_TYPE_TUNTAP;
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ); strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
@ -125,12 +129,15 @@ int setup_device(void)
} }
syslog(LOG_INFO, _("%s is a %s"), device, device_info); syslog(LOG_INFO, _("%s is a %s"), device, device_info);
cp return 0;
return 0;
} }
void close_device(void) void close_device(void)
{ {
cp close(device_fd); cp();
close(device_fd);
} }
/* /*
@ -140,7 +147,10 @@ void close_device(void)
int read_packet(vpn_packet_t *packet) int read_packet(vpn_packet_t *packet)
{ {
int lenin; int lenin;
cp if(device_type == DEVICE_TYPE_TUNTAP) {
cp();
if(device_type == DEVICE_TYPE_TUNTAP) {
lenin = read(device_fd, packet->data, MTU); lenin = read(device_fd, packet->data, MTU);
if(lenin <= 0) { if(lenin <= 0) {
@ -171,11 +181,13 @@ int read_packet(vpn_packet_t * packet)
} }
return 0; return 0;
cp} }
int write_packet(vpn_packet_t *packet) int write_packet(vpn_packet_t *packet)
{ {
cp if(debug_lvl >= DEBUG_TRAFFIC) cp();
if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"), syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
packet->len, device_info); packet->len, device_info);
@ -186,8 +198,8 @@ int write_packet(vpn_packet_t * packet)
return -1; return -1;
} }
} else { /* ethertap */ } else { /* ethertap */
*(short int *)(packet->data - 2) = packet->len; *(short int *)(packet->data - 2) = packet->len;
if(write(device_fd, packet->data - 2, packet->len + 2) < 0) { if(write(device_fd, packet->data - 2, packet->len + 2) < 0) {
syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device, syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device,
strerror(errno)); strerror(errno));
@ -196,12 +208,15 @@ int write_packet(vpn_packet_t * packet)
} }
device_total_out += packet->len; device_total_out += packet->len;
cp return 0;
return 0;
} }
void dump_device_stats(void) void dump_device_stats(void)
{ {
cp syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); cp();
syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);
syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in);
syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out);
cp} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: meta.c,v 1.1.2.29 2002/09/09 21:24:34 guus Exp $ $Id: meta.c,v 1.1.2.30 2002/09/09 22:32:39 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.180 2002/09/09 21:24:34 guus Exp $ $Id: net.c,v 1.35.4.181 2002/09/09 22:32:39 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_packet.c,v 1.1.2.22 2002/09/09 21:24:41 guus Exp $ $Id: net_packet.c,v 1.1.2.23 2002/09/09 22:32:44 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_setup.c,v 1.1.2.25 2002/09/09 21:24:41 guus Exp $ $Id: net_setup.c,v 1.1.2.26 2002/09/09 22:32:44 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_socket.c,v 1.1.2.20 2002/09/09 21:24:41 guus Exp $ $Id: net_socket.c,v 1.1.2.21 2002/09/09 22:32:44 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.5 2002/09/09 21:25:23 guus Exp $ $Id: device.c,v 1.1.2.6 2002/09/09 22:33:24 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: netutl.c,v 1.12.4.43 2002/09/09 21:24:41 guus Exp $ $Id: netutl.c,v 1.12.4.44 2002/09/09 22:32:44 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: node.c,v 1.1.2.17 2002/09/09 21:24:41 guus Exp $ $Id: node.c,v 1.1.2.18 2002/09/09 22:32:49 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.10 2002/09/09 21:25:26 guus Exp $ $Id: device.c,v 1.1.2.11 2002/09/09 22:33:27 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.c,v 1.1.2.46 2002/09/09 21:24:41 guus Exp $ $Id: process.c,v 1.1.2.47 2002/09/09 22:32:49 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.c,v 1.28.4.136 2002/09/09 21:24:41 guus Exp $ $Id: protocol.c,v 1.28.4.137 2002/09/09 22:32:49 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.h,v 1.5.4.35 2002/09/09 21:24:42 guus Exp $ $Id: protocol.h,v 1.5.4.36 2002/09/09 22:32:55 guus Exp $
*/ */
#ifndef __TINC_PROTOCOL_H__ #ifndef __TINC_PROTOCOL_H__

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_auth.c,v 1.1.4.16 2002/09/09 21:24:45 guus Exp $ $Id: protocol_auth.c,v 1.1.4.17 2002/09/09 22:32:59 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_edge.c,v 1.1.4.12 2002/09/09 21:24:48 guus Exp $ $Id: protocol_edge.c,v 1.1.4.13 2002/09/09 22:33:02 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_key.c,v 1.1.4.13 2002/09/09 21:24:56 guus Exp $ $Id: protocol_key.c,v 1.1.4.14 2002/09/09 22:33:03 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_misc.c,v 1.1.4.6 2002/09/09 21:25:02 guus Exp $ $Id: protocol_misc.c,v 1.1.4.7 2002/09/09 22:33:04 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_node.c,v 1.1.4.8 2002/09/09 21:25:02 guus Exp $ $Id: protocol_node.c,v 1.1.4.9 2002/09/09 22:33:08 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_subnet.c,v 1.1.4.8 2002/09/09 21:25:02 guus Exp $ $Id: protocol_subnet.c,v 1.1.4.9 2002/09/09 22:33:13 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.2 2002/09/09 21:25:28 guus Exp $ $Id: device.c,v 1.1.2.3 2002/09/09 22:33:31 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: route.c,v 1.1.2.45 2002/09/09 21:25:07 guus Exp $ $Id: route.c,v 1.1.2.46 2002/09/09 22:33:16 guus Exp $
*/ */
#include "config.h" #include "config.h"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.9 2002/09/09 21:25:28 guus Exp $ $Id: device.c,v 1.1.2.10 2002/09/09 22:33:31 guus Exp $
*/ */

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: subnet.c,v 1.1.2.41 2002/09/09 21:25:10 guus Exp $ $Id: subnet.c,v 1.1.2.42 2002/09/09 22:33:21 guus Exp $
*/ */
#include "config.h" #include "config.h"