Fix whitespace.
This commit is contained in:
parent
58f4b845b9
commit
d917c8cb6b
73 changed files with 474 additions and 478 deletions
|
@ -236,8 +236,9 @@ static char *readline(FILE * fp, char *buf, size_t buflen) {
|
||||||
if(!newline)
|
if(!newline)
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
*newline = '\0'; /* kill newline */
|
/* kill newline and carriage return if necessary */
|
||||||
if(newline > p && newline[-1] == '\r') /* and carriage return if necessary */
|
*newline = '\0';
|
||||||
|
if(newline > p && newline[-1] == '\r')
|
||||||
newline[-1] = '\0';
|
newline[-1] = '\0';
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -376,9 +377,8 @@ bool read_server_config(void) {
|
||||||
xasprintf(&fname, "%s" SLASH "tinc.conf", confbase);
|
xasprintf(&fname, "%s" SLASH "tinc.conf", confbase);
|
||||||
x = read_config_file(config_tree, fname);
|
x = read_config_file(config_tree, fname);
|
||||||
|
|
||||||
if(!x) { /* System error: complain */
|
if(!x)
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "Failed to read `%s': %s", fname, strerror(errno));
|
logger(DEBUG_ALWAYS, LOG_ERR, "Failed to read `%s': %s", fname, strerror(errno));
|
||||||
}
|
|
||||||
|
|
||||||
free(fname);
|
free(fname);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
list_t *connection_list; /* Meta connections */
|
list_t *connection_list;
|
||||||
connection_t *everyone;
|
connection_t *everyone;
|
||||||
|
|
||||||
void init_connections(void) {
|
void init_connections(void) {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
splay_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */
|
splay_tree_t *edge_weight_tree;
|
||||||
|
|
||||||
static int edge_compare(const edge_t *a, const edge_t *b) {
|
static int edge_compare(const edge_t *a, const edge_t *b) {
|
||||||
return strcmp(a->to->name, b->to->name);
|
return strcmp(a->to->name, b->to->name);
|
||||||
|
|
|
@ -32,8 +32,7 @@ struct addrinfo {
|
||||||
#endif /* !HAVE_STRUCT_ADDRINFO */
|
#endif /* !HAVE_STRUCT_ADDRINFO */
|
||||||
|
|
||||||
#if !HAVE_DECL_GETADDRINFO
|
#if !HAVE_DECL_GETADDRINFO
|
||||||
int getaddrinfo(const char *hostname, const char *servname,
|
int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res);
|
||||||
const struct addrinfo *hints, struct addrinfo **res);
|
|
||||||
#endif /* !HAVE_GETADDRINFO */
|
#endif /* !HAVE_GETADDRINFO */
|
||||||
|
|
||||||
#if !HAVE_DECL_GAI_STRERROR
|
#if !HAVE_DECL_GAI_STRERROR
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
#define _FAKE_GETNAMEINFO_H
|
#define _FAKE_GETNAMEINFO_H
|
||||||
|
|
||||||
#if !HAVE_DECL_GETNAMEINFO
|
#if !HAVE_DECL_GETNAMEINFO
|
||||||
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
|
||||||
size_t hostlen, char *serv, size_t servlen, int flags);
|
|
||||||
#endif /* !HAVE_GETNAMEINFO */
|
#endif /* !HAVE_GETNAMEINFO */
|
||||||
|
|
||||||
#ifndef NI_MAXSERV
|
#ifndef NI_MAXSERV
|
||||||
|
|
|
@ -31,8 +31,11 @@
|
||||||
#define MTU 1518 /* 1500 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */
|
#define MTU 1518 /* 1500 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXSIZE (MTU + 4 + CIPHER_MAX_BLOCK_SIZE + DIGEST_MAX_SIZE + MTU/64 + 20) /* MTU + seqno + padding + HMAC + compressor overhead */
|
/* MAXSIZE is the maximum size of an encapsulated packet: MTU + seqno + padding + HMAC + compressor overhead */
|
||||||
#define MAXBUFSIZE ((MAXSIZE > 2048 ? MAXSIZE : 2048) + 128) /* Enough room for a request with a MAXSIZEd packet or a 8192 bits RSA key */
|
#define MAXSIZE (MTU + 4 + CIPHER_MAX_BLOCK_SIZE + DIGEST_MAX_SIZE + MTU/64 + 20)
|
||||||
|
|
||||||
|
/* MAXBUFSIZE is the maximum size of a request: enough for a MAXSIZEd packet or a 8192 bits RSA key */
|
||||||
|
#define MAXBUFSIZE ((MAXSIZE > 2048 ? MAXSIZE : 2048) + 128)
|
||||||
|
|
||||||
#define MAXSOCKETS 8 /* Probably overkill... */
|
#define MAXSOCKETS 8 /* Probably overkill... */
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
splay_tree_t *node_tree; /* Known nodes, sorted by name */
|
splay_tree_t *node_tree;
|
||||||
static hash_t *node_udp_cache;
|
static hash_t *node_udp_cache;
|
||||||
|
|
||||||
node_t *myself;
|
node_t *myself;
|
||||||
|
|
10
src/route.c
10
src/route.c
|
@ -591,8 +591,8 @@ static void route_neighborsol(node_t *source, vpn_packet_t *packet) {
|
||||||
bool has_opt;
|
bool has_opt;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct in6_addr ip6_src; /* source address */
|
struct in6_addr ip6_src;
|
||||||
struct in6_addr ip6_dst; /* destination address */
|
struct in6_addr ip6_dst;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
uint32_t next;
|
uint32_t next;
|
||||||
} pseudo;
|
} pseudo;
|
||||||
|
@ -941,11 +941,10 @@ void route(node_t *source, vpn_packet_t *packet) {
|
||||||
if(!do_decrement_ttl(source, packet))
|
if(!do_decrement_ttl(source, packet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (routing_mode) {
|
|
||||||
case RMODE_ROUTER:
|
|
||||||
{
|
|
||||||
uint16_t type = packet->data[12] << 8 | packet->data[13];
|
uint16_t type = packet->data[12] << 8 | packet->data[13];
|
||||||
|
|
||||||
|
switch (routing_mode) {
|
||||||
|
case RMODE_ROUTER:
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ETH_P_ARP:
|
case ETH_P_ARP:
|
||||||
route_arp(source, packet);
|
route_arp(source, packet);
|
||||||
|
@ -963,7 +962,6 @@ void route(node_t *source, vpn_packet_t *packet) {
|
||||||
logger(DEBUG_TRAFFIC, LOG_WARNING, "Cannot route packet from %s (%s): unknown type %hx", source->name, source->hostname, type);
|
logger(DEBUG_TRAFFIC, LOG_WARNING, "Cannot route packet from %s (%s): unknown type %hx", source->name, source->hostname, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RMODE_SWITCH:
|
case RMODE_SWITCH:
|
||||||
|
|
|
@ -186,11 +186,11 @@ static bool parse_options(int argc, char **argv) {
|
||||||
pidfilename = xstrdup(optarg);
|
pidfilename = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6: /* force */
|
||||||
force = true;
|
force = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?': /* wrong options */
|
||||||
usage(true);
|
usage(true);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
11
src/tincd.c
11
src/tincd.c
|
@ -217,7 +217,7 @@ static bool parse_options(int argc, char **argv) {
|
||||||
pidfilename = xstrdup(optarg);
|
pidfilename = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?': /* wrong options */
|
||||||
usage(true);
|
usage(true);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -472,20 +472,17 @@ int main2(int argc, char **argv) {
|
||||||
if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
|
if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
|
||||||
if(!strcasecmp(priority, "Normal")) {
|
if(!strcasecmp(priority, "Normal")) {
|
||||||
if (setpriority(NORMAL_PRIORITY_CLASS) != 0) {
|
if (setpriority(NORMAL_PRIORITY_CLASS) != 0) {
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s",
|
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "setpriority", strerror(errno));
|
||||||
"setpriority", strerror(errno));
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if(!strcasecmp(priority, "Low")) {
|
} else if(!strcasecmp(priority, "Low")) {
|
||||||
if (setpriority(BELOW_NORMAL_PRIORITY_CLASS) != 0) {
|
if (setpriority(BELOW_NORMAL_PRIORITY_CLASS) != 0) {
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s",
|
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "setpriority", strerror(errno));
|
||||||
"setpriority", strerror(errno));
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if(!strcasecmp(priority, "High")) {
|
} else if(!strcasecmp(priority, "High")) {
|
||||||
if (setpriority(HIGH_PRIORITY_CLASS) != 0) {
|
if (setpriority(HIGH_PRIORITY_CLASS) != 0) {
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s",
|
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "setpriority", strerror(errno));
|
||||||
"setpriority", strerror(errno));
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue