library for inclusion into tinc (http://tinc.nl.linux.org/) by
Guus Sliepen <guus@sliepen.eu.org>.
- $Id: avl_tree.c,v 1.1.2.13 2003/06/11 19:39:02 guus Exp $
+ $Id: avl_tree.c,v 1.1.2.14 2003/07/06 23:16:27 guus Exp $
*/
#include <stdio.h>
#endif
#ifndef AVL_DEPTH
-int lg(unsigned int u)
+static int lg(unsigned int u) __attribute__ ((const));
+
+static int lg(unsigned int u)
{
int r = 1;
/* Internal helper functions */
-int avl_check_balance(avl_node_t *node)
+static int avl_check_balance(avl_node_t *node)
{
#ifdef AVL_DEPTH
int d;
#endif
}
-void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
+static void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *child;
avl_node_t *gchild;
-/* $Id: fake-getaddrinfo.h,v 1.1.2.1 2002/07/12 11:45:21 guus Exp $ */
+/* $Id: fake-getaddrinfo.h,v 1.1.2.2 2003/07/06 23:16:27 guus Exp $ */
#ifndef _FAKE_GETADDRINFO_H
#define _FAKE_GETADDRINFO_H
# define NI_NUMERICSERV 8
#endif
+#ifndef AI_NUMERICHOST
+#define AI_NUMERICHOST 4
+#endif
+
#ifndef HAVE_STRUCT_ADDRINFO
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: list.h,v 1.1.2.8 2002/09/09 22:32:27 guus Exp $
+ $Id: list.h,v 1.1.2.9 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_LIST_H__
/* (De)constructors */
-extern list_t *list_alloc(list_action_t);
+extern list_t *list_alloc(list_action_t) __attribute__ ((malloc));
extern void list_free(list_t *);
extern list_node_t *list_alloc_node(void);
extern void list_free_node(list_t *, list_node_t *);
/* FIXME: describe */
extern void (*xalloc_fail_func) ();
-void *xmalloc PARAMS ((size_t n));
-void *xmalloc_and_zero PARAMS ((size_t n));
+void *xmalloc PARAMS ((size_t n)) __attribute__ ((malloc));
+void *xmalloc_and_zero PARAMS ((size_t n)) __attribute__ ((malloc));
void *xcalloc PARAMS ((size_t n, size_t s));
-void *xrealloc PARAMS ((void *p, size_t n));
+void *xrealloc PARAMS ((void *p, size_t n)) __attribute__ ((malloc));
-char *xstrdup PARAMS ((const char *s));
+char *xstrdup PARAMS ((const char *s)) __attribute__ ((malloc));
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.62 2003/07/06 22:11:31 guus Exp $
+ $Id: conf.c,v 1.9.4.63 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
char *confbase = NULL; /* directory in which all config files are */
char *netname = NULL; /* name of the vpn network */
-int config_compare(config_t *a, config_t *b)
+static int config_compare(config_t *a, config_t *b)
{
int result;
given, and buf needs to be expanded, the var pointed to by buflen
will be increased.
*/
-char *readline(FILE * fp, char **buf, size_t *buflen)
+static char *readline(FILE * fp, char **buf, size_t *buflen)
{
char *newline = NULL;
char *p;
return x;
}
-int isadir(const char *f)
+static int isadir(const char *f)
{
struct stat s;
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.36 2003/07/06 22:11:31 guus Exp $
+ $Id: conf.h,v 1.6.4.37 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_CONF_H__
extern void init_configuration(avl_tree_t **);
extern void exit_configuration(avl_tree_t **);
-extern config_t *new_config(void);
+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(avl_tree_t *, char *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: connection.c,v 1.1.2.37 2003/07/06 22:11:31 guus Exp $
+ $Id: connection.c,v 1.1.2.38 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
avl_tree_t *connection_tree; /* Meta connections */
connection_t *broadcast;
-int connection_compare(connection_t *a, connection_t *b)
+static int connection_compare(connection_t *a, connection_t *b)
{
return (void *)a - (void *)b;
}
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: connection.h,v 1.1.2.31 2002/09/09 21:24:31 guus Exp $
+ $Id: connection.h,v 1.1.2.32 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_CONNECTION_H__
extern void init_connections(void);
extern void exit_connections(void);
-extern connection_t *new_connection(void);
+extern connection_t *new_connection(void) __attribute__ ((malloc));
extern void free_connection(connection_t *);
extern void connection_add(connection_t *);
extern void connection_del(connection_t *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: edge.c,v 1.1.2.19 2003/07/06 22:11:31 guus Exp $
+ $Id: edge.c,v 1.1.2.20 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
avl_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */
-int edge_compare(edge_t *a, edge_t *b)
+static int edge_compare(edge_t *a, edge_t *b)
{
return strcmp(a->to->name, b->to->name);
}
-int edge_weight_compare(edge_t *a, edge_t *b)
+static int edge_weight_compare(edge_t *a, edge_t *b)
{
int result;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: edge.h,v 1.1.2.11 2002/09/09 21:24:31 guus Exp $
+ $Id: edge.h,v 1.1.2.12 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_EDGE_H__
extern void init_edges(void);
extern void exit_edges(void);
-extern edge_t *new_edge(void);
+extern edge_t *new_edge(void) __attribute__ ((malloc));
extern void free_edge(edge_t *);
-extern avl_tree_t *new_edge_tree(void);
+extern avl_tree_t *new_edge_tree(void) __attribute__ ((malloc));
extern void free_edge_tree(avl_tree_t *);
extern void edge_add(edge_t *);
extern void edge_del(edge_t *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: event.c,v 1.1.4.6 2002/09/09 22:32:30 guus Exp $
+ $Id: event.c,v 1.1.4.7 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
int id;
-int event_compare(event_t *a, event_t *b)
+static int event_compare(event_t *a, event_t *b)
{
if(a->time > b->time)
return 1;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: event.h,v 1.1.4.4 2002/09/09 22:32:36 guus Exp $
+ $Id: event.h,v 1.1.4.5 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_EVENT_H__
#include <time.h>
#include <avl_tree.h>
-avl_tree_t *event_tree;
+extern avl_tree_t *event_tree;
typedef void (*event_handler_t)(void *);
extern void init_events(void);
extern void exit_events(void);
-extern event_t *new_event(void);
+extern event_t *new_event(void) __attribute__ ((malloc));
extern void free_event(event_t *);
extern void event_add(event_t *);
extern void event_del(event_t *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: logger.c,v 1.1.2.1 2003/07/06 22:11:31 guus Exp $
+ $Id: logger.c,v 1.1.2.2 2003/07/06 23:16:28 guus Exp $
*/
#include <stdio.h>
#include <stdarg.h>
#include <syslog.h>
+#include <unistd.h>
#include "conf.h"
#include "logger.h"
#include "system.h"
volatile int debug_level = DEBUG_NOTHING;
-int logmode = LOGMODE_STDERR;
-pid_t logpid;
+static int logmode = LOGMODE_STDERR;
+static pid_t logpid;
extern char *logfilename;
-FILE *logfile = NULL;
-const char *logident = NULL;
+static FILE *logfile = NULL;
+static const char *logident = NULL;
void openlogger(const char *ident, int mode) {
- char *fname;
-
logident = ident;
logmode = mode;
fprintf(stderr, "\n");
break;
case LOGMODE_FILE:
- fprintf(logfile, "%d %s[%d]: ", time(NULL), logident, logpid);
+ fprintf(logfile, "%ld %s[%d]: ", time(NULL), logident, logpid);
vfprintf(logfile, format, ap);
fprintf(logfile, "\n");
break;
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.188 2003/07/06 22:11:32 guus Exp $
+ $Id: net.c,v 1.35.4.189 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
/* Purge edges and subnets of unreachable nodes. Use carefully. */
-void purge(void)
+static void purge(void)
{
avl_node_t *nnode, *nnext, *enode, *enext, *snode, *snext;
node_t *n;
put all file descriptors in an fd_set array
While we're at it, purge stuff that needs to be removed.
*/
-int build_fdset(fd_set * fs)
+static int build_fdset(fd_set * fs)
{
avl_node_t *node, *next;
connection_t *c;
end does not reply in time, we consider them dead
and close the connection.
*/
-void check_dead_connections(void)
+static void check_dead_connections(void)
{
avl_node_t *node, *next;
connection_t *c;
check all connections to see if anything
happened on their sockets
*/
-void check_network_activity(fd_set * f)
+static void check_network_activity(fd_set * f)
{
connection_t *c;
avl_node_t *node;
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.59 2003/07/06 17:15:25 guus Exp $
+ $Id: net.h,v 1.9.4.60 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_NET_H__
extern int seconds_till_retry;
extern int addressfamily;
-extern char *request_name[];
-extern char *status_text[];
-
#include "connection.h" /* Yes, very strange placement indeed, but otherwise the typedefs get all tangled up */
extern listen_socket_t listen_socket[MAXSOCKETS];
extern int setup_listen_socket(sockaddr_t *);
extern int setup_vpn_in_socket(sockaddr_t *);
extern void send_packet(struct node_t *, vpn_packet_t *);
-extern void receive_packet(struct node_t *, vpn_packet_t *);
extern void receive_tcppacket(struct connection_t *, char *, int);
extern void broadcast_packet(struct node_t *, vpn_packet_t *);
extern int setup_network_connections(void);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net_packet.c,v 1.1.2.31 2003/07/06 22:11:32 guus Exp $
+ $Id: net_packet.c,v 1.1.2.32 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
int keylifetime = 0;
int keyexpires = 0;
EVP_CIPHER_CTX packet_ctx;
-char lzo_wrkmem[LZO1X_999_MEM_COMPRESS > LZO1X_1_MEM_COMPRESS ? LZO1X_999_MEM_COMPRESS : LZO1X_1_MEM_COMPRESS];
+static char lzo_wrkmem[LZO1X_999_MEM_COMPRESS > LZO1X_1_MEM_COMPRESS ? LZO1X_999_MEM_COMPRESS : LZO1X_1_MEM_COMPRESS];
#define MAX_SEQNO 1073741824
-length_t compress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level)
+static length_t compress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level)
{
if(level == 10) {
lzo_uint lzolen = MAXSIZE;
return -1;
}
-length_t uncompress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level)
+static length_t uncompress_packet(uint8_t *dest, const uint8_t *source, length_t len, int level)
{
if(level > 9) {
lzo_uint lzolen = MAXSIZE;
/* VPN packet I/O */
-void receive_udppacket(node_t *n, vpn_packet_t *inpkt)
+static void receive_packet(node_t *n, vpn_packet_t *packet)
+{
+ cp();
+
+ logger(DEBUG_TRAFFIC, LOG_DEBUG, _("Received packet of %d bytes from %s (%s)"),
+ packet->len, n->name, n->hostname);
+
+ route_incoming(n, packet);
+}
+
+static void receive_udppacket(node_t *n, vpn_packet_t *inpkt)
{
vpn_packet_t pkt1, pkt2;
vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
receive_packet(c->node, &outpkt);
}
-void receive_packet(node_t *n, vpn_packet_t *packet)
-{
- cp();
-
- logger(DEBUG_TRAFFIC, LOG_DEBUG, _("Received packet of %d bytes from %s (%s)"),
- packet->len, n->name, n->hostname);
-
- route_incoming(n, packet);
-}
-
-void send_udppacket(node_t *n, vpn_packet_t *inpkt)
+static void send_udppacket(node_t *n, vpn_packet_t *inpkt)
{
vpn_packet_t pkt1, pkt2;
vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: node.c,v 1.1.2.20 2003/07/06 22:11:32 guus Exp $
+ $Id: node.c,v 1.1.2.21 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
node_t *myself;
-int node_compare(node_t *a, node_t *b)
+static int node_compare(node_t *a, node_t *b)
{
return strcmp(a->name, b->name);
}
-int node_udp_compare(node_t *a, node_t *b)
+static int node_udp_compare(node_t *a, node_t *b)
{
int result;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: node.h,v 1.1.2.22 2003/05/06 21:13:18 guus Exp $
+ $Id: node.h,v 1.1.2.23 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_NODE_H__
extern void init_nodes(void);
extern void exit_nodes(void);
-extern node_t *new_node(void);
+extern node_t *new_node(void) __attribute__ ((malloc));
extern void free_node(node_t *);
extern void node_add(node_t *);
extern void node_del(node_t *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: process.c,v 1.1.2.51 2003/07/06 22:11:32 guus Exp $
+ $Id: process.c,v 1.1.2.52 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
extern int sigalrm;
extern int do_purge;
-void memory_full(int size)
+static void memory_full(int size)
{
logger(DEBUG_ALWAYS, LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exitting."), size);
cp_trace();
/* Some functions the less gifted operating systems might lack... */
#ifndef HAVE_FCLOSEALL
-int fcloseall(void)
+static int fcloseall(void)
{
fflush(stdin);
fflush(stdout);
/*
check for an existing tinc for this net, and write pid to pidfile
*/
-int write_pidfile(void)
+static int write_pidfile(void)
{
int pid;
/*
Execute the program name, with sane environment.
*/
-void _execute_script(const char *scriptname, char **envp)
+static void _execute_script(const char *scriptname, char **envp)
__attribute__ ((noreturn));
-void _execute_script(const char *scriptname, char **envp)
+static void _execute_script(const char *scriptname, char **envp)
{
cp();
Signal handlers.
*/
-RETSIGTYPE sigterm_handler(int a)
+static RETSIGTYPE sigterm_handler(int a)
{
logger(DEBUG_ALWAYS, LOG_NOTICE, _("Got TERM signal"));
cleanup_and_exit(0);
}
-RETSIGTYPE sigquit_handler(int a)
+static RETSIGTYPE sigquit_handler(int a)
{
logger(DEBUG_ALWAYS, LOG_NOTICE, _("Got QUIT signal"));
cleanup_and_exit(0);
}
-RETSIGTYPE fatal_signal_square(int a)
+static RETSIGTYPE fatal_signal_square(int a)
{
logger(DEBUG_ALWAYS, LOG_ERR, _("Got another fatal signal %d (%s): not restarting."), a,
strsignal(a));
exit(1);
}
-RETSIGTYPE fatal_signal_handler(int a)
+static RETSIGTYPE fatal_signal_handler(int a)
{
struct sigaction act;
logger(DEBUG_ALWAYS, LOG_ERR, _("Got fatal signal %d (%s)"), a, strsignal(a));
}
}
-RETSIGTYPE sighup_handler(int a)
+static RETSIGTYPE sighup_handler(int a)
{
logger(DEBUG_ALWAYS, LOG_NOTICE, _("Got HUP signal"));
sighup = 1;
}
-RETSIGTYPE sigint_handler(int a)
+static RETSIGTYPE sigint_handler(int a)
{
if(saved_debug_level != -1) {
logger(DEBUG_ALWAYS, LOG_NOTICE, _("Reverting to old debug level (%d)"),
}
}
-RETSIGTYPE sigalrm_handler(int a)
+static RETSIGTYPE sigalrm_handler(int a)
{
logger(DEBUG_ALWAYS, LOG_NOTICE, _("Got ALRM signal"));
sigalrm = 1;
}
-RETSIGTYPE sigusr1_handler(int a)
+static RETSIGTYPE sigusr1_handler(int a)
{
dump_connections();
}
-RETSIGTYPE sigusr2_handler(int a)
+static RETSIGTYPE sigusr2_handler(int a)
{
dump_device_stats();
dump_nodes();
dump_subnets();
}
-RETSIGTYPE sigwinch_handler(int a)
+static RETSIGTYPE sigwinch_handler(int a)
{
extern int do_purge;
do_purge = 1;
}
-RETSIGTYPE unexpected_signal_handler(int a)
+static RETSIGTYPE unexpected_signal_handler(int a)
{
logger(DEBUG_ALWAYS, LOG_WARNING, _("Got unexpected signal %d (%s)"), a, strsignal(a));
cp_trace();
}
-RETSIGTYPE ignore_signal_handler(int a)
+static RETSIGTYPE ignore_signal_handler(int a)
{
logger(DEBUG_SCARY_THINGS, LOG_DEBUG, _("Ignored signal %d (%s)"), a, strsignal(a));
}
-struct {
+static struct {
int signal;
void (*handler)(int);
} sighandlers[] = {
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: process.h,v 1.1.2.13 2002/09/09 21:24:41 guus Exp $
+ $Id: process.h,v 1.1.2.14 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_PROCESS_H__
extern int execute_script(const char *, char **);
extern int detach(void);
extern int kill_other(int);
-extern void cleanup_and_exit(int);
+extern void cleanup_and_exit(int) __attribute__ ((noreturn));
#endif /* __TINC_PROCESS_H__ */
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.138 2003/07/06 22:11:32 guus Exp $
+ $Id: protocol.c,v 1.28.4.139 2003/07/06 23:16:28 guus Exp $
*/
#include "config.h"
#include "system.h"
-avl_tree_t *past_request_tree;
+/* Jumptable for the request handlers */
+
+static int (*request_handlers[])(connection_t *) = {
+ id_h, metakey_h, challenge_h, chal_reply_h, ack_h,
+ status_h, error_h, termreq_h,
+ ping_h, pong_h,
+ add_subnet_h, del_subnet_h,
+ add_edge_h, del_edge_h,
+ key_changed_h, req_key_h, ans_key_h, tcppacket_h,
+};
+
+/* Request names */
+
+static char (*request_name[]) = {
+ "ID", "METAKEY", "CHALLENGE", "CHAL_REPLY", "ACK",
+ "STATUS", "ERROR", "TERMREQ",
+ "PING", "PONG",
+ "ADD_SUBNET", "DEL_SUBNET",
+ "ADD_EDGE", "DEL_EDGE", "KEY_CHANGED", "REQ_KEY", "ANS_KEY", "PACKET",
+};
+
+static avl_tree_t *past_request_tree;
int check_id(char *id)
{
return 0;
}
-int past_request_compare(past_request_t *a, past_request_t *b)
+static int past_request_compare(past_request_t *a, past_request_t *b)
{
return strcmp(a->request, b->request);
}
-void free_past_request(past_request_t *r)
+static void free_past_request(past_request_t *r)
{
cp();
logger(DEBUG_SCARY_THINGS, LOG_DEBUG, _("Aging past requests: deleted %d, left %d\n"),
deleted, left);
}
-
-/* Jumptable for the request handlers */
-
-int (*request_handlers[])(connection_t *) = {
- id_h, metakey_h, challenge_h, chal_reply_h, ack_h,
- status_h, error_h, termreq_h,
- ping_h, pong_h,
- add_subnet_h, del_subnet_h,
- add_edge_h, del_edge_h,
- key_changed_h, req_key_h, ans_key_h, tcppacket_h,
-};
-
-/* Request names */
-
-char (*request_name[]) = {
- "ID", "METAKEY", "CHALLENGE", "CHAL_REPLY", "ACK",
- "STATUS", "ERROR", "TERMREQ",
- "PING", "PONG",
- "ADD_SUBNET", "DEL_SUBNET",
- "ADD_EDGE", "DEL_EDGE", "KEY_CHANGED", "REQ_KEY", "ANS_KEY", "PACKET",
-};
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.37 2002/09/09 22:41:56 guus Exp $
+ $Id: protocol.h,v 1.5.4.38 2003/07/06 23:16:28 guus Exp $
*/
#ifndef __TINC_PROTOCOL_H__
/* Request handlers */
-extern int (*request_handlers[])(connection_t *);
-
extern int id_h(connection_t *);
extern int metakey_h(connection_t *);
extern int challenge_h(connection_t *);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: protocol_auth.c,v 1.1.4.21 2003/07/06 22:11:32 guus Exp $
+ $Id: protocol_auth.c,v 1.1.4.22 2003/07/06 23:16:29 guus Exp $
*/
#include "config.h"
return x;
}
-void send_everything(connection_t *c)
+static void send_everything(connection_t *c)
{
avl_node_t *node, *node2;
node_t *n;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: protocol_misc.c,v 1.1.4.8 2003/07/06 22:11:33 guus Exp $
+ $Id: protocol_misc.c,v 1.1.4.9 2003/07/06 23:16:29 guus Exp $
*/
#include "config.h"
#include "system.h"
+/* Status strings */
+
+static char (*status_text[]) = {
+ "Warning",
+};
+
+/* Error strings */
+
+static char (*error_text[]) = {
+ "Error",
+};
+
/* Status and error notification routines */
int send_status(connection_t *c, int statusno, char *statusstring)
return 0;
}
-
-/* Status strings */
-
-char (*status_text[]) = {
- "Warning",
-};
-
-/* Error strings */
-
-char (*error_text[]) = {
- "Error",
-};
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: route.c,v 1.1.2.54 2003/07/06 22:11:33 guus Exp $
+ $Id: route.c,v 1.1.2.55 2003/07/06 23:16:29 guus Exp $
*/
#include "config.h"
int priorityinheritance = 0;
int macexpire = 600;
int overwrite_mac = 0;
-mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}};
+static mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}};
/* RFC 1071 */
-uint16_t inet_checksum(void *data, int len, uint16_t prevsum)
+static uint16_t inet_checksum(void *data, int len, uint16_t prevsum)
{
uint16_t *p = data;
uint32_t checksum = prevsum ^ 0xFFFF;
return ~checksum;
}
-int ratelimit(void) {
+static int ratelimit(void) {
static time_t lasttime = 0;
if(lasttime == now)
return 0;
}
-void learn_mac(mac_t *address)
+static void learn_mac(mac_t *address)
{
subnet_t *subnet;
avl_node_t *node;
}
}
-node_t *route_mac(vpn_packet_t *packet)
+static node_t *route_mac(vpn_packet_t *packet)
{
subnet_t *subnet;
/* RFC 792 */
-void route_ipv4_unreachable(vpn_packet_t *packet, uint8_t code)
+static void route_ipv4_unreachable(vpn_packet_t *packet, uint8_t code)
{
struct ip *hdr;
struct icmp *icmp;
write_packet(packet);
}
-node_t *route_ipv4(vpn_packet_t *packet)
+static node_t *route_ipv4(vpn_packet_t *packet)
{
subnet_t *subnet;
/* RFC 2463 */
-void route_ipv6_unreachable(vpn_packet_t *packet, uint8_t code)
+static void route_ipv6_unreachable(vpn_packet_t *packet, uint8_t code)
{
struct ip6_hdr *hdr;
struct icmp6_hdr *icmp;
#endif
-node_t *route_ipv6(vpn_packet_t *packet)
+static node_t *route_ipv6(vpn_packet_t *packet)
{
subnet_t *subnet;
/* RFC 2461 */
-void route_neighborsol(vpn_packet_t *packet)
+static void route_neighborsol(vpn_packet_t *packet)
{
struct ip6_hdr *hdr;
struct nd_neighbor_solicit *ns;
/* RFC 826 */
-void route_arp(vpn_packet_t *packet)
+static void route_arp(vpn_packet_t *packet)
{
struct ether_arp *arp;
subnet_t *subnet;
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.44 2003/07/06 22:11:33 guus Exp $
+ $Id: subnet.c,v 1.1.2.45 2003/07/06 23:16:29 guus Exp $
*/
#include "config.h"
/* Subnet comparison */
-int subnet_compare_mac(subnet_t *a, subnet_t *b)
+static int subnet_compare_mac(subnet_t *a, subnet_t *b)
{
int result;
return strcmp(a->owner->name, b->owner->name);
}
-int subnet_compare_ipv4(subnet_t *a, subnet_t *b)
+static int subnet_compare_ipv4(subnet_t *a, subnet_t *b)
{
int result;
return strcmp(a->owner->name, b->owner->name);
}
-int subnet_compare_ipv6(subnet_t *a, subnet_t *b)
+static int subnet_compare_ipv6(subnet_t *a, subnet_t *b)
{
int result;
return strcmp(a->owner->name, b->owner->name);
}
-int subnet_compare(subnet_t *a, subnet_t *b)
+static int subnet_compare(subnet_t *a, subnet_t *b)
{
int result;
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.20 2002/09/09 21:25:16 guus Exp $
+ $Id: subnet.h,v 1.1.2.21 2003/07/06 23:16:29 guus Exp $
*/
#ifndef __TINC_SUBNET_H__
} net;
} subnet_t;
-extern subnet_t *new_subnet(void);
+extern subnet_t *new_subnet(void) __attribute__ ((malloc));
extern void free_subnet(subnet_t *);
extern void init_subnets(void);
extern void exit_subnets(void);
-extern avl_tree_t *new_subnet_tree(void);
+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 *);
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.70 2003/07/06 22:11:33 guus Exp $
+ $Id: tincd.c,v 1.10.4.71 2003/07/06 23:16:29 guus Exp $
*/
#include "config.h"
exit(status);
}
-void parse_options(int argc, char **argv, char **envp)
+static void parse_options(int argc, char **argv, char **envp)
{
int r;
int option_index = 0;
/* This function prettyprints the key generation process */
-void indicator(int a, int b, void *p)
+static void indicator(int a, int b, void *p)
{
switch (a) {
case 0:
Generate a public/private RSA keypair, and ask for a file to store
them in.
*/
-int keygen(int bits)
+static int keygen(int bits)
{
RSA *rsa_key;
FILE *f;
/*
Set all files and paths according to netname
*/
-void make_names(void)
+static void make_names(void)
{
if(netname) {
if(!pidfilename)