Import Upstream version 1.0.4

This commit is contained in:
Guus Sliepen 2019-08-26 13:44:36 +02:00
parent c12028eeaa
commit 392ff555ea
83 changed files with 2580 additions and 2300 deletions

View file

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.8.5 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -39,6 +39,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
sbin_PROGRAMS = tincd$(EXEEXT)
subdir = src
@ -76,21 +77,6 @@ tincd_OBJECTS = $(am_tincd_OBJECTS) $(nodist_tincd_OBJECTS)
tincd_DEPENDENCIES = $(top_builddir)/lib/libvpn.a
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/conf.Po ./$(DEPDIR)/connection.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/device.Po ./$(DEPDIR)/edge.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/event.Po ./$(DEPDIR)/graph.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/logger.Po ./$(DEPDIR)/meta.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/net.Po ./$(DEPDIR)/net_packet.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/net_setup.Po ./$(DEPDIR)/net_socket.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/netutl.Po ./$(DEPDIR)/node.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/process.Po ./$(DEPDIR)/protocol.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/protocol_auth.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/protocol_edge.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/protocol_key.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/protocol_misc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/protocol_subnet.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/route.Po ./$(DEPDIR)/subnet.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tincd.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@ -172,6 +158,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@ -310,16 +298,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
@ -428,7 +414,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -483,7 +469,7 @@ ps-am:
uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
clean-sbinPROGRAMS ctags dist-hook distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \

View file

