- Added support for jumbograms.

- Remove tcpaddress from edges, it is not used at all.
- Last bits of code to prevent looping requests.
This commit is contained in:
Guus Sliepen 2002-03-22 11:43:48 +00:00
parent 9da5390666
commit 52e7699273
11 changed files with 80 additions and 53 deletions

View file

@ -67,6 +67,9 @@
/* Define to the location of if_tun.h */ /* Define to the location of if_tun.h */
#undef LINUX_IF_TUN_H #undef LINUX_IF_TUN_H
/* Define to 1 if support for jumbograms is enabled */
#undef ENABLE_JUMBOGRAMS
/* Define to 1 if checkpoint tracing is enabled */ /* Define to 1 if checkpoint tracing is enabled */
#undef ENABLE_TRACING #undef ENABLE_TRACING

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in,v 1.13.2.42 2002/03/10 14:05:35 guus Exp $ dnl $Id: configure.in,v 1.13.2.43 2002/03/22 11:43:46 guus Exp $
AC_INIT(src/tincd.c) AC_INIT(src/tincd.c)
AM_INIT_AUTOMAKE(tinc, 1.0-cvs) AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
@ -100,6 +100,12 @@ tinc_TUNTAP
tinc_OPENSSL tinc_OPENSSL
tinc_ZLIB tinc_ZLIB
dnl Check if support for jumbograms is requested
AC_ARG_ENABLE(jumbograms,
[ --enable-jumbograms enable support for jumbograms (packets up to 9000 bytes)],
[ AC_DEFINE(ENABLE_JUMBOGRAMS) ]
)
dnl Check if checkpoint tracing has to be enabled dnl Check if checkpoint tracing has to be enabled
AC_ARG_ENABLE(tracing, AC_ARG_ENABLE(tracing,
[ --enable-tracing enable checkpoint tracing (debugging only)], [ --enable-tracing enable checkpoint tracing (debugging only)],

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.7 2002/02/18 16:25:16 guus Exp $ $Id: edge.c,v 1.1.2.8 2002/03/22 11:43:46 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -197,17 +197,17 @@ cp
for(node = edge_tree->head; node; node = node->next) for(node = edge_tree->head; node; node = node->next)
{ {
e = (edge_t *)node->data; e = (edge_t *)node->data;
from_tcp = sockaddr2hostname(&e->from.tcpaddress); // from_tcp = sockaddr2hostname(&e->from.tcpaddress);
from_udp = sockaddr2hostname(&e->from.udpaddress); from_udp = sockaddr2hostname(&e->from.udpaddress);
to_tcp = sockaddr2hostname(&e->to.tcpaddress); // to_tcp = sockaddr2hostname(&e->to.tcpaddress);
to_udp = sockaddr2hostname(&e->to.udpaddress); to_udp = sockaddr2hostname(&e->to.udpaddress);
syslog(LOG_DEBUG, _(" %s tcp at %s udp at %s - %s tcp at %s udp at %s options %ld weight %d"), syslog(LOG_DEBUG, _(" %s at %s - %s at %s options %ld weight %d"),
e->from.node->name, from_tcp, from_udp, e->from.node->name, from_udp,
e->to.node->name, to_tcp, to_udp, e->to.node->name, to_udp,
e->options, e->weight); e->options, e->weight);
free(from_tcp); // free(from_tcp);
free(from_udp); free(from_udp);
free(to_tcp); // free(to_tcp);
free(to_udp); free(to_udp);
} }

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.h,v 1.1.2.6 2002/02/18 16:25:16 guus Exp $ $Id: edge.h,v 1.1.2.7 2002/03/22 11:43:46 guus Exp $
*/ */
#ifndef __TINC_EDGE_H__ #ifndef __TINC_EDGE_H__
@ -31,7 +31,7 @@
typedef struct halfconnection_t { typedef struct halfconnection_t {
struct node_t *node; /* node associated with this end of the connection */ struct node_t *node; /* node associated with this end of the connection */
sockaddr_t tcpaddress; /* real (internet) ip on this end of the meta connection */ // sockaddr_t tcpaddress; /* real (internet) ip on this end of the meta connection */
sockaddr_t udpaddress; /* real (internet) ip on this end of the vpn connection */ sockaddr_t udpaddress; /* real (internet) ip on this end of the vpn connection */
} halfconnection_t; } halfconnection_t;

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.164 2002/03/18 22:47:20 guus Exp $ $Id: net.c,v 1.35.4.165 2002/03/22 11:43:46 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -405,6 +405,8 @@ cp
if(routing_mode== RMODE_SWITCH) if(routing_mode== RMODE_SWITCH)
age_mac(); age_mac();
age_past_requests();
/* Should we regenerate our key? */ /* Should we regenerate our key? */
if(keyexpires < now) if(keyexpires < now)

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.h,v 1.9.4.47 2002/03/18 22:47:20 guus Exp $ $Id: net.h,v 1.9.4.48 2002/03/22 11:43:48 guus Exp $
*/ */
#ifndef __TINC_NET_H__ #ifndef __TINC_NET_H__
@ -30,10 +30,16 @@
#include "config.h" #include "config.h"
#define MTU 1514 /* 1500 bytes payload + 14 bytes ethernet header */ #ifdef ENABLE_JUMBOGRAMS
#define MAXSIZE 1600 /* MTU + header (seqno) and trailer (CBC padding and HMAC) */ #define MTU 9014 /* 9000 bytes payload + 14 bytes ethernet header */
#define MAXSIZE 9100 /* MTU + header (seqno) and trailer (CBC padding and HMAC) */
#define MAXBUFSIZE 9100 /* Must support TCP packets of length 9000. */
#else
#define MTU 1514 /* 1500 bytes payload + 14 bytes ethernet header */
#define MAXSIZE 1600 /* MTU + header (seqno) and trailer (CBC padding and HMAC) */
#define MAXBUFSIZE 2100 /* Quite large but needed for support of keys up to 8192 bits. */
#endif
#define MAXBUFSIZE 2048 /* Probably way too much, but it must fit every possible request. */
#define MAXSOCKETS 128 /* Overkill... */ #define MAXSOCKETS 128 /* Overkill... */
typedef struct mac_t typedef struct mac_t

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.11 2002/03/18 22:47:20 guus Exp $ $Id: net_setup.c,v 1.1.2.12 2002/03/22 11:43:48 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -529,6 +529,7 @@ cp
init_nodes(); init_nodes();
init_edges(); init_edges();
init_events(); init_events();
init_requests();
if(get_config_int(lookup_config(config_tree, "PingTimeout"), &pingtimeout)) if(get_config_int(lookup_config(config_tree, "PingTimeout"), &pingtimeout))
{ {
@ -581,6 +582,7 @@ cp
close(listen_socket[i].udp); close(listen_socket[i].udp);
} }
exit_requests();
exit_events(); exit_events();
exit_edges(); exit_edges();
exit_subnets(); exit_subnets();

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.124 2002/03/21 23:11:53 guus Exp $ $Id: protocol.c,v 1.28.4.125 2002/03/22 11:43:48 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -159,7 +159,7 @@ cp
cp cp
} }
void exit_request(void) void exit_requests(void)
{ {
cp cp
avl_delete_tree(past_request_tree); avl_delete_tree(past_request_tree);
@ -173,7 +173,11 @@ cp
p.request = request; p.request = request;
if(avl_search(past_request_tree, &p)) if(avl_search(past_request_tree, &p))
return 1; {
if(debug_lvl >= DEBUG_SCARY_THINGS)
syslog(LOG_DEBUG, _("Already seen request"));
return 1;
}
else else
{ {
new = (past_request_t *)xmalloc(sizeof(*new)); new = (past_request_t *)xmalloc(sizeof(*new));

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.28 2002/03/21 23:11:53 guus Exp $ $Id: protocol.h,v 1.5.4.29 2002/03/22 11:43:48 guus Exp $
*/ */
#ifndef __TINC_PROTOCOL_H__ #ifndef __TINC_PROTOCOL_H__
@ -64,6 +64,11 @@ extern int send_request(connection_t*, const char*, ...);
extern int receive_request(connection_t *); extern int receive_request(connection_t *);
extern int check_id(char *); extern int check_id(char *);
extern void init_requests(void);
extern void exit_requests(void);
extern int seen_request(char *);
extern void age_past_requests(void);
/* Requests */ /* Requests */
extern int send_id(connection_t *); extern int send_id(connection_t *);

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.3 2002/02/20 19:25:09 guus Exp $ $Id: protocol_auth.c,v 1.1.4.4 2002/03/22 11:43:48 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -515,8 +515,7 @@ void send_everything(connection_t *c)
int ack_h(connection_t *c) int ack_h(connection_t *c)
{ {
char address[MAX_STRING_SIZE]; char myaddress[MAX_STRING_SIZE];
char port[MAX_STRING_SIZE];
char hisport[MAX_STRING_SIZE]; char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy; char *hisaddress, *dummy;
int weight; int weight;
@ -525,7 +524,7 @@ int ack_h(connection_t *c)
connection_t *other; connection_t *other;
avl_node_t *node; avl_node_t *node;
cp cp
if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d", hisport, address, port, &weight, &options) != 5) if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" %d %d", hisport, myaddress, &weight, &options) != 4)
{ {
syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name, c->hostname); syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name, c->hostname);
return -1; return -1;
@ -563,10 +562,10 @@ cp
c->edge = new_edge(); c->edge = new_edge();
cp cp
c->edge->from.node = myself; c->edge->from.node = myself;
c->edge->from.tcpaddress = str2sockaddr(address, port); // c->edge->from.tcpaddress = str2sockaddr(address, port);
c->edge->from.udpaddress = str2sockaddr(address, myport); c->edge->from.udpaddress = str2sockaddr(myaddress, myport);
c->edge->to.node = n; c->edge->to.node = n;
c->edge->to.tcpaddress = c->address; // c->edge->to.tcpaddress = c->address;
sockaddr2str(&c->address, &hisaddress, &dummy); sockaddr2str(&c->address, &hisaddress, &dummy);
c->edge->to.udpaddress = str2sockaddr(hisaddress, hisport); c->edge->to.udpaddress = str2sockaddr(hisaddress, hisport);
free(hisaddress); free(hisaddress);

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.3 2002/03/21 23:11:53 guus Exp $ $Id: protocol_edge.c,v 1.1.4.4 2002/03/22 11:43:48 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -48,23 +48,23 @@
int send_add_edge(connection_t *c, edge_t *e) int send_add_edge(connection_t *c, edge_t *e)
{ {
int x; int x;
char *from_tcpaddress, *from_tcpport, *from_udpaddress, *from_udpport; char *from_udpaddress, *from_udpport;
char *to_tcpaddress, *to_tcpport, *to_udpaddress, *to_udpport; char *to_udpaddress, *to_udpport;
cp cp
sockaddr2str(&e->from.tcpaddress, &from_tcpaddress, &from_tcpport); // sockaddr2str(&e->from.tcpaddress, &from_tcpaddress, &from_tcpport);
sockaddr2str(&e->from.udpaddress, &from_udpaddress, &from_udpport); sockaddr2str(&e->from.udpaddress, &from_udpaddress, &from_udpport);
sockaddr2str(&e->to.tcpaddress, &to_tcpaddress, &to_tcpport); // sockaddr2str(&e->to.tcpaddress, &to_tcpaddress, &to_tcpport);
sockaddr2str(&e->to.udpaddress, &to_udpaddress, &to_udpport); sockaddr2str(&e->to.udpaddress, &to_udpaddress, &to_udpport);
x = send_request(c, "%d %lx %s %s %s %s %s %s %s %s %lx %d", ADD_EDGE, random(), x = send_request(c, "%d %lx %s %s %s %s %s %s %lx %d", ADD_EDGE, random(),
e->from.node->name, from_tcpaddress, from_tcpport, from_udpport, e->from.node->name, from_udpaddress, from_udpport,
e->to.node->name, to_tcpaddress, to_tcpport, to_udpport, e->to.node->name, to_udpaddress, to_udpport,
e->options, e->weight); e->options, e->weight);
free(from_tcpaddress); // free(from_tcpaddress);
free(from_tcpport); // free(from_tcpport);
free(from_udpaddress); free(from_udpaddress);
free(from_udpport); free(from_udpport);
free(to_tcpaddress); // free(to_tcpaddress);
free(to_tcpport); // free(to_tcpport);
free(to_udpaddress); free(to_udpaddress);
free(to_udpport); free(to_udpport);
cp cp
@ -79,20 +79,20 @@ int add_edge_h(connection_t *c)
char from_name[MAX_STRING_SIZE]; char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE]; char to_name[MAX_STRING_SIZE];
char from_address[MAX_STRING_SIZE]; char from_address[MAX_STRING_SIZE];
char from_tcpport[MAX_STRING_SIZE]; // char from_tcpport[MAX_STRING_SIZE];
char from_udpport[MAX_STRING_SIZE]; char from_udpport[MAX_STRING_SIZE];
char to_address[MAX_STRING_SIZE]; char to_address[MAX_STRING_SIZE];
char to_tcpport[MAX_STRING_SIZE]; // char to_tcpport[MAX_STRING_SIZE];
char to_udpport[MAX_STRING_SIZE]; char to_udpport[MAX_STRING_SIZE];
sockaddr_t from_tcpaddress, from_udpaddress; sockaddr_t from_udpaddress;
sockaddr_t to_tcpaddress, to_udpaddress; sockaddr_t to_udpaddress;
long int options; long int options;
int weight; int weight;
avl_node_t *node; avl_node_t *node;
cp cp
if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", if(sscanf(c->buffer, "%*d %*lx "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d",
from_name, from_address, from_tcpport, from_udpport, from_name, from_address, from_udpport,
to_name, to_address, to_tcpport, to_udpport, to_name, to_address, to_udpport,
&options, &weight) != 10) &options, &weight) != 10)
{ {
syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_EDGE", c->name, c->hostname); syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_EDGE", c->name, c->hostname);
@ -138,9 +138,9 @@ cp
/* Convert addresses */ /* Convert addresses */
from_tcpaddress = str2sockaddr(from_address, from_tcpport); // from_tcpaddress = str2sockaddr(from_address, from_tcpport);
from_udpaddress = str2sockaddr(from_address, from_udpport); from_udpaddress = str2sockaddr(from_address, from_udpport);
to_tcpaddress = str2sockaddr(to_address, to_tcpport); // to_tcpaddress = str2sockaddr(to_address, to_tcpport);
to_udpaddress = str2sockaddr(to_address, to_udpport); to_udpaddress = str2sockaddr(to_address, to_udpport);
/* Check if edge already exists */ /* Check if edge already exists */
@ -150,8 +150,8 @@ cp
if(e) if(e)
{ {
if(e->weight != weight || e->options != options if(e->weight != weight || e->options != options
|| ((e->from.node == from) && (sockaddrcmp(&e->from.tcpaddress, &from_tcpaddress) || sockaddrcmp(&e->from.udpaddress, &from_udpaddress) || sockaddrcmp(&e->to.tcpaddress, &to_tcpaddress) || sockaddrcmp(&e->to.udpaddress, &to_udpaddress))) || ((e->from.node == from) && (sockaddrcmp(&e->from.udpaddress, &from_udpaddress)|| sockaddrcmp(&e->to.udpaddress, &to_udpaddress)))
|| ((e->from.node == to) && (sockaddrcmp(&e->from.tcpaddress, &to_tcpaddress) || sockaddrcmp(&e->from.udpaddress, &to_udpaddress) || sockaddrcmp(&e->to.tcpaddress, &from_tcpaddress) || sockaddrcmp(&e->to.udpaddress, &from_udpaddress))) || ((e->from.node == to) && (sockaddrcmp(&e->from.udpaddress, &to_udpaddress) || sockaddrcmp(&e->to.udpaddress, &from_udpaddress)))
) )
{ {
if(from == myself || to == myself) if(from == myself || to == myself)
@ -185,10 +185,10 @@ cp
e = new_edge(); e = new_edge();
e->from.node = from; e->from.node = from;
e->from.tcpaddress = from_tcpaddress; // e->from.tcpaddress = from_tcpaddress;
e->from.udpaddress = from_udpaddress; e->from.udpaddress = from_udpaddress;
e->to.node = to; e->to.node = to;
e->to.tcpaddress = to_tcpaddress; // e->to.tcpaddress = to_tcpaddress;
e->to.udpaddress = to_udpaddress; e->to.udpaddress = to_udpaddress;
e->options = options; e->options = options;
e->weight = weight; e->weight = weight;