- Fixing-things pass: every source file compiles into an object file now,

but linking tincd does not work yet (must link with openssl libs and
  define some missing functions).
This commit is contained in:
Guus Sliepen 2000-10-11 22:01:02 +00:00
parent 6e39481d8f
commit 183a8edd22
15 changed files with 148 additions and 149 deletions

View file

@ -1,3 +1,5 @@
#include <sys/types.h>
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args

View file

@ -19,18 +19,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c,v 1.9.4.11 2000/10/11 13:42:52 guus Exp $
$Id: conf.c,v 1.9.4.12 2000/10/11 22:00:57 guus Exp $
*/
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <xalloc.h>
@ -38,6 +37,8 @@
#include "netutl.h" /* for strtoip */
#include <utils.h> /* for cp */
#include "config.h"
#include "system.h"
config_t *config;
@ -139,11 +140,11 @@ cp
*/
int read_config_file(config_t **base, const char *fname)
{
int err;
int err = -1;
FILE *fp;
char line[MAXBUFSIZE]; /* There really should not be any line longer than this... */
char *p, *q;
int i, err = -1, lineno = 0;
int i, lineno = 0;
config_t *cfg;
cp
if((fp = fopen (fname, "r")) == NULL)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.h,v 1.6.4.10 2000/10/11 13:42:52 guus Exp $
$Id: conf.h,v 1.6.4.11 2000/10/11 22:00:58 guus Exp $
*/
#ifndef __TINC_CONF_H__
@ -30,12 +30,6 @@ typedef struct ip_mask_t {
unsigned long mask;
} ip_mask_t;
typedef union data_t {
unsigned long val;
void *ptr;
ip_mask_t *ip;
} data_t;
typedef enum which_t {
tincname = 1,
connectto,
@ -46,7 +40,6 @@ typedef enum which_t {
resolve_dns,
interface,
interfaceip,
configuration
address,
port,
publickey,
@ -63,7 +56,12 @@ typedef struct config_t {
struct config_t *next;
which_t which;
int argtype;
data_t data;
union data {
unsigned long val;
void *ptr;
ip_mask_t *ip;
struct config_t *next; /* For nested configs! */
} data;
} config_t;
typedef struct internal_config_t {
@ -92,9 +90,9 @@ extern int sighup;
extern char *configfilename;
extern config_t *add_config_val(config_t **, int, char *);
extern int read_config_file(const char *);
extern const config_t *get_config_val(which_t type);
extern const config_t *get_next_config_val(which_t type, int);
extern int read_config_file(config_t **, const char *);
extern const config_t *get_config_val(config_t *, which_t type);
extern const config_t *get_next_config_val(config_t *, which_t type, int);
extern void clear_config();
#endif /* __TINC_CONF_H__ */

View file

@ -17,13 +17,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: connlist.c,v 1.1.2.1 2000/10/11 10:35:15 guus Exp $
$Id: connlist.c,v 1.1.2.2 2000/10/11 22:00:58 guus Exp $
*/
#include <syslog.h>
#include "config.h"
#include <utils.h>
#include "connlist.h"
#include "net.h" /* Don't ask. */
/* Root of the connection list */
@ -34,7 +36,7 @@ conn_list_t *myself = NULL;
conn_list_t *new_conn_list(void)
{
conn_list_t *p = xmalloc(sizeof(*p));
conn_list_t *p = (conn_list_t *)xmalloc(sizeof(*p));
cp
/* initialise all those stupid pointers at once */
memset(p, '\0', sizeof(*p));
@ -110,10 +112,10 @@ cp
void conn_list_add(conn_list_t *cl)
{
cp
cl->next = connlist;
cl->next = conn_list;
cl->prev = NULL;
cl->next->prev = cl;
connlist = cl;
conn_list = cl;
cp
}
@ -123,7 +125,7 @@ cp
if(cl->prev)
cl->prev->next = cl->next;
else
connlist = cl->next;
conn_list = cl->next;
cl->next->prev = cl->prev;
free_conn_list(cl);
@ -132,12 +134,23 @@ cp
/* Lookup functions */
conn_list_t *lookup_id(char *name)
{
conn_list_t *p;
cp
for(p = conn_list; p != NULL; p = p->next)
if(strcmp(name, p->name) == 0)
break;
cp
return p;
}
conn_list_t *lookup_conn_list_mac(mac_t address)
{
conn_list_t *p;
cp
for(p = conn_list; p != NULL; p = p->next)
if(lookup_subnet_mac(p, address))
if(lookup_subnet_mac(p->subnets, address))
break;
cp
return p;
@ -148,7 +161,7 @@ conn_list_t *lookup_conn_list_ipv4(ipv4_t address)
conn_list_t *p;
cp
for(p = conn_list; p != NULL; p = p->next)
if(lookup_subnet_ipv4(p, address))
if(lookup_subnet_ipv4(p->subnets, address))
break;
cp
return p;
@ -159,7 +172,7 @@ conn_list_t *lookup_conn_list_ipv6(ipv6_t address)
conn_list_t *p;
cp
for(p = conn_list; p != NULL; p = p->next)
if(lookup_subnet_ipv6(p, address))
if(lookup_subnet_ipv6(p->subnets, address))
break;
cp
return p;
@ -170,14 +183,24 @@ cp
void dump_conn_list(void)
{
conn_list_t *p;
subnet_t *s;
char *netstr;
cp
syslog(LOG_DEBUG, _("Connection list:"));
for(p = conn_list; p != NULL; p = p->next)
{
syslog(LOG_DEBUG, _("%s netmask %d.%d.%d.%d at %s port %hd flags %d sockets %d, %d status %04x"),
p->name, IP_ADDR_V(p->vpn_mask), p->hostname, p->port, p->flags,
syslog(LOG_DEBUG, _("%s at %s port %hd flags %d sockets %d, %d status %04x"),
p->name, p->hostname, p->port, p->flags,
p->socket, p->meta_socket, p->status);
for(s = p->subnets; s != NULL; s = s->next)
{
netstr = net2str(s);
syslog(LOG_DEBUG, ": %s", netstr);
free(netstr);
}
}
syslog(LOG_DEBUG, _("End of connection list."));
cp
}

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: connlist.h,v 1.1.2.1 2000/10/11 10:35:15 guus Exp $
$Id: connlist.h,v 1.1.2.2 2000/10/11 22:00:58 guus Exp $
*/
#ifndef __TINC_CONNLIST_H__
@ -26,11 +26,11 @@
#include <openssl/evp.h>
#include "net.h"
#include "subnet.h"
#include "conf.h"
typedef struct conn_list_t {
char *name; /* name of this connection */
ip_t real_ip; /* his real (internet) ip */
ipv4_t address; /* his real (internet) ip */
char *hostname; /* the hostname of its real ip */
short unsigned int port; /* his portnumber */
int protocol_version; /* used protocol */
@ -72,9 +72,14 @@ typedef struct conn_list_t {
struct subnet_t *subnets; /* Pointer to a list of subnets belonging to this connection */
struct config_t *config; /* Pointer to configuration tree belonging to this host */
struct conn_list_t *next; /* after all, it's a list of connections */
struct conn_list_t *prev; /* doubly linked for O(1) deletions */
} conn_list_t;
#include "subnet.h"
extern conn_list_t *conn_list;
extern conn_list_t *myself;
@ -82,6 +87,7 @@ extern conn_list_t *new_conn_list();
extern void free_conn_list(conn_list_t *);
extern void add_conn_list(conn_list_t *);
extern void del_conn_list(conn_list_t *);
extern conn_list_t *lookup_id(char *);
extern conn_list_t *lookup_conn_list_mac(mac_t);
extern conn_list_t *lookup_conn_list_ipv4(ipv4_t);
extern conn_list_t *lookup_conn_list_ipv6(ipv6_t);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: meta.c,v 1.1.2.2 2000/10/11 10:35:15 guus Exp $
$Id: meta.c,v 1.1.2.3 2000/10/11 22:00:58 guus Exp $
*/
#include "config.h"
@ -59,7 +59,7 @@ cp
return 0;
}
int broadcast_meta(conn_list_t *cl, const char *buffer, int length)
int broadcast_meta(conn_list_t *cl, char *buffer, int length)
{
conn_list_t *p;
cp

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.33 2000/10/11 10:35:16 guus Exp $
$Id: net.c,v 1.35.4.34 2000/10/11 22:00:58 guus Exp $
*/
#include "config.h"
@ -84,7 +84,7 @@ cp
p->data[0] = p->data[6] = 0xfe;
p->data[1] = p->data[7] = 0xfd;
/* Really evil pointer stuff just below! */
*((ip_t*)(&p->data[2])) = (ip_t)(htonl(myself->real_ip));
*((ip_t*)(&p->data[2])) = (ip_t)(htonl(myself->address));
*((ip_t*)(&p->data[8])) = *((ip_t*)(&p->data[26]));
cp
}
@ -274,7 +274,7 @@ int send_packet(ip_t to, vpn_packet_t *packet)
{
conn_list_t *cl;
cp
if((cl = lookup_conn(to)) == NULL)
if((cl = lookup_conn_list_ipv4(to)) == NULL)
{
if(debug_lvl > 3)
{
@ -286,50 +286,9 @@ cp
}
/* If we ourselves have indirectdata flag set, we should send only to our uplink! */
/* FIXME - check for indirection and reprogram it The Right Way(tm) this time. */
/* The next few lines will be obsoleted, if we are going indirect, matching subnet_t
should point to only our uplink as the recepient
*/
if(myself->flags & EXPORTINDIRECTDATA)
{
for(cl = conn_list; cl != NULL && !cl->status.outgoing; cl = cl->next);
if(!cl)
{ /* No open outgoing connection has been found. */
if(debug_lvl > 3)
syslog(LOG_NOTICE, _("There is no remote host I can send this packet to!"));
return -1;
}
}
else
/* If indirectdata flag is set for the destination we just looked up,
* then real_ip is actually the vpn_ip of the gateway tincd
* it is behind.
*/
if(cl->flags & INDIRECTDATA)
{
if(debug_lvl > 3)
syslog(LOG_NOTICE, _("Indirect packet to %s via %s"),
cl->name, cl->hostname);
if((cl = lookup_conn(cl->real_ip)) == NULL)
{
if(debug_lvl > 3)
syslog(LOG_NOTICE, _("Indirect look up %d.%d.%d.%d in connection list failed!"), IP_ADDR_V(to));
/* Gateway tincd dead? Should we kill it? (GS) */
return -1;
}
if(cl->flags & INDIRECTDATA) /* This should not happen */
{
if(debug_lvl > 3)
syslog(LOG_NOTICE, _("Double indirection for %d.%d.%d.%d"), IP_ADDR_V(to));
return -1;
}
}
if(my_key_expiry <= time(NULL))
regenerate_keys();
@ -375,7 +334,7 @@ int setup_tap_fd(void)
const char *tapfname;
config_t const *cfg;
cp
if((cfg = get_config_val(tapdevice)) == NULL)
if((cfg = get_config_val(config, tapdevice)) == NULL)
tapfname = "/dev/tap0";
else
tapfname = cfg->data.ptr;
@ -427,7 +386,7 @@ cp
return -1;
}
if((cfg = get_config_val(interface)))
if((cfg = get_config_val(config, interface)))
{
if(setsockopt(nfd, SOL_SOCKET, SO_KEEPALIVE, cfg->data.ptr, strlen(cfg->data.ptr)))
{
@ -440,7 +399,7 @@ cp
a.sin_family = AF_INET;
a.sin_port = htons(port);
if((cfg = get_config_val(interfaceip)))
if((cfg = get_config_val(config, interfaceip)))
a.sin_addr.s_addr = htonl(cfg->data.ip->ip);
else
a.sin_addr.s_addr = htonl(INADDR_ANY);
@ -515,7 +474,7 @@ cp
if(debug_lvl > 0)
syslog(LOG_INFO, _("Trying to connect to %s"), cl->hostname);
if((cfg = get_config_val(upstreamport)) == NULL)
if((cfg = get_config_val(cl->config, port)) == NULL)
cl->port = 655;
else
cl->port = cfg->data.val;
@ -530,7 +489,7 @@ cp
a.sin_family = AF_INET;
a.sin_port = htons(cl->port);
a.sin_addr.s_addr = htonl(cl->real_ip);
a.sin_addr.s_addr = htonl(cl->address);
if(connect(cl->meta_socket, (struct sockaddr *)&a, sizeof(a)) == -1)
{
@ -572,8 +531,8 @@ cp
}
ncn = new_conn_list();
ncn->real_ip = ntohl(*((ip_t*)(h->h_addr_list[0])));
ncn->hostname = hostlookup(htonl(ncn->real_ip));
ncn->address = ntohl(*((ip_t*)(h->h_addr_list[0])));
ncn->hostname = hostlookup(htonl(ncn->address));
if(setup_outgoing_meta_socket(ncn) < 0)
{
@ -603,7 +562,7 @@ cp
myself->hostname = "MYSELF"; /* FIXME? */
myself->flags = 0;
if(!(cfg = get_config_val(tincname))) /* Not acceptable */
if(!(cfg = get_config_val(config, tincname))) /* Not acceptable */
{
syslog(LOG_ERR, _("Name for tinc daemon required!"));
return -1;
@ -611,16 +570,16 @@ cp
else
myself->name = (char*)cfg->data.val;
if(!(cfg = get_config_val(listenport)))
if(!(cfg = get_config_val(myself, port)))
myself->port = 655;
else
myself->port = cfg->data.val;
if((cfg = get_config_val(indirectdata)))
if((cfg = get_config_val(config, indirectdata)))
if(cfg->data.val == stupid_true)
myself->flags |= EXPORTINDIRECTDATA;
if((cfg = get_config_val(tcponly)))
if((cfg = get_config_val(config, tcponly)))
if(cfg->data.val == stupid_true)
myself->flags |= TCPONLY;
@ -649,8 +608,9 @@ sigalrm_handler(int a)
{
config_t const *cfg;
cp
cfg = get_next_config_val(upstreamip, upstreamindex++);
/* FIXME! Use name instead of upstreamip.
cfg = get_next_config_val(config, upstreamip, upstreamindex++);
*/
while(cfg)
{
if(!setup_outgoing_connection(cfg->data.ptr)) /* function returns 0 when there are no problems */
@ -658,7 +618,7 @@ cp
signal(SIGALRM, SIG_IGN);
return;
}
cfg = get_next_config_val(upstreamip, upstreamindex++); /* Or else we try the next ConnectTo line */
// cfg = get_next_config_val(config, upstreamip, upstreamindex++); /* Or else we try the next ConnectTo line */
}
signal(SIGALRM, sigalrm_handler);
@ -679,7 +639,7 @@ int setup_network_connections(void)
{
config_t const *cfg;
cp
if((cfg = get_config_val(pingtimeout)) == NULL)
if((cfg = get_config_val(config, pingtimeout)) == NULL)
timeout = 5;
else
timeout = cfg->data.val;
@ -690,7 +650,7 @@ cp
if(setup_myself() < 0)
return -1;
if((cfg = get_next_config_val(upstreamip, upstreamindex++)) == NULL)
// if((cfg = get_next_config_val(config, upstreamip, upstreamindex++)) == NULL)
/* No upstream IP given, we're listen only. */
return 0;
@ -698,7 +658,7 @@ cp
{
if(!setup_outgoing_connection(cfg->data.ptr)) /* function returns 0 when there are no problems */
return 0;
cfg = get_next_config_val(upstreamip, upstreamindex++); /* Or else we try the next ConnectTo line */
// cfg = get_next_config_val(config, upstreamip, upstreamindex++); /* Or else we try the next ConnectTo line */
}
signal(SIGALRM, sigalrm_handler);
@ -767,7 +727,7 @@ cp
a.sin_family = AF_INET;
a.sin_port = htons(cl->port);
a.sin_addr.s_addr = htonl(cl->real_ip);
a.sin_addr.s_addr = htonl(cl->address);
if(connect(nfd, (struct sockaddr *)&a, sizeof(a)) == -1)
{
@ -808,7 +768,7 @@ cp
return NULL;
}
p->real_ip = ntohl(ci.sin_addr.s_addr);
p->address = ntohl(ci.sin_addr.s_addr);
p->hostname = hostlookup(ci.sin_addr.s_addr);
p->meta_socket = sfd;
p->status.meta = 1;
@ -1150,7 +1110,7 @@ cp
syslog(LOG_INFO, _("Rereading configuration file"));
close_network_connections();
clear_config();
if(read_config_file(configfilename))
if(read_config_file(&config, configfilename))
{
syslog(LOG_ERR, _("Unable to reread configuration file, exiting"));
exit(0);

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.h,v 1.9.4.14 2000/10/11 10:35:16 guus Exp $
$Id: net.h,v 1.9.4.15 2000/10/11 22:01:00 guus Exp $
*/
#ifndef __TINC_NET_H__
@ -26,7 +26,6 @@
#include "config.h"
#include "conf.h"
#include "connlist.h"
#define MAXSIZE 1700 /* should be a bit more than the MTU for the tapdevice */
#define MTU 1600
@ -129,6 +128,8 @@ extern int total_socket_out;
extern char *request_name[256];
extern char *status_text[10];
#include "connlist.h" /* Yes, very strange placement indeed, but otherwise the typedefs get all tangled up */
extern int str2opt(const char *);
extern char *opt2str(int);
extern int send_packet(ip_t, vpn_packet_t *);
@ -137,7 +138,7 @@ extern void close_network_connections(void);
extern void main_loop(void);
extern int setup_vpn_connection(conn_list_t *);
extern void terminate_connection(conn_list_t *);
extern void flush_queues(conn_list_t*);
extern void flush_queues(conn_list_t *);
extern int xrecv(vpn_packet_t *);
extern void add_queue(packet_queue_t **, void *, size_t);

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: netutl.c,v 1.12.4.11 2000/10/11 10:35:17 guus Exp $
$Id: netutl.c,v 1.12.4.12 2000/10/11 22:01:00 guus Exp $
*/
#include "config.h"
@ -73,7 +73,7 @@ cp
in.s_addr = addr;
lookup_hostname = 0;
if((cfg = get_config_val(resolve_dns)) != NULL)
if((cfg = get_config_val(config, resolve_dns)) != NULL)
if(cfg->data.val == stupid_true)
lookup_hostname = 1;

View file

@ -16,13 +16,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: netutl.h,v 1.2.4.2 2000/10/11 10:35:17 guus Exp $
$Id: netutl.h,v 1.2.4.3 2000/10/11 22:01:00 guus Exp $
*/
#ifndef __TINC_NETUTL_H__
#define __TINC_NETUTL_H__
#include "net.h"
#include "conf.h"
extern char *hostlookup(unsigned long);
extern ip_mask_t *strtoip(char*);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.c,v 1.28.4.37 2000/10/11 13:42:52 guus Exp $
$Id: protocol.c,v 1.28.4.38 2000/10/11 22:01:00 guus Exp $
*/
#include "config.h"
@ -87,7 +87,7 @@ cp
if(debug_lvl >= DEBUG_PROTOCOL)
syslog(LOG_DEBUG, _("Sending %s to %s (%s)"), request_name[request], cl->name, cl->hostname);
cp
return send_meta(cl, buffer, length);
return send_meta(cl, buffer, len);
}
int receive_request(conn_list_t *cl)
@ -235,7 +235,7 @@ cp
/* Convert the random data to a hexadecimal formatted string */
bin2hex(cl->hischallenge,buffer,CHAL_LENGTH);
buffer[keylength*2] = '\0';
buffer[CHAL_LENGTH*2] = '\0';
/* Send the challenge */
@ -450,7 +450,7 @@ cp
/* Check if subnet string is valid */
if((subnet = str2net(subnetstr)) == -1)
if(!(subnet = str2net(subnetstr)))
{
syslog(LOG_ERR, _("Got bad ADD_SUBNET from %s (%s): invalid subnet string"), cl->name, cl->hostname);
free(name); free(subnetstr);
@ -472,7 +472,7 @@ cp
/* Check if the owner of the new subnet is in the connection list */
if(!(owner = lookup_id(name))
if(!(owner = lookup_id(name)))
{
syslog(LOG_ERR, _("Got ADD_SUBNET for %s from %s (%s) which is not in our connection list"),
name, cl->name, cl->hostname);
@ -481,8 +481,10 @@ cp
}
/* If everything is correct, add the subnet to the list of the owner */
subnet_add(owner, subnet);
cp
return subnet_add(owner, subnet);
return 0;
}
int send_del_subnet(conn_list_t *cl, conn_list_t *other, subnet_t *subnet)
@ -516,7 +518,7 @@ cp
/* Check if subnet string is valid */
if((subnet = str2net(subnetstr)) == -1)
if(!(subnet = str2net(subnetstr)))
{
syslog(LOG_ERR, _("Got bad DEL_SUBNET from %s (%s): invalid subnet string"), cl->name, cl->hostname);
free(name); free(subnetstr);
@ -538,7 +540,7 @@ cp
/* Check if the owner of the new subnet is in the connection list */
if(!(owner = lookup_id(name))
if(!(owner = lookup_id(name)))
{
syslog(LOG_ERR, _("Got DEL_SUBNET for %s from %s (%s) which is not in our connection list"),
name, cl->name, cl->hostname);
@ -546,9 +548,11 @@ cp
return -1;
}
/* If everything is correct, add the subnet to the list of the owner */
/* If everything is correct, delete the subnet from the list of the owner */
subnet_del(subnet);
cp
return subnet_del(owner, subnet);
return 0;
}
/* New and closed connections notification */
@ -557,7 +561,7 @@ int send_add_host(conn_list_t *cl, conn_list_t *other)
{
cp
return send_request(cl, "%d %s %s %lx:%d %lx", ADD_HOST,
myself->name, other->name, other->real_ip, other->port, other->options);
myself->name, other->name, other->address, other->port, other->options);
}
int add_host_h(conn_list_t *cl)
@ -604,7 +608,7 @@ cp
/* Lookup his uplink */
if(!(new->hisuplink = lookup_id(sender))
if(!(new->hisuplink = lookup_id(sender)))
{
syslog(LOG_ERR, _("Got ADD_HOST from %s (%s) with origin %s which is not in our connection list"),
sender, cl->name, cl->hostname);
@ -616,13 +620,13 @@ cp
/* Fill in more of the new conn_list structure */
new->hostname = hostlookup(htonl(new->real_ip));
new->hostname = hostlookup(htonl(new->address));
/* Check if the new host already exists in the connnection list */
if((old = lookup_id(new->name)))
{
if((new->real_ip == old->real_ip) && (new->port == old->port))
if((new->address == old->address) && (new->port == old->port))
{
if(debug_lvl > DEBUG_CONNECTIONS)
syslog(LOG_NOTICE, _("Got duplicate ADD_HOST for %s (%s) from %s (%s)"),
@ -660,7 +664,7 @@ int send_del_host(conn_list_t *cl, conn_list_t *other)
{
cp
return send_request(cl, "%d %s %s %lx:%d %lx", DEL_HOST,
myself->name, other->name, other->real_ip, other->port, other->options);
myself->name, other->name, other->address, other->port, other->options);
}
int del_host_h(conn_list_t *cl)
@ -712,7 +716,7 @@ cp
/* Lookup his uplink */
if(!(hisuplink = lookup_id(sender))
if(!(hisuplink = lookup_id(sender)))
{
syslog(LOG_ERR, _("Got DEL_HOST from %s (%s) with origin %s which is not in our connection list"),
cl->name, cl->hostname, sender);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.h,v 1.5.4.9 2000/10/11 10:35:17 guus Exp $
$Id: protocol.h,v 1.5.4.10 2000/10/11 22:01:02 guus Exp $
*/
#ifndef __TINC_PROTOCOL_H__
@ -56,7 +56,7 @@ extern int (*request_handlers[])(conn_list_t*);
extern int send_id(conn_list_t*);
extern int send_challenge(conn_list_t*);
extern int send_chal_reply(conn_list_t*, char*);
extern int send_chal_reply(conn_list_t*);
extern int send_ack(conn_list_t*);
extern int send_status(conn_list_t*, int, char*);
extern int send_error(conn_list_t*, int, char*);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: subnet.c,v 1.1.2.2 2000/10/11 10:35:17 guus Exp $
$Id: subnet.c,v 1.1.2.3 2000/10/11 22:01:02 guus Exp $
*/
#include "config.h"
@ -55,7 +55,7 @@ cp
cp
}
void subnet_del(conn_list_t *cl, subnet_t *subnet)
void subnet_del(subnet_t *subnet)
{
cp
if(subnet->prev)
@ -87,27 +87,27 @@ cp
switch(type)
{
case SUBNET_MAC:
if(sscanf(netstr, "%d,%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &subnet->type,
&subnet->net.mac.x[0],
&subnet->net.mac.x[1],
&subnet->net.mac.x[2],
&subnet->net.mac.x[3],
&subnet->net.mac.x[4],
&subnet->net.mac.x[5]) != 7)
if(sscanf(subnetstr, "%d,%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &subnet->type,
&subnet->net.mac.address.x[0],
&subnet->net.mac.address.x[1],
&subnet->net.mac.address.x[2],
&subnet->net.mac.address.x[3],
&subnet->net.mac.address.x[4],
&subnet->net.mac.address.x[5]) != 7)
{
free_subnet(subnet);
return NULL;
}
break;
case SUBNET_IPv4:
case SUBNET_IPV4:
if(sscanf(subnetstr, "%d,%lx:%lx", &subnet->type, &subnet->net.ipv4.address, &subnet->net.ipv4.mask) != 3)
{
free_subnet(subnet);
return NULL;
}
break;
case SUBNET_IPv6:
if(sscanf(netstr, "%d,%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx", &subnet->type,
case SUBNET_IPV6:
if(sscanf(subnetstr, "%d,%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx", &subnet->type,
&subnet->net.ipv6.address.x[0],
&subnet->net.ipv6.address.x[1],
&subnet->net.ipv6.address.x[2],
@ -133,6 +133,7 @@ cp
default:
free_subnet(subnet);
return NULL;
}
cp
return subnet;
}
@ -145,15 +146,15 @@ cp
{
case SUBNET_MAC:
asprintf(netstr, "%d,%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", subnet->type,
subnet->net.mac.x[0],
subnet->net.mac.x[1],
subnet->net.mac.x[2],
subnet->net.mac.x[3],
subnet->net.mac.x[4],
subnet->net.mac.x[5]);
case SUBNET_IPv4:
subnet->net.mac.address.x[0],
subnet->net.mac.address.x[1],
subnet->net.mac.address.x[2],
subnet->net.mac.address.x[3],
subnet->net.mac.address.x[4],
subnet->net.mac.address.x[5]);
case SUBNET_IPV4:
asprintf(netstr, "%d,%lx:%lx", subnet->type, subnet->net.ipv4.address, subnet->net.ipv4.mask);
case SUBNET_IPv6:
case SUBNET_IPV6:
asprintf(netstr, "%d,%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx/%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx",
subnet->net.ipv6.address.x[0],
subnet->net.ipv6.address.x[1],
@ -211,6 +212,7 @@ cp
subnet_t *lookup_subnet_ipv6(subnet_t *subnets, ipv6_t address)
{
subnet_t *subnet;
int i;
cp
for(subnet = subnets; subnet != NULL; subnet = subnet->next)
{

View file

@ -17,14 +17,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: subnet.h,v 1.1.2.2 2000/10/11 10:35:17 guus Exp $
$Id: subnet.h,v 1.1.2.3 2000/10/11 22:01:02 guus Exp $
*/
#ifndef __TINC_SUBNET_H__
#define __TINC_SUBNET_H__
#include "net.h"
#include "connlist.h"
enum
{
@ -61,7 +60,7 @@ typedef struct subnet_t {
/* And now for the actual subnet: */
union
union net
{
subnet_mac_t mac;
subnet_ipv4_t ipv4;
@ -70,9 +69,11 @@ typedef struct subnet_t {
} subnet_t;
#include "connlist.h"
extern subnet_t *new_subnet(void);
extern void free_subnet(subnet_t *);
extern void subnet_add(conn_list_t *, subnet_t *);
extern void subnet_add(struct conn_list_t *, subnet_t *);
extern void subnet_del(subnet_t *);
extern char *net2str(subnet_t *);
extern subnet_t *str2net(char *);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: tincd.c,v 1.10.4.9 2000/09/06 11:49:05 guus Exp $
$Id: tincd.c,v 1.10.4.10 2000/10/11 22:01:02 guus Exp $
*/
#include "config.h"
@ -359,7 +359,7 @@ main(int argc, char **argv, char **envp)
if(kill_tincd)
exit(kill_other());
if(read_config_file(configfilename))
if(read_config_file(&config, configfilename))
return 1;
setup_signals();