Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1
Conflicts: NEWS configure.in doc/tincd.8.in lib/pidfile.c lib/pidfile.h lib/xalloc.h lib/xmalloc.c src/conf.c src/conf.h src/connection.c src/connection.h src/event.c src/graph.c src/graph.h src/net.c src/net.h src/node.h src/openssl/crypto.c src/process.c src/protocol.c src/protocol_key.c src/route.c
This commit is contained in:
commit
33f241d978
34 changed files with 90 additions and 63 deletions
1
AUTHORS
1
AUTHORS
|
@ -11,6 +11,7 @@ Significant contributions from:
|
||||||
- Julien Muchembled <jm@jmuchemb.eu>
|
- Julien Muchembled <jm@jmuchemb.eu>
|
||||||
- Timothy Redaelli <timothy@redaelli.eu>
|
- Timothy Redaelli <timothy@redaelli.eu>
|
||||||
- Brandon Black <blblack@gmail.com>
|
- Brandon Black <blblack@gmail.com>
|
||||||
|
- Loïc Grenié <loic.grenie@gmail.com>
|
||||||
|
|
||||||
These files are from other sources:
|
These files are from other sources:
|
||||||
* lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from
|
* lib/pidfile.h and lib/pidfile.c are by Martin Schulze, taken from
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -4,6 +4,8 @@ Version 1.1-cvs Work in progress
|
||||||
|
|
||||||
* Use splay trees instead of AVL trees.
|
* Use splay trees instead of AVL trees.
|
||||||
|
|
||||||
|
* Fix ProcessPriority option under Windows.
|
||||||
|
|
||||||
Version 1.0.14 May 8 2011
|
Version 1.0.14 May 8 2011
|
||||||
|
|
||||||
* Fixed reading configuration files that do not end with a newline. Again.
|
* Fixed reading configuration files that do not end with a newline. Again.
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -19,6 +19,7 @@ We would like to thank the following people for their contributions to tinc:
|
||||||
* Jeroen Ubbink
|
* Jeroen Ubbink
|
||||||
* Jerome Etienne
|
* Jerome Etienne
|
||||||
* Julien Muchembled
|
* Julien Muchembled
|
||||||
|
* Loïc Grenié
|
||||||
* Lubomír Bulej
|
* Lubomír Bulej
|
||||||
* Mads Kiilerich
|
* Mads Kiilerich
|
||||||
* Marc A. Lehmann
|
* Marc A. Lehmann
|
||||||
|
|
|
@ -127,7 +127,7 @@ AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp,
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall putenv random select strdup strerror strsignal strtol system time usleep unsetenv vsyslog writev],
|
AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall pselect putenv random select strdup strerror strsignal strtol system time usleep unsetenv vsyslog writev],
|
||||||
[], [], [#include "have.h"]
|
[], [], [#include "have.h"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1636,6 +1636,8 @@ You can also send the following signals to a running tincd process:
|
||||||
Partially rereads configuration files.
|
Partially rereads configuration files.
|
||||||
Connections to hosts whose host config file are removed are closed.
|
Connections to hosts whose host config file are removed are closed.
|
||||||
New outgoing connections specified in @file{tinc.conf} will be made.
|
New outgoing connections specified in @file{tinc.conf} will be made.
|
||||||
|
If the --logfile option is used, this will also close and reopen the log file,
|
||||||
|
useful when log rotation is used.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,19 @@ Connections to hosts whose host config file are removed are closed.
|
||||||
New outgoing connections specified in
|
New outgoing connections specified in
|
||||||
.Pa tinc.conf
|
.Pa tinc.conf
|
||||||
will be made.
|
will be made.
|
||||||
|
If the
|
||||||
|
.Fl -logfile
|
||||||
|
option is used, this will also close and reopen the log file,
|
||||||
|
useful when log rotation is used.
|
||||||
|
.It INT
|
||||||
|
Temporarily increases debug level to 5.
|
||||||
|
Send this signal again to revert to the original level.
|
||||||
|
.It USR1
|
||||||
|
Dumps the connection list to syslog.
|
||||||
|
.It USR2
|
||||||
|
Dumps virtual network device statistics, all known nodes, edges and subnets to syslog.
|
||||||
|
.It WINCH
|
||||||
|
Purges all information remembered about unreachable nodes.
|
||||||
.El
|
.El
|
||||||
.Sh DEBUG LEVELS
|
.Sh DEBUG LEVELS
|
||||||
The tinc daemon can send a lot of messages to the syslog.
|
The tinc daemon can send a lot of messages to the syslog.
|
||||||
|
|
|
@ -2,6 +2,20 @@ dnl Check to find the OpenSSL headers/libraries
|
||||||
|
|
||||||
AC_DEFUN([tinc_OPENSSL],
|
AC_DEFUN([tinc_OPENSSL],
|
||||||
[
|
[
|
||||||
|
case $host_os in
|
||||||
|
*mingw*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_CHECK_FUNC(dlopen,
|
||||||
|
[],
|
||||||
|
[AC_CHECK_LIB(dl, dlopen,
|
||||||
|
[LIBS="$LIBS -ldl"],
|
||||||
|
[AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AC_ARG_WITH(openssl,
|
AC_ARG_WITH(openssl,
|
||||||
AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
|
AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
|
||||||
[openssl="$withval"
|
[openssl="$withval"
|
||||||
|
@ -31,20 +45,6 @@ AC_DEFUN([tinc_OPENSSL],
|
||||||
[AC_MSG_ERROR([OpenSSL libraries not found.])]
|
[AC_MSG_ERROR([OpenSSL libraries not found.])]
|
||||||
)
|
)
|
||||||
|
|
||||||
case $host_os in
|
|
||||||
*mingw*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_CHECK_FUNC(dlopen,
|
|
||||||
[],
|
|
||||||
[AC_CHECK_LIB(dl, dlopen,
|
|
||||||
[LIBS="$LIBS -ldl"],
|
|
||||||
[AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
|
AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
|
||||||
[AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
|
[AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "splay_tree.h"
|
#include "splay_tree.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "list.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "netutl.h" /* for str2address */
|
#include "netutl.h" /* for str2address */
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
#include "control_common.h"
|
#include "control_common.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h" /* Don't ask. */
|
|
||||||
#include "netutl.h"
|
|
||||||
#include "subnet.h"
|
#include "subnet.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
|
@ -48,7 +48,6 @@ typedef struct connection_status_t {
|
||||||
} connection_status_t;
|
} connection_status_t;
|
||||||
|
|
||||||
#include "edge.h"
|
#include "edge.h"
|
||||||
#include "list.h"
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <w32api/winioctl.h>
|
#include <w32api/winioctl.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
|
|
27
src/graph.c
27
src/graph.c
|
@ -49,6 +49,7 @@
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "edge.h"
|
#include "edge.h"
|
||||||
|
#include "graph.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "netutl.h"
|
#include "netutl.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
@ -183,9 +184,6 @@ static void sssp_dijkstra(void) {
|
||||||
n->address is set to the e->address of the edge left of n to n.
|
n->address is set to the e->address of the edge left of n to n.
|
||||||
We are currently examining the edge e right of n from n:
|
We are currently examining the edge e right of n from n:
|
||||||
|
|
||||||
- If e->reverse->address != n->address, then e->to is probably
|
|
||||||
not reachable for the nodes left of n. We do as if the indirectdata
|
|
||||||
flag is set on edge e.
|
|
||||||
- If edge e provides for better reachability of e->to, update e->to.
|
- If edge e provides for better reachability of e->to, update e->to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -203,27 +201,8 @@ static void sssp_dijkstra(void) {
|
||||||
e->to->via = indirect ? n->via : e->to;
|
e->to->via = indirect ? n->via : e->to;
|
||||||
e->to->options = e->options;
|
e->to->options = e->options;
|
||||||
|
|
||||||
if(sockaddrcmp(&e->to->address, &e->address)) {
|
if(e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN)
|
||||||
node = splay_unlink(node_udp_tree, e->to);
|
update_node_udp(e->to, &e->address);
|
||||||
sockaddrfree(&e->to->address);
|
|
||||||
sockaddrcpy(&e->to->address, &e->address);
|
|
||||||
|
|
||||||
if(e->to->hostname)
|
|
||||||
free(e->to->hostname);
|
|
||||||
|
|
||||||
e->to->hostname = sockaddr2hostname(&e->to->address);
|
|
||||||
|
|
||||||
if(node)
|
|
||||||
splay_insert_node(node_udp_tree, node);
|
|
||||||
|
|
||||||
if(e->to->options & OPTION_PMTU_DISCOVERY) {
|
|
||||||
e->to->mtuprobes = 0;
|
|
||||||
e->to->minmtu = 0;
|
|
||||||
e->to->maxmtu = MTU;
|
|
||||||
if(e->to->status.validkey)
|
|
||||||
send_mtu_probe(e->to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ifdebug(SCARY_THINGS) logger(LOG_DEBUG, " Updating edge %s - %s weight %d distance %d", e->from->name,
|
ifdebug(SCARY_THINGS) logger(LOG_DEBUG, " Updating edge %s - %s weight %d distance %d", e->from->name,
|
||||||
e->to->name, e->weight, e->to->distance);
|
e->to->name, e->weight, e->to->distance);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#define __TINC_GRAPH_H__
|
#define __TINC_GRAPH_H__
|
||||||
|
|
||||||
extern void graph(void);
|
extern void graph(void);
|
||||||
extern void mst_kruskal(void);
|
extern void dump_graph(void);
|
||||||
extern void sssp_bfs(void);
|
|
||||||
|
|
||||||
#endif /* __TINC_GRAPH_H__ */
|
#endif /* __TINC_GRAPH_H__ */
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#define DEFAULT_DEVICE "/dev/net/tun"
|
#define DEFAULT_DEVICE "/dev/net/tun"
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
28
src/logger.c
28
src/logger.c
|
@ -44,14 +44,18 @@ void openlogger(const char *ident, logmode_t mode) {
|
||||||
case LOGMODE_FILE:
|
case LOGMODE_FILE:
|
||||||
logpid = getpid();
|
logpid = getpid();
|
||||||
logfile = fopen(logfilename, "a");
|
logfile = fopen(logfilename, "a");
|
||||||
if(!logfile)
|
if(!logfile) {
|
||||||
|
fprintf(stderr, "Could not open log file %s: %s\n", logfilename, strerror(errno));
|
||||||
logmode = LOGMODE_NULL;
|
logmode = LOGMODE_NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LOGMODE_SYSLOG:
|
case LOGMODE_SYSLOG:
|
||||||
#ifdef HAVE_MINGW
|
#ifdef HAVE_MINGW
|
||||||
loghandle = RegisterEventSource(NULL, logident);
|
loghandle = RegisterEventSource(NULL, logident);
|
||||||
if(!loghandle)
|
if(!loghandle) {
|
||||||
|
fprintf(stderr, "Could not open log handle!");
|
||||||
logmode = LOGMODE_NULL;
|
logmode = LOGMODE_NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
|
@ -64,8 +68,24 @@ void openlogger(const char *ident, logmode_t mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reopenlogger() {
|
||||||
|
if(logmode != LOGMODE_FILE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fflush(logfile);
|
||||||
|
FILE *newfile = fopen(logfilename, "a");
|
||||||
|
if(!newfile) {
|
||||||
|
logger(LOG_ERR, "Unable to reopen log file %s: %s\n", logfilename, strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fclose(logfile);
|
||||||
|
logfile = newfile;
|
||||||
|
}
|
||||||
|
|
||||||
void logger(int priority, const char *format, ...) {
|
void logger(int priority, const char *format, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
char timestr[32] = "";
|
||||||
|
time_t now;
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
|
||||||
|
@ -76,7 +96,9 @@ void logger(int priority, const char *format, ...) {
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
break;
|
break;
|
||||||
case LOGMODE_FILE:
|
case LOGMODE_FILE:
|
||||||
fprintf(logfile, "%ld %s[%ld]: ", time(NULL), logident, (long)logpid);
|
now = time(NULL);
|
||||||
|
strftime(timestr, sizeof timestr, "%Y-%m-%d %H:%M:%S", localtime(&now));
|
||||||
|
fprintf(logfile, "%s %s[%ld]: ", timestr, logident, (long)logpid);
|
||||||
vfprintf(logfile, format, ap);
|
vfprintf(logfile, format, ap);
|
||||||
fprintf(logfile, "\n");
|
fprintf(logfile, "\n");
|
||||||
fflush(logfile);
|
fflush(logfile);
|
||||||
|
|
|
@ -47,6 +47,7 @@ enum {
|
||||||
|
|
||||||
extern debug_t debug_level;
|
extern debug_t debug_level;
|
||||||
extern void openlogger(const char *, logmode_t);
|
extern void openlogger(const char *, logmode_t);
|
||||||
|
extern void reopenlogger(void);
|
||||||
extern void logger(int, const char *, ...) __attribute__ ((__format__(printf, 2, 3)));
|
extern void logger(int, const char *, ...) __attribute__ ((__format__(printf, 2, 3)));
|
||||||
extern void closelogger(void);
|
extern void closelogger(void);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
Copyright (C) 1998-2005 Ivo Timmermans,
|
Copyright (C) 1998-2005 Ivo Timmermans,
|
||||||
2000-2011 Guus Sliepen <guus@tinc-vpn.org>
|
2000-2011 Guus Sliepen <guus@tinc-vpn.org>
|
||||||
2006 Scott Lamb <slamb@slamb.org>
|
2006 Scott Lamb <slamb@slamb.org>
|
||||||
|
2011 Loïc Grenié <loic.grenie@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -166,14 +167,14 @@ static void timeout_handler(int fd, short events, void *event) {
|
||||||
next = node->next;
|
next = node->next;
|
||||||
c = node->data;
|
c = node->data;
|
||||||
|
|
||||||
if(c->last_ping_time + pingtimeout < now) {
|
if(c->last_ping_time + pingtimeout <= now) {
|
||||||
if(c->status.active) {
|
if(c->status.active) {
|
||||||
if(c->status.pinged) {
|
if(c->status.pinged) {
|
||||||
ifdebug(CONNECTIONS) logger(LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds",
|
ifdebug(CONNECTIONS) logger(LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds",
|
||||||
c->name, c->hostname, now - c->last_ping_time);
|
c->name, c->hostname, now - c->last_ping_time);
|
||||||
terminate_connection(c, true);
|
terminate_connection(c, true);
|
||||||
continue;
|
continue;
|
||||||
} else if(c->last_ping_time + pinginterval < now) {
|
} else if(c->last_ping_time + pinginterval <= now) {
|
||||||
send_ping(c);
|
send_ping(c);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -132,7 +132,7 @@ extern void handle_new_meta_connection(int, short, void *);
|
||||||
extern int setup_listen_socket(const sockaddr_t *);
|
extern int setup_listen_socket(const sockaddr_t *);
|
||||||
extern int setup_vpn_in_socket(const sockaddr_t *);
|
extern int setup_vpn_in_socket(const sockaddr_t *);
|
||||||
extern void send_packet(struct node_t *, vpn_packet_t *);
|
extern void send_packet(struct node_t *, vpn_packet_t *);
|
||||||
extern void receive_tcppacket(struct connection_t *, char *, int);
|
extern void receive_tcppacket(struct connection_t *, const char *, int);
|
||||||
extern void broadcast_packet(const struct node_t *, vpn_packet_t *);
|
extern void broadcast_packet(const struct node_t *, vpn_packet_t *);
|
||||||
extern bool setup_network(void);
|
extern bool setup_network(void);
|
||||||
extern void setup_outgoing_connection(struct outgoing_t *);
|
extern void setup_outgoing_connection(struct outgoing_t *);
|
||||||
|
@ -145,11 +145,11 @@ extern bool read_rsa_public_key(struct connection_t *);
|
||||||
extern void send_mtu_probe(struct node_t *);
|
extern void send_mtu_probe(struct node_t *);
|
||||||
extern void handle_device_data(int, short, void *);
|
extern void handle_device_data(int, short, void *);
|
||||||
extern void handle_meta_connection_data(int, short, void *);
|
extern void handle_meta_connection_data(int, short, void *);
|
||||||
extern void regenerate_key();
|
extern void regenerate_key(void);
|
||||||
extern void purge(void);
|
extern void purge(void);
|
||||||
extern void retry(void);
|
extern void retry(void);
|
||||||
extern int reload_configuration(void);
|
extern int reload_configuration(void);
|
||||||
extern void load_all_subnets();
|
extern void load_all_subnets(void);
|
||||||
|
|
||||||
#ifndef HAVE_MINGW
|
#ifndef HAVE_MINGW
|
||||||
#define closesocket(s) close(s)
|
#define closesocket(s) close(s)
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "ethernet.h"
|
#include "ethernet.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "list.h"
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "netutl.h"
|
#include "netutl.h"
|
||||||
|
@ -357,7 +356,7 @@ static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) {
|
||||||
receive_packet(n, inpkt);
|
receive_packet(n, inpkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void receive_tcppacket(connection_t *c, char *buffer, int len) {
|
void receive_tcppacket(connection_t *c, const char *buffer, int len) {
|
||||||
vpn_packet_t outpkt;
|
vpn_packet_t outpkt;
|
||||||
|
|
||||||
outpkt.len = len;
|
outpkt.len = len;
|
||||||
|
@ -398,7 +397,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
|
||||||
"No valid key known yet for %s (%s), forwarding via TCP",
|
"No valid key known yet for %s (%s), forwarding via TCP",
|
||||||
n->name, n->hostname);
|
n->name, n->hostname);
|
||||||
|
|
||||||
if(n->last_req_key + 10 < now) {
|
if(n->last_req_key + 10 <= now) {
|
||||||
send_req_key(n);
|
send_req_key(n);
|
||||||
n->last_req_key = now;
|
n->last_req_key = now;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "cipher.h"
|
#include "cipher.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "digest.h"
|
#include "digest.h"
|
||||||
#include "list.h"
|
|
||||||
#include "subnet.h"
|
#include "subnet.h"
|
||||||
|
|
||||||
typedef struct node_status_t {
|
typedef struct node_status_t {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "edge.h"
|
#include "edge.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
#include "net.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "subnet.h"
|
#include "subnet.h"
|
||||||
|
|
|
@ -205,7 +205,7 @@ static void age_past_requests(int fd, short events, void *data) {
|
||||||
next = node->next;
|
next = node->next;
|
||||||
p = node->data;
|
p = node->data;
|
||||||
|
|
||||||
if(p->firstseen + pinginterval < now)
|
if(p->firstseen + pinginterval <= now)
|
||||||
splay_delete_node(past_request_tree, node), deleted++;
|
splay_delete_node(past_request_tree, node), deleted++;
|
||||||
else
|
else
|
||||||
left++;
|
left++;
|
||||||
|
|
|
@ -96,10 +96,10 @@ extern bool send_add_subnet(struct connection_t *, const struct subnet_t *);
|
||||||
extern bool send_del_subnet(struct connection_t *, const struct subnet_t *);
|
extern bool send_del_subnet(struct connection_t *, const struct subnet_t *);
|
||||||
extern bool send_add_edge(struct connection_t *, const struct edge_t *);
|
extern bool send_add_edge(struct connection_t *, const struct edge_t *);
|
||||||
extern bool send_del_edge(struct connection_t *, const struct edge_t *);
|
extern bool send_del_edge(struct connection_t *, const struct edge_t *);
|
||||||
extern void send_key_changed();
|
extern void send_key_changed(void);
|
||||||
extern bool send_req_key(struct node_t *);
|
extern bool send_req_key(struct node_t *);
|
||||||
extern bool send_ans_key(struct node_t *);
|
extern bool send_ans_key(struct node_t *);
|
||||||
extern bool send_tcppacket(struct connection_t *, struct vpn_packet_t *);
|
extern bool send_tcppacket(struct connection_t *, const struct vpn_packet_t *);
|
||||||
|
|
||||||
/* Request handlers */
|
/* Request handlers */
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool pong_h(connection_t *c, char *request) {
|
||||||
|
|
||||||
/* Sending and receiving packets via TCP */
|
/* Sending and receiving packets via TCP */
|
||||||
|
|
||||||
bool send_tcppacket(connection_t *c, vpn_packet_t *packet) {
|
bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) {
|
||||||
/* If there already is a lot of data in the outbuf buffer, discard this packet.
|
/* If there already is a lot of data in the outbuf buffer, discard this packet.
|
||||||
We use a very simple Random Early Drop algorithm. */
|
We use a very simple Random Early Drop algorithm. */
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <netpacket/packet.h>
|
#include <netpacket/packet.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <net/if_tun.h>
|
#include <net/if_tun.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
|
@ -339,7 +339,7 @@ static bool drop_privs(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MINGW
|
#ifdef HAVE_MINGW
|
||||||
# define setpriority(level) SetPriorityClass(GetCurrentProcess(), (level))
|
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
|
||||||
#else
|
#else
|
||||||
# define NORMAL_PRIORITY_CLASS 0
|
# define NORMAL_PRIORITY_CLASS 0
|
||||||
# define BELOW_NORMAL_PRIORITY_CLASS 10
|
# define BELOW_NORMAL_PRIORITY_CLASS 10
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
|
@ -67,7 +67,7 @@ const char *winerror(int err) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int bitfield_to_int(void *bitfield, size_t size) {
|
unsigned int bitfield_to_int(const void *bitfield, size_t size) {
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
if(size > sizeof value)
|
if(size > sizeof value)
|
||||||
size = sizeof value;
|
size = sizeof value;
|
||||||
|
|
|
@ -42,6 +42,6 @@ extern const char *winerror(int);
|
||||||
#define sockinuse(x) ((x) == EADDRINUSE)
|
#define sockinuse(x) ((x) == EADDRINUSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern unsigned int bitfield_to_int(void *bitfield, size_t size);
|
extern unsigned int bitfield_to_int(const void *bitfield, size_t size);
|
||||||
|
|
||||||
#endif /* __TINC_UTILS_H__ */
|
#endif /* __TINC_UTILS_H__ */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <libvdeplug_dyn.h>
|
#include <libvdeplug_dyn.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "device.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
Loading…
Reference in a new issue