@ -1,7 +1,7 @@
/*
device.c -- Interaction BSD tun/tap device
Copyright (C) 2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2005 Guus Sliepen <guus@tinc-vpn.org>
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

View file

@ -1,8 +1,8 @@
/*
conf.c -- configuration code
Copyright (C) 1998 Robert van der Meulen
1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
2000 Cris van Pelt <tribbel@arise.dhs.org>
This program is free software; you can redistribute it and/or modify
@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c 1374 2004-03-21 14:21:22Z guus $
$Id: conf.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -99,7 +99,7 @@ void config_add(avl_tree_t *config_tree, config_t *cfg)
avl_insert(config_tree, cfg);
}
config_t *lookup_config(const avl_tree_t *config_tree, char *variable)
config_t *lookup_config(avl_tree_t *config_tree, char *variable)
{
config_t cfg, *found;
@ -120,7 +120,7 @@ config_t *lookup_config(const avl_tree_t *config_tree, char *variable)
return found;
}
config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg)
config_t *lookup_config_next(avl_tree_t *config_tree, const config_t *cfg)
{
avl_node_t *node;
config_t *found;

View file

@ -1,7 +1,7 @@
/*
conf.h -- header for conf.c
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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 1374 2004-03-21 14:21:22Z guus $
$Id: conf.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_CONF_H__
@ -47,8 +47,8 @@ extern void exit_configuration(avl_tree_t **);
extern config_t *new_config(void) __attribute__ ((__malloc__));
extern void free_config(config_t *);
extern void config_add(avl_tree_t *, config_t *);
extern config_t *lookup_config(const avl_tree_t *, char *);
extern config_t *lookup_config_next(const avl_tree_t *, const config_t *);
extern config_t *lookup_config(avl_tree_t *, char *);
extern config_t *lookup_config_next(avl_tree_t *, const config_t *);
extern bool get_config_bool(const config_t *, bool *);
extern bool get_config_int(const config_t *, int *);
extern bool get_config_string(const config_t *, char **);

View file

@ -1,7 +1,7 @@
/*
connection.c -- connection list management
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: connection.c 1374 2004-03-21 14:21:22Z guus $
$Id: connection.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -44,7 +44,7 @@ void init_connections(void)
{
cp();
connection_tree = avl_alloc_tree((avl_compare_t) connection_compare, NULL);
connection_tree = avl_alloc_tree((avl_compare_t) connection_compare, (avl_action_t) free_connection);
broadcast = new_connection();
broadcast->name = xstrdup(_("everyone"));
broadcast->hostname = xstrdup(_("BROADCAST"));

View file

@ -1,7 +1,7 @@
/*
connection.h -- header for connection.c
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: connection.h 1374 2004-03-21 14:21:22Z guus $
$Id: connection.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_CONNECTION_H__

View file

@ -1,7 +1,7 @@
/*
device.c -- Interaction with Windows tap driver in a Cygwin environment
Copyright (C) 2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.c 1400 2004-11-01 17:02:19Z guus $
$Id: device.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
net.h -- generic header for device.c
Copyright (C) 2001-2004 Ivo Timmermans <zarq@iname.com>
2001-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2001-2005 Ivo Timmermans <zarq@iname.com>
2001-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.h 1374 2004-03-21 14:21:22Z guus $
$Id: device.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_DEVICE_H__

View file

@ -1,7 +1,7 @@
/*
edge.c -- edge tree management
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: edge.c 1374 2004-03-21 14:21:22Z guus $
$Id: edge.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
edge.h -- header for edge.c
Copyright (C) 2001-2004 Guus Sliepen <guus@tinc-vpn.org>,
2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2001-2005 Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: edge.h 1374 2004-03-21 14:21:22Z guus $
$Id: edge.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_EDGE_H__

View file

@ -1,7 +1,7 @@
/*
event.c -- event queue
Copyright (C) 2002-2004 Guus Sliepen <guus@tinc-vpn.org>,
2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2002-2005 Guus Sliepen <guus@tinc-vpn.org>,
2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: event.c 1374 2004-03-21 14:21:22Z guus $
$Id: event.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
event.h -- header for event.c
Copyright (C) 2002-2004 Guus Sliepen <guus@tinc-vpn.org>,
2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2002-2005 Guus Sliepen <guus@tinc-vpn.org>,
2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: event.h 1374 2004-03-21 14:21:22Z guus $
$Id: event.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_EVENT_H__

View file

@ -1,7 +1,7 @@
/*
graph.c -- graph algorithms
Copyright (C) 2001-2004 Guus Sliepen <guus@tinc-vpn.org>,
2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2001-2005 Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: graph.c 1374 2004-03-21 14:21:22Z guus $
$Id: graph.c 1439 2005-05-04 18:09:30Z guus $
*/
/* We need to generate two trees from the graph:
@ -54,6 +54,7 @@
#include "netutl.h"
#include "node.h"
#include "process.h"
#include "subnet.h"
#include "utils.h"
/* Implementation of Kruskal's algorithm.
@ -141,10 +142,11 @@ void mst_kruskal(void)
void sssp_bfs(void)
{
avl_node_t *node, *from, *next, *to;
avl_node_t *node, *next, *to;
edge_t *e;
node_t *n;
avl_tree_t *todo_tree;
list_t *todo_list;
list_node_t *from, *todonext;
bool indirect;
char *name;
char *address, *port;
@ -153,7 +155,7 @@ void sssp_bfs(void)
cp();
todo_tree = avl_alloc_tree(NULL, NULL);
todo_list = list_alloc(NULL);
/* Clear visited status on nodes */
@ -169,86 +171,82 @@ void sssp_bfs(void)
myself->status.indirect = false;
myself->nexthop = myself;
myself->via = myself;
node = avl_alloc_node();
node->data = myself;
avl_insert_top(todo_tree, node);
list_insert_head(todo_list, myself);
/* Loop while todo_tree is filled */
/* Loop while todo_list is filled */
while(todo_tree->head) {
for(from = todo_tree->head; from; from = next) { /* "from" is the node from which we start */
next = from->next;
n = from->data;
for(from = todo_list->head; from; from = todonext) { /* "from" is the node from which we start */
n = from->data;
for(to = n->edge_tree->head; to; to = to->next) { /* "to" is the edge connected to "from" */
e = to->data;
for(to = n->edge_tree->head; to; to = to->next) { /* "to" is the edge connected to "from" */
e = to->data;
if(!e->reverse)
continue;
if(!e->reverse)
continue;
/* Situation:
/* Situation:
/
/
----->(n)---e-->(e->to)
\
\
/
/
----->(n)---e-->(e->to)
\
\
Where e is an edge, (n) and (e->to) are nodes.
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:
Where e is an edge, (n) and (e->to) are nodes.
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:
- 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 and (re)add it to the todo_tree to (re)examine the reachability
of nodes behind it.
*/
- 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 and (re)add it to the todo_list to (re)examine the reachability
of nodes behind it.
*/
indirect = n->status.indirect || e->options & OPTION_INDIRECT
|| ((n != myself) && sockaddrcmp(&n->address, &e->reverse->address));
indirect = n->status.indirect || e->options & OPTION_INDIRECT
|| ((n != myself) && sockaddrcmp(&n->address, &e->reverse->address));
if(e->to->status.visited
&& (!e->to->status.indirect || indirect))
continue;
if(e->to->status.visited
&& (!e->to->status.indirect || indirect))
continue;
e->to->status.visited = true;
e->to->status.indirect = indirect;
e->to->nexthop = (n->nexthop == myself) ? e->to : n->nexthop;
e->to->via = indirect ? n->via : e->to;
e->to->options = e->options;
e->to->status.visited = true;
e->to->status.indirect = indirect;
e->to->nexthop = (n->nexthop == myself) ? e->to : n->nexthop;
e->to->via = indirect ? n->via : e->to;
e->to->options = e->options;
if(sockaddrcmp(&e->to->address, &e->address)) {
node = avl_unlink(node_udp_tree, e->to);
sockaddrfree(&e->to->address);
sockaddrcpy(&e->to->address, &e->address);
if(sockaddrcmp(&e->to->address, &e->address)) {
node = avl_unlink(node_udp_tree, e->to);
sockaddrfree(&e->to->address);
sockaddrcpy(&e->to->address, &e->address);
if(e->to->hostname)
free(e->to->hostname);
if(e->to->hostname)
free(e->to->hostname);
e->to->hostname = sockaddr2hostname(&e->to->address);
e->to->hostname = sockaddr2hostname(&e->to->address);
if(node)
avl_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);
}
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);
}
node = avl_alloc_node();
node->data = e->to;
avl_insert_before(todo_tree, from, node);
}
avl_delete_node(todo_tree, from);
list_insert_tail(todo_list, e->to);
}
todonext = from->next;
list_delete_node(todo_list, from);
}
avl_free_tree(todo_tree);
list_free(todo_list);
/* Check reachability status. */
@ -262,9 +260,11 @@ void sssp_bfs(void)
if(n->status.reachable) {
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became reachable"),
n->name, n->hostname);
avl_insert(node_udp_tree, n);
} else {
ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became unreachable"),
n->name, n->hostname);
avl_delete(node_udp_tree, n);
}
n->status.validkey = false;
@ -292,8 +292,10 @@ void sssp_bfs(void)
free(address);
free(port);
for(i = 0; i < 7; i++)
for(i = 0; i < 6; i++)
free(envp[i]);
subnet_update(n, NULL, n->status.reachable);
}
}
}

View file

@ -1,7 +1,7 @@
/*
graph.h -- header for graph.c
Copyright (C) 2001-2004 Guus Sliepen <guus@tinc-vpn.org>,
2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2001-2005 Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: graph.h 1374 2004-03-21 14:21:22Z guus $
$Id: graph.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_GRAPH_H__

View file

@ -1,7 +1,7 @@
/*
device.c -- Interaction with Linux ethertap and tun/tap device
Copyright (C) 2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.c 1400 2004-11-01 17:02:19Z guus $
$Id: device.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
logger.c -- logging code
Copyright (C) 2004 Guus Sliepen <guus@tinc-vpn.org>
2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2004-2005 Guus Sliepen <guus@tinc-vpn.org>
2004-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: logger.c 1374 2004-03-21 14:21:22Z guus $
$Id: logger.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
meta.c -- handle the meta communication
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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 1391 2004-09-20 20:56:14Z guus $
$Id: meta.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
meta.h -- header for meta.c
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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.h 1374 2004-03-21 14:21:22Z guus $
$Id: meta.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_META_H__

View file

@ -1,7 +1,7 @@
/*
device.c -- Interaction with Windows tap driver in a MinGW environment
Copyright (C) 2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.c 1400 2004-11-01 17:02:19Z guus $
$Id: device.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
net.c -- most of the network code
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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 1387 2004-06-21 14:37:52Z guus $
$Id: net.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
net.h -- header for net.c
Copyright (C) 1998-2004 Ivo Timmermans <zarq@iname.com>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <zarq@iname.com>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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.h 1413 2004-11-10 21:56:31Z guus $
$Id: net.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_NET_H__

View file

@ -1,7 +1,7 @@
/*
net_packet.c -- Handles in- and outgoing VPN packets
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_packet.c 1407 2004-11-09 09:51:35Z guus $
$Id: net_packet.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -457,6 +457,12 @@ void broadcast_packet(const node_t *from, vpn_packet_t *packet)
ifdebug(TRAFFIC) logger(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"),
packet->len, from->name, from->hostname);
if(from != myself) {
if(overwrite_mac)
memcpy(packet->data, mymac.x, ETH_ALEN);
write_packet(packet);
}
for(node = connection_tree->head; node; node = node->next) {
c = node->data;

View file

@ -1,7 +1,7 @@
/*
net_setup.c -- Setup.
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_setup.c 1413 2004-11-10 21:56:31Z guus $
$Id: net_setup.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -462,6 +462,10 @@ bool setup_myself(void)
for(i = 0; i < 5; i++)
free(envp[i]);
/* Run subnet-up scripts for our own subnets */
subnet_update(myself, NULL, true);
/* Open sockets */
get_config_string(lookup_config(config_tree, "BindToAddress"), &address);
@ -568,8 +572,10 @@ void close_network_connections(void)
terminate_connection(c, false);
}
if(myself && myself->connection)
if(myself && myself->connection) {
subnet_update(myself, NULL, false);
terminate_connection(myself->connection, false);
}
for(i = 0; i < listen_sockets; i++) {
close(listen_socket[i].tcp);

View file

@ -1,7 +1,7 @@
/*
net_socket.c -- Handle various kinds of sockets.
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_socket.c 1413 2004-11-10 21:56:31Z guus $
$Id: net_socket.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -424,6 +424,7 @@ bool handle_new_meta_connection(int sock)
sockaddrunmap(&sa);
c = new_connection();
c->name = NULL;
c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest;
c->outmaclength = myself->connection->outmaclength;
@ -462,8 +463,7 @@ void try_outgoing_connections(void)
cp();
for(cfg = lookup_config(config_tree, "ConnectTo"); cfg;
cfg = lookup_config_next(config_tree, cfg)) {
for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
get_config_string(cfg, &name);
if(!check_id(name)) {

View file

@ -1,7 +1,7 @@
/*
netutl.c -- some supporting network utility code
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: netutl.c 1374 2004-03-21 14:21:22Z guus $
$Id: netutl.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
netutl.h -- header file for netutl.c
Copyright (C) 1998-2004 Ivo Timmermans <zarq@iname.com>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <zarq@iname.com>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: netutl.h 1374 2004-03-21 14:21:22Z guus $
$Id: netutl.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_NETUTL_H__

View file

@ -1,7 +1,7 @@
/*
node.c -- node tree management
Copyright (C) 2001-2004 Guus Sliepen <guus@tinc-vpn.org>,
2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2001-2005 Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: node.c 1374 2004-03-21 14:21:22Z guus $
$Id: node.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -123,7 +123,6 @@ void node_add(node_t *n)
cp();
avl_insert(node_tree, n);
avl_insert(node_udp_tree, n);
}
void node_del(node_t *n)
@ -147,7 +146,6 @@ void node_del(node_t *n)
}
avl_delete(node_tree, n);
avl_delete(node_udp_tree, n);
}
node_t *lookup_node(char *name)

View file

@ -1,7 +1,7 @@
/*
node.h -- header for node.c
Copyright (C) 2001-2004 Guus Sliepen <guus@tinc-vpn.org>,
2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2001-2005 Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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: node.h 1374 2004-03-21 14:21:22Z guus $
$Id: node.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_NODE_H__

View file

@ -1,7 +1,7 @@
/*
process.c -- process management functions
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: process.c 1397 2004-11-01 15:18:22Z guus $
$Id: process.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -81,25 +81,25 @@ bool install_service(void) {
}
if(!strchr(program_name, '\\')) {
GetCurrentDirectory(sizeof(command) - 1, command + 1);
strncat(command, "\\", sizeof(command));
GetCurrentDirectory(sizeof command - 1, command + 1);
strncat(command, "\\", sizeof command - strlen(command));
}
strncat(command, program_name, sizeof(command));
strncat(command, program_name, sizeof command - strlen(command));
strncat(command, "\"", sizeof(command));
strncat(command, "\"", sizeof command - strlen(command));
for(argp = g_argv + 1; *argp; argp++) {
space = strchr(*argp, ' ');
strncat(command, " ", sizeof(command));
strncat(command, " ", sizeof command - strlen(command));
if(space)
strncat(command, "\"", sizeof(command));
strncat(command, "\"", sizeof command - strlen(command));
strncat(command, *argp, sizeof(command));
strncat(command, *argp, sizeof command - strlen(command));
if(space)
strncat(command, "\"", sizeof(command));
strncat(command, "\"", sizeof command - strlen(command));
}
service = CreateService(manager, identname, identname,

View file

@ -1,7 +1,7 @@
/*
process.h -- header file for process.c
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: process.h 1374 2004-03-21 14:21:22Z guus $
$Id: process.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_PROCESS_H__

View file

@ -1,7 +1,7 @@
/*
protocol.c -- handle the meta-protocol, basic functions
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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 1374 2004-03-21 14:21:22Z guus $
$Id: protocol.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
protocol.h -- header for protocol.c
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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 1374 2004-03-21 14:21:22Z guus $
$Id: protocol.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_PROTOCOL_H__

View file

@ -1,7 +1,7 @@
/*
protocol_auth.c -- handle the meta-protocol, authentication
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_auth.c 1374 2004-03-21 14:21:22Z guus $
$Id: protocol_auth.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -76,8 +76,11 @@ bool id_h(connection_t *c)
c->name);
return false;
}
} else
} else {
if(c->name)
free(c->name);
c->name = xstrdup(name);
}
/* Check if version matches */

View file

@ -1,7 +1,7 @@
/*
protocol_edge.c -- handle the meta-protocol, edges
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_edge.c 1374 2004-03-21 14:21:22Z guus $
$Id: protocol_edge.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
protocol_key.c -- handle the meta-protocol, key exchange
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_key.c 1374 2004-03-21 14:21:22Z guus $
$Id: protocol_key.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
protocol_misc.c -- handle the meta-protocol, miscellaneous functions
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_misc.c 1374 2004-03-21 14:21:22Z guus $
$Id: protocol_misc.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
protocol_subnet.c -- handle the meta-protocol, subnets
Copyright (C) 1999-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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_subnet.c 1374 2004-03-21 14:21:22Z guus $
$Id: protocol_subnet.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -134,6 +134,9 @@ bool add_subnet_h(connection_t *c)
*(new = new_subnet()) = s;
subnet_add(owner, new);
if(owner->status.reachable)
subnet_update(owner, new, true);
/* Tell the rest */
if(!tunnelserver)
@ -229,6 +232,9 @@ bool del_subnet_h(connection_t *c)
/* Finally, delete it. */
if(owner->status.reachable)
subnet_update(owner, find, false);
subnet_del(owner, find);
return true;

View file

@ -1,7 +1,7 @@
/*
device.c -- raw socket
Copyright (C) 2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.c 1405 2004-11-08 22:11:33Z guus $
$Id: device.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
route.c -- routing
Copyright (C) 2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: route.c 1411 2004-11-10 19:36:02Z guus $
$Id: route.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"

View file

@ -1,7 +1,7 @@
/*
route.h -- header file for route.c
Copyright (C) 2000-2004 Ivo Timmermans <zarq@iname.com>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2000-2005 Ivo Timmermans <zarq@iname.com>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: route.h 1374 2004-03-21 14:21:22Z guus $
$Id: route.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_ROUTE_H__

View file

@ -1,7 +1,7 @@
/*
device.c -- Interaction with Solaris tun device
Copyright (C) 2001-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2001-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2001-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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: device.c 1412 2004-11-10 21:14:08Z guus $
$Id: device.c 1439 2005-05-04 18:09:30Z guus $
*/

View file

@ -1,7 +1,7 @@
/*
subnet.c -- handle subnet lookups and lists
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -17,16 +17,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: subnet.c 1396 2004-11-01 15:16:12Z guus $
$Id: subnet.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
#include "avl_tree.h"
#include "device.h"
#include "logger.h"
#include "net.h"
#include "netutl.h"
#include "node.h"
#include "process.h"
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"
@ -245,6 +247,11 @@ bool net2str(char *netstr, int len, const subnet_t *subnet)
{
cp();
if(!netstr || !subnet) {
logger(LOG_ERR, _("net2str() was called with netstr=%p, subnet=%p!\n"), netstr, subnet);
return false;
}
switch (subnet->type) {
case SUBNET_MAC:
snprintf(netstr, len, "%hx:%hx:%hx:%hx:%hx:%hx",
@ -385,6 +392,52 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address)
return p;
}
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
avl_node_t *node;
int i;
char *envp[8];
char netstr[MAXNETSTR + 7] = "SUBNET=";
char *name, *address, *port;
asprintf(&envp[0], "NETNAME=%s", netname ? : "");
asprintf(&envp[1], "DEVICE=%s", device ? : "");
asprintf(&envp[2], "INTERFACE=%s", iface ? : "");
asprintf(&envp[3], "NODE=%s", owner->name);
if(owner != myself) {
sockaddr2str(&owner->address, &address, &port);
asprintf(&envp[4], "REMOTEADDRESS=%s", address);
asprintf(&envp[5], "REMOTEPORT=%s", port);
envp[6] = netstr;
envp[7] = NULL;
} else {
envp[4] = netstr;
envp[5] = NULL;
}
name = up ? "subnet-up" : "subnet-down";
if(!subnet) {
for(node = owner->subnet_tree->head; node; node = node->next) {
subnet = node->data;
if(!net2str(netstr + 7, sizeof netstr - 7, subnet))
continue;
execute_script(name, envp);
}
} else {
if(net2str(netstr + 7, sizeof netstr - 7, subnet))
execute_script(name, envp);
}
for(i = 0; i < (owner != myself ? 6 : 4); i++)
free(envp[i]);
if(owner != myself) {
free(address);
free(port);
}
}
void dump_subnets(void)
{
char netstr[MAXNETSTR];

View file

@ -1,7 +1,7 @@
/*
subnet.h -- header for subnet.c
Copyright (C) 2000-2004 Guus Sliepen <guus@tinc-vpn.org>,
2000-2004 Ivo Timmermans <ivo@tinc-vpn.org>
Copyright (C) 2000-2005 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans <ivo@tinc-vpn.org>
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
@ -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.h 1374 2004-03-21 14:21:22Z guus $
$Id: subnet.h 1439 2005-05-04 18:09:30Z guus $
*/
#ifndef __TINC_SUBNET_H__
@ -74,6 +74,7 @@ extern avl_tree_t *new_subnet_tree(void) __attribute__ ((__malloc__));
extern void free_subnet_tree(avl_tree_t *);
extern void subnet_add(struct node_t *, subnet_t *);
extern void subnet_del(struct node_t *, subnet_t *);
extern void subnet_update(struct node_t *, subnet_t *, bool);
extern bool net2str(char *, int, const subnet_t *);
extern bool str2net(subnet_t *, const char *);
extern subnet_t *lookup_subnet(const struct node_t *, const subnet_t *);

View file

@ -1,7 +1,7 @@
/*
tincd.c -- the main file for tincd
Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 1998-2005 Ivo Timmermans <ivo@tinc-vpn.org>
2000-2005 Guus Sliepen <guus@tinc-vpn.org>
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
@ -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 1393 2004-10-01 18:23:08Z guus $
$Id: tincd.c 1439 2005-05-04 18:09:30Z guus $
*/
#include "system.h"
@ -407,7 +407,7 @@ int main(int argc, char **argv)
if(show_version) {
printf(_("%s version %s (built %s %s, protocol %d)\n"), PACKAGE,
VERSION, __DATE__, __TIME__, PROT_CURRENT);
printf(_("Copyright (C) 1998-2004 Ivo Timmermans, Guus Sliepen and others.\n"
printf(_("Copyright (C) 1998-2005 Ivo Timmermans, Guus Sliepen and others.\n"
"See the AUTHORS file for a complete list.\n\n"
"tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
"and you are welcome to redistribute it under certain conditions;\n"

View file

@ -1,7 +1,7 @@
/*
device.c -- UML network socket
Copyright (C) 2002-2004 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2004 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2002-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
2002-2005 Guus Sliepen <guus@tinc-vpn.org>
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