From a227843b739d279b63adcf3736ebb03d856080c4 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 25 Sep 2009 00:33:04 +0200 Subject: [PATCH] Remove checkpoint tracing. This feature is not necessary anymore since we have tools like valgrind today that can catch stack overflow errors before they make a backtrace in gdb impossible. --- configure.in | 6 ------ lib/utils.c | 29 ----------------------------- lib/utils.h | 14 -------------- src/bsd/device.c | 10 ---------- src/conf.c | 28 ---------------------------- src/connection.c | 16 ---------------- src/cygwin/device.c | 10 ---------- src/edge.c | 20 -------------------- src/event.c | 16 ---------------- src/graph.c | 4 ---- src/linux/device.c | 10 ---------- src/meta.c | 6 ------ src/mingw/device.c | 8 -------- src/net.c | 13 ------------- src/net_packet.c | 16 ---------------- src/net_setup.c | 10 ---------- src/net_socket.c | 16 ---------------- src/netutl.c | 29 ----------------------------- src/node.c | 18 ------------------ src/process.c | 12 ------------ src/protocol.c | 16 ---------------- src/protocol_auth.c | 23 +---------------------- src/protocol_edge.c | 8 -------- src/protocol_key.c | 12 ------------ src/protocol_misc.c | 24 ------------------------ src/protocol_subnet.c | 8 -------- src/raw_socket/device.c | 10 ---------- src/route.c | 28 ---------------------------- src/solaris/device.c | 10 ---------- src/subnet.c | 32 -------------------------------- src/uml_socket/device.c | 10 ---------- 31 files changed, 1 insertion(+), 471 deletions(-) diff --git a/configure.in b/configure.in index 6771586..4c28426 100644 --- a/configure.in +++ b/configure.in @@ -164,12 +164,6 @@ AC_ARG_ENABLE(jumbograms, [ AC_DEFINE(ENABLE_JUMBOGRAMS, 1, [Support for jumbograms (packets up to 9000 bytes)]) ] ) -dnl Check if checkpoint tracing has to be enabled -AC_ARG_ENABLE(tracing, - AS_HELP_STRING([--enable-tracing], [enable checkpoint tracing (debugging only)]), - [ AC_DEFINE(ENABLE_TRACING, 1, [Checkpoint tracing]) ] -) - AC_SUBST(INCLUDES) AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile lib/Makefile po/Makefile.in m4/Makefile]) diff --git a/lib/utils.c b/lib/utils.c index b327a49..3283472 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -23,12 +23,6 @@ #include "../src/logger.h" #include "utils.h" -#ifdef ENABLE_TRACING -volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -volatile char (*cp_file[]) = {"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"}; -volatile int cp_index = 0; -#endif - const char hexadecimals[] = "0123456789ABCDEF"; int charhex2bin(char c) { @@ -53,29 +47,6 @@ void bin2hex(char *src, char *dst, int length) { } } -#ifdef ENABLE_TRACING -void cp_trace() { - logger(LOG_DEBUG, "Checkpoint trace: %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d <- %s:%d...", - cp_file[(cp_index + 15) % 16], cp_line[(cp_index + 15) % 16], - cp_file[(cp_index + 14) % 16], cp_line[(cp_index + 14) % 16], - cp_file[(cp_index + 13) % 16], cp_line[(cp_index + 13) % 16], - cp_file[(cp_index + 12) % 16], cp_line[(cp_index + 12) % 16], - cp_file[(cp_index + 11) % 16], cp_line[(cp_index + 11) % 16], - cp_file[(cp_index + 10) % 16], cp_line[(cp_index + 10) % 16], - cp_file[(cp_index + 9) % 16], cp_line[(cp_index + 9) % 16], - cp_file[(cp_index + 8) % 16], cp_line[(cp_index + 8) % 16], - cp_file[(cp_index + 7) % 16], cp_line[(cp_index + 7) % 16], - cp_file[(cp_index + 6) % 16], cp_line[(cp_index + 6) % 16], - cp_file[(cp_index + 5) % 16], cp_line[(cp_index + 5) % 16], - cp_file[(cp_index + 4) % 16], cp_line[(cp_index + 4) % 16], - cp_file[(cp_index + 3) % 16], cp_line[(cp_index + 3) % 16], - cp_file[(cp_index + 2) % 16], cp_line[(cp_index + 2) % 16], - cp_file[(cp_index + 1) % 16], cp_line[(cp_index + 1) % 16], - cp_file[cp_index], cp_line[cp_index] - ); -} -#endif - #if defined(HAVE_MINGW) || defined(HAVE_CYGWIN) #ifdef HAVE_CYGWIN #include diff --git a/lib/utils.h b/lib/utils.h index a94548f..c6fb180 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -21,20 +21,6 @@ #ifndef __TINC_UTILS_H__ #define __TINC_UTILS_H__ -#ifdef ENABLE_TRACING -extern volatile int cp_line[]; -extern volatile char *cp_file[]; -extern volatile int cp_index; -extern void cp_trace(void); - -#define cp() { cp_line[cp_index] = __LINE__; cp_file[cp_index] = __FILE__; cp_index++; cp_index %= 16; } -#define ecp() { fprintf(stderr, "Explicit checkpoint in %s line %d\n", __FILE__, __LINE__); } -#else -#define cp() -#define ecp() -#define cp_trace() -#endif - extern void hex2bin(char *src, char *dst, int length); extern void bin2hex(char *src, char *dst, int length); diff --git a/src/bsd/device.c b/src/bsd/device.c index 5fe8dc0..be026b7 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -59,8 +59,6 @@ static device_type_t device_type = DEVICE_TYPE_TUN; bool setup_device(void) { char *type; - cp(); - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) device = xstrdup(DEFAULT_DEVICE); @@ -165,8 +163,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - switch(device_type) { #ifdef HAVE_TUNEMU case DEVICE_TYPE_TUNEMU: @@ -184,8 +180,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - switch(device_type) { case DEVICE_TYPE_TUN: #ifdef HAVE_TUNEMU @@ -278,8 +272,6 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -349,8 +341,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/conf.c b/src/conf.c index e7703c1..688974b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -53,27 +53,19 @@ static int config_compare(const config_t *a, const config_t *b) { } void init_configuration(avl_tree_t ** config_tree) { - cp(); - *config_tree = avl_alloc_tree((avl_compare_t) config_compare, (avl_action_t) free_config); } void exit_configuration(avl_tree_t ** config_tree) { - cp(); - avl_delete_tree(*config_tree); *config_tree = NULL; } config_t *new_config(void) { - cp(); - return xmalloc_and_zero(sizeof(config_t)); } void free_config(config_t *cfg) { - cp(); - if(cfg->variable) free(cfg->variable); @@ -87,16 +79,12 @@ void free_config(config_t *cfg) { } void config_add(avl_tree_t *config_tree, config_t *cfg) { - cp(); - avl_insert(config_tree, cfg); } config_t *lookup_config(avl_tree_t *config_tree, char *variable) { config_t cfg, *found; - cp(); - cfg.variable = variable; cfg.file = ""; cfg.line = 0; @@ -116,8 +104,6 @@ config_t *lookup_config_next(avl_tree_t *config_tree, const config_t *cfg) { avl_node_t *node; config_t *found; - cp(); - node = avl_search_node(config_tree, cfg); if(node) { @@ -133,8 +119,6 @@ config_t *lookup_config_next(avl_tree_t *config_tree, const config_t *cfg) { } bool get_config_bool(const config_t *cfg, bool *result) { - cp(); - if(!cfg) return false; @@ -153,8 +137,6 @@ bool get_config_bool(const config_t *cfg, bool *result) { } bool get_config_int(const config_t *cfg, int *result) { - cp(); - if(!cfg) return false; @@ -168,8 +150,6 @@ bool get_config_int(const config_t *cfg, int *result) { } bool get_config_string(const config_t *cfg, char **result) { - cp(); - if(!cfg) return false; @@ -181,8 +161,6 @@ bool get_config_string(const config_t *cfg, char **result) { bool get_config_address(const config_t *cfg, struct addrinfo **result) { struct addrinfo *ai; - cp(); - if(!cfg) return false; @@ -202,8 +180,6 @@ bool get_config_address(const config_t *cfg, struct addrinfo **result) { bool get_config_subnet(const config_t *cfg, subnet_t ** result) { subnet_t subnet = {0}; - cp(); - if(!cfg) return false; @@ -314,8 +290,6 @@ int read_config_file(avl_tree_t *config_tree, const char *fname) { config_t *cfg; size_t bufsize; - cp(); - fp = fopen(fname, "r"); if(!fp) { @@ -397,8 +371,6 @@ bool read_server_config() { char *fname; int x; - cp(); - xasprintf(&fname, "%s/tinc.conf", confbase); x = read_config_file(config_tree, fname); diff --git a/src/connection.c b/src/connection.c index 289c233..7c8cd0b 100644 --- a/src/connection.c +++ b/src/connection.c @@ -38,8 +38,6 @@ static int connection_compare(const connection_t *a, const connection_t *b) { } void init_connections(void) { - cp(); - connection_tree = avl_alloc_tree((avl_compare_t) connection_compare, (avl_action_t) free_connection); broadcast = new_connection(); broadcast->name = xstrdup(_("everyone")); @@ -47,8 +45,6 @@ void init_connections(void) { } void exit_connections(void) { - cp(); - avl_delete_tree(connection_tree); free_connection(broadcast); } @@ -56,8 +52,6 @@ void exit_connections(void) { connection_t *new_connection(void) { connection_t *c; - cp(); - c = xmalloc_and_zero(sizeof(connection_t)); if(!c) @@ -69,8 +63,6 @@ connection_t *new_connection(void) { } void free_connection(connection_t *c) { - cp(); - if(c->name) free(c->name); @@ -112,14 +104,10 @@ void free_connection(connection_t *c) { } void connection_add(connection_t *c) { - cp(); - avl_insert(connection_tree, c); } void connection_del(connection_t *c) { - cp(); - avl_delete(connection_tree, c); } @@ -127,8 +115,6 @@ void dump_connections(void) { avl_node_t *node; connection_t *c; - cp(); - logger(LOG_DEBUG, _("Connections:")); for(node = connection_tree->head; node; node = node->next) { @@ -145,8 +131,6 @@ bool read_connection_config(connection_t *c) { char *fname; int x; - cp(); - xasprintf(&fname, "%s/hosts/%s", confbase, c->name); x = read_config_file(c->config_tree, fname); free(fname); diff --git a/src/cygwin/device.c b/src/cygwin/device.c index 921205c..617214d 100644 --- a/src/cygwin/device.c +++ b/src/cygwin/device.c @@ -57,8 +57,6 @@ bool setup_device(void) { bool found = false; - cp(); - get_config_string(lookup_config(config_tree, "Device"), &device); get_config_string(lookup_config(config_tree, "Interface"), &iface); @@ -216,8 +214,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - close(sp[0]); close(sp[1]); CloseHandle(device_handle); @@ -231,8 +227,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - if((lenin = read(sp[0], packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); @@ -252,8 +246,6 @@ bool read_packet(vpn_packet_t *packet) { bool write_packet(vpn_packet_t *packet) { long lenout; - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -268,8 +260,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/edge.c b/src/edge.c index 403dfff..d1ff324 100644 --- a/src/edge.c +++ b/src/edge.c @@ -51,48 +51,34 @@ static int edge_weight_compare(const edge_t *a, const edge_t *b) { } void init_edges(void) { - cp(); - edge_weight_tree = avl_alloc_tree((avl_compare_t) edge_weight_compare, NULL); } avl_tree_t *new_edge_tree(void) { - cp(); - return avl_alloc_tree((avl_compare_t) edge_compare, (avl_action_t) free_edge); } void free_edge_tree(avl_tree_t *edge_tree) { - cp(); - avl_delete_tree(edge_tree); } void exit_edges(void) { - cp(); - avl_delete_tree(edge_weight_tree); } /* Creation and deletion of connection elements */ edge_t *new_edge(void) { - cp(); - return xmalloc_and_zero(sizeof(edge_t)); } void free_edge(edge_t *e) { - cp(); - sockaddrfree(&e->address); free(e); } void edge_add(edge_t *e) { - cp(); - avl_insert(edge_weight_tree, e); avl_insert(e->from->edge_tree, e); @@ -103,8 +89,6 @@ void edge_add(edge_t *e) { } void edge_del(edge_t *e) { - cp(); - if(e->reverse) e->reverse->reverse = NULL; @@ -115,8 +99,6 @@ void edge_del(edge_t *e) { edge_t *lookup_edge(node_t *from, node_t *to) { edge_t v; - cp(); - v.from = from; v.to = to; @@ -129,8 +111,6 @@ void dump_edges(void) { edge_t *e; char *address; - cp(); - logger(LOG_DEBUG, _("Edges:")); for(node = node_tree->head; node; node = node->next) { diff --git a/src/event.c b/src/event.c index 304360c..99e6a23 100644 --- a/src/event.c +++ b/src/event.c @@ -41,14 +41,10 @@ static int event_compare(const event_t *a, const event_t *b) { } void init_events(void) { - cp(); - event_tree = avl_alloc_tree((avl_compare_t) event_compare, (avl_action_t) free_event); } void exit_events(void) { - cp(); - avl_delete_tree(event_tree); } @@ -62,8 +58,6 @@ void expire_events(void) { * the expiration time of the last event and the current time. */ - cp(); - if(!event_tree->tail) return; @@ -80,35 +74,25 @@ void expire_events(void) { } event_t *new_event(void) { - cp(); - return xmalloc_and_zero(sizeof(event_t)); } void free_event(event_t *event) { - cp(); - free(event); } void event_add(event_t *event) { - cp(); - event->id = ++id; avl_insert(event_tree, event); } void event_del(event_t *event) { - cp(); - avl_delete(event_tree, event); } event_t *get_expired_event(void) { event_t *event; - cp(); - if(event_tree->head) { event = event_tree->head->data; diff --git a/src/graph.c b/src/graph.c index 4f2ea49..c8430d8 100644 --- a/src/graph.c +++ b/src/graph.c @@ -73,8 +73,6 @@ void mst_kruskal(void) { int safe_edges = 0; bool skipped; - cp(); - /* Clear MST status on connections */ for(node = connection_tree->head; node; node = node->next) { @@ -159,8 +157,6 @@ void sssp_bfs(void) { char *envp[7]; int i; - cp(); - todo_list = list_alloc(NULL); /* Clear visited status on nodes */ diff --git a/src/linux/device.c b/src/linux/device.c index 9af5038..8ae8fef 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -53,8 +53,6 @@ static int device_total_out = 0; bool setup_device(void) { struct ifreq ifr; - cp(); - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) device = xstrdup(DEFAULT_DEVICE); @@ -116,8 +114,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - close(device_fd); free(device); @@ -127,8 +123,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - switch(device_type) { case DEVICE_TYPE_TUN: lenin = read(device_fd, packet->data + 10, MTU - 10); @@ -174,8 +168,6 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -212,8 +204,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/meta.c b/src/meta.c index 27d2394..9c38fef 100644 --- a/src/meta.c +++ b/src/meta.c @@ -36,8 +36,6 @@ bool send_meta(connection_t *c, const char *buffer, int length) { int outlen; int result; - cp(); - if(!c) { logger(LOG_ERR, _("send_meta() called with NULL pointer!")); abort(); @@ -121,8 +119,6 @@ void broadcast_meta(connection_t *from, const char *buffer, int length) { avl_node_t *node; connection_t *c; - cp(); - for(node = connection_tree->head; node; node = node->next) { c = node->data; @@ -137,8 +133,6 @@ bool receive_meta(connection_t *c) { bool decrypted = false; char inbuf[MAXBUFSIZE]; - cp(); - /* Strategy: - Read as much as possible from the TCP socket in one go. - Decrypt it. diff --git a/src/mingw/device.c b/src/mingw/device.c index c0f02f2..132ef8f 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -106,8 +106,6 @@ bool setup_device(void) { .ai_flags = 0, }; - cp(); - get_config_string(lookup_config(config_tree, "Device"), &device); get_config_string(lookup_config(config_tree, "Interface"), &iface); @@ -220,8 +218,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - CloseHandle(device_handle); free(device); @@ -236,8 +232,6 @@ bool write_packet(vpn_packet_t *packet) { long lenout; OVERLAPPED overlapped = {0}; - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -252,8 +246,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/net.c b/src/net.c index 0b617bd..da5be4e 100644 --- a/src/net.c +++ b/src/net.c @@ -52,8 +52,6 @@ static void purge(void) { edge_t *e; subnet_t *s; - cp(); - ifdebug(PROTOCOL) logger(LOG_DEBUG, _("Purging unreachable nodes")); /* Remove all edges and subnets owned by unreachable nodes. */ @@ -114,8 +112,6 @@ static int build_fdset(fd_set *readset, fd_set *writeset) { connection_t *c; int i, max = 0; - cp(); - FD_ZERO(readset); FD_ZERO(writeset); @@ -161,8 +157,6 @@ static int build_fdset(fd_set *readset, fd_set *writeset) { - Deactivate the host */ void terminate_connection(connection_t *c, bool report) { - cp(); - if(c->status.remove) return; @@ -227,8 +221,6 @@ static void check_dead_connections(void) { avl_node_t *node, *next; connection_t *c; - cp(); - for(node = connection_tree->head; node; node = next) { next = node->next; c = node->data; @@ -285,8 +277,6 @@ static void check_network_activity(fd_set * readset, fd_set * writeset) { socklen_t len = sizeof(result); vpn_packet_t packet; - cp(); - /* check input from kernel */ if(device_fd >= 0 && FD_ISSET(device_fd, readset)) { if(read_packet(&packet)) { @@ -352,8 +342,6 @@ int main_loop(void) { time_t last_ping_check, last_config_check, last_graph_dump; event_t *event; - cp(); - last_ping_check = now; last_config_check = now; last_graph_dump = now; @@ -383,7 +371,6 @@ int main_loop(void) { if(errno != EINTR && errno != EAGAIN) { logger(LOG_ERR, _("Error while waiting for input: %s"), strerror(errno)); - cp_trace(); dump_connections(); return 1; } diff --git a/src/net_packet.c b/src/net_packet.c index 0059b27..05336b0 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -62,8 +62,6 @@ void send_mtu_probe(node_t *n) { vpn_packet_t packet; int len, i; - cp(); - n->mtuprobes++; n->mtuevent = NULL; @@ -158,8 +156,6 @@ static length_t uncompress_packet(uint8_t *dest, const uint8_t *source, length_t /* VPN packet I/O */ static void receive_packet(node_t *n, vpn_packet_t *packet) { - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Received packet of %d bytes from %s (%s)"), packet->len, n->name, n->hostname); @@ -186,8 +182,6 @@ static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) { unsigned char hmac[EVP_MAX_MD_SIZE]; int i; - cp(); - if(!n->inkey) { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Got packet from %s (%s) but he hasn't got our key yet"), n->name, n->hostname); @@ -297,8 +291,6 @@ static void receive_udppacket(node_t *n, vpn_packet_t *inpkt) { void receive_tcppacket(connection_t *c, char *buffer, int len) { vpn_packet_t outpkt; - cp(); - outpkt.len = len; if(c->options & OPTION_TCPONLY) outpkt.priority = 0; @@ -321,8 +313,6 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) { int origpriority; int sock; - cp(); - if(!n->status.reachable) { ifdebug(TRAFFIC) logger(LOG_INFO, _("Trying to send UDP packet to unreachable node %s (%s)"), n->name, n->hostname); return; @@ -444,8 +434,6 @@ end: void send_packet(const node_t *n, vpn_packet_t *packet) { node_t *via; - cp(); - if(n == myself) { if(overwrite_mac) memcpy(packet->data, mymac.x, ETH_ALEN); @@ -481,8 +469,6 @@ void broadcast_packet(const node_t *from, vpn_packet_t *packet) { avl_node_t *node; connection_t *c; - cp(); - ifdebug(TRAFFIC) logger(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"), packet->len, from->name, from->hostname); @@ -534,8 +520,6 @@ void handle_incoming_vpn_data(int sock) { socklen_t fromlen = sizeof(from); node_t *n; - cp(); - pkt.len = recvfrom(sock, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen); if(pkt.len < 0) { diff --git a/src/net_setup.c b/src/net_setup.c index a6fd3d0..12b09a9 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -49,8 +49,6 @@ bool read_rsa_public_key(connection_t *c) { char *fname; char *key; - cp(); - if(!c->rsa_key) { c->rsa_key = RSA_new(); // RSA_blinding_on(c->rsa_key, NULL); @@ -149,8 +147,6 @@ bool read_rsa_private_key(void) { char *fname, *key, *pubkey; struct stat s; - cp(); - if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) { if(!get_config_string(lookup_config(myself->connection->config_tree, "PublicKey"), &pubkey)) { logger(LOG_ERR, _("PrivateKey used but no PublicKey found!")); @@ -217,8 +213,6 @@ bool setup_myself(void) { bool choice; int i, err; - cp(); - myself = new_node(); myself->connection = new_connection(); init_configuration(&myself->connection->config_tree); @@ -504,8 +498,6 @@ bool setup_myself(void) { initialize network */ bool setup_network(void) { - cp(); - now = time(NULL); init_events(); @@ -545,8 +537,6 @@ void close_network_connections(void) { char *envp[5]; int i; - cp(); - for(node = connection_tree->head; node; node = next) { next = node->next; c = node->data; diff --git a/src/net_socket.c b/src/net_socket.c index 5f6cd2a..8c80549 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -175,8 +175,6 @@ int setup_listen_socket(const sockaddr_t *sa) { int option; char *iface; - cp(); - nfd = socket(sa->sa.sa_family, SOCK_STREAM, IPPROTO_TCP); if(nfd < 0) { @@ -237,8 +235,6 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { char *addrstr; int option; - cp(); - nfd = socket(sa->sa.sa_family, SOCK_DGRAM, IPPROTO_UDP); if(nfd < 0) { @@ -311,8 +307,6 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { void retry_outgoing(outgoing_t *outgoing) { event_t *event; - cp(); - outgoing->timeout += 5; if(outgoing->timeout > maxtimeout) @@ -330,8 +324,6 @@ void retry_outgoing(outgoing_t *outgoing) { } void finish_connecting(connection_t *c) { - cp(); - ifdebug(CONNECTIONS) logger(LOG_INFO, _("Connected to %s (%s)"), c->name, c->hostname); configure_tcp(c); @@ -345,8 +337,6 @@ void do_outgoing_connection(connection_t *c) { char *address, *port; int result; - cp(); - begin: if(!c->outgoing->ai) { if(!c->outgoing->cfg) { @@ -440,8 +430,6 @@ void setup_outgoing_connection(outgoing_t *outgoing) { connection_t *c; node_t *n; - cp(); - n = lookup_node(outgoing->name); if(n) @@ -488,8 +476,6 @@ bool handle_new_meta_connection(int sock) { int fd; socklen_t len = sizeof(sa); - cp(); - fd = accept(sock, &sa.sa, &len); if(fd < 0) { @@ -541,8 +527,6 @@ void try_outgoing_connections(void) { connection_t *c; avl_node_t *node; - cp(); - if(outgoing_list) { for(node = connection_tree->head; node; node = node->next) { c = node->data; diff --git a/src/netutl.c b/src/netutl.c index 9872480..7eadaeb 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -36,8 +36,6 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock struct addrinfo *ai, hint = {0}; int err; - cp(); - hint.ai_family = addressfamily; hint.ai_socktype = socktype; @@ -57,8 +55,6 @@ sockaddr_t str2sockaddr(const char *address, const char *port) { sockaddr_t result; int err; - cp(); - hint.ai_family = AF_UNSPEC; hint.ai_flags = AI_NUMERICHOST; hint.ai_socktype = SOCK_STREAM; @@ -86,8 +82,6 @@ void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr) { char *scopeid; int err; - cp(); - if(sa->sa.sa_family == AF_UNKNOWN) { *addrstr = xstrdup(sa->unknown.address); *portstr = xstrdup(sa->unknown.port); @@ -99,7 +93,6 @@ void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr) { if(err) { logger(LOG_ERR, _("Error while translating addresses: %s"), gai_strerror(err)); - cp_trace(); raise(SIGFPE); exit(0); } @@ -119,8 +112,6 @@ char *sockaddr2hostname(const sockaddr_t *sa) { char port[NI_MAXSERV] = "unknown"; int err; - cp(); - if(sa->sa.sa_family == AF_UNKNOWN) { xasprintf(&str, _("%s port %s"), sa->unknown.address, sa->unknown.port); return str; @@ -141,8 +132,6 @@ char *sockaddr2hostname(const sockaddr_t *sa) { int sockaddrcmp_noport(const sockaddr_t *a, const sockaddr_t *b) { int result; - cp(); - result = a->sa.sa_family - b->sa.sa_family; if(result) @@ -164,7 +153,6 @@ int sockaddrcmp_noport(const sockaddr_t *a, const sockaddr_t *b) { default: logger(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"), a->sa.sa_family); - cp_trace(); raise(SIGFPE); exit(0); } @@ -173,8 +161,6 @@ int sockaddrcmp_noport(const sockaddr_t *a, const sockaddr_t *b) { int sockaddrcmp(const sockaddr_t *a, const sockaddr_t *b) { int result; - cp(); - result = a->sa.sa_family - b->sa.sa_family; if(result) @@ -211,15 +197,12 @@ int sockaddrcmp(const sockaddr_t *a, const sockaddr_t *b) { default: logger(LOG_ERR, _("sockaddrcmp() was called with unknown address family %d, exitting!"), a->sa.sa_family); - cp_trace(); raise(SIGFPE); exit(0); } } void sockaddrcpy(sockaddr_t *a, const sockaddr_t *b) { - cp(); - if(b->sa.sa_family != AF_UNKNOWN) { *a = *b; } else { @@ -230,8 +213,6 @@ void sockaddrcpy(sockaddr_t *a, const sockaddr_t *b) { } void sockaddrfree(sockaddr_t *a) { - cp(); - if(a->sa.sa_family == AF_UNKNOWN) { free(a->unknown.address); free(a->unknown.port); @@ -239,8 +220,6 @@ void sockaddrfree(sockaddr_t *a) { } void sockaddrunmap(sockaddr_t *sa) { - cp(); - if(sa->sa.sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->in6.sin6_addr)) { sa->in.sin_addr.s_addr = ((uint32_t *) & sa->in6.sin6_addr)[3]; sa->in.sin_family = AF_INET; @@ -254,8 +233,6 @@ int maskcmp(const void *va, const void *vb, int masklen) { const char *a = va; const char *b = vb; - cp(); - for(m = masklen, i = 0; m >= 8; m -= 8, i++) { result = a[i] - b[i]; if(result) @@ -273,8 +250,6 @@ void mask(void *va, int masklen, int len) { int i; char *a = va; - cp(); - i = masklen / 8; masklen %= 8; @@ -290,8 +265,6 @@ void maskcpy(void *va, const void *vb, int masklen, int len) { char *a = va; const char *b = vb; - cp(); - for(m = masklen, i = 0; m >= 8; m -= 8, i++) a[i] = b[i]; @@ -308,8 +281,6 @@ bool maskcheck(const void *va, int masklen, int len) { int i; const char *a = va; - cp(); - i = masklen / 8; masklen %= 8; diff --git a/src/node.c b/src/node.c index 92af66a..579f05c 100644 --- a/src/node.c +++ b/src/node.c @@ -42,15 +42,11 @@ static int node_udp_compare(const node_t *a, const node_t *b) { } void init_nodes(void) { - cp(); - node_tree = avl_alloc_tree((avl_compare_t) node_compare, (avl_action_t) free_node); node_udp_tree = avl_alloc_tree((avl_compare_t) node_udp_compare, NULL); } void exit_nodes(void) { - cp(); - avl_delete_tree(node_udp_tree); avl_delete_tree(node_tree); } @@ -58,8 +54,6 @@ void exit_nodes(void) { node_t *new_node(void) { node_t *n = xmalloc_and_zero(sizeof(*n)); - cp(); - n->subnet_tree = new_subnet_tree(); n->edge_tree = new_edge_tree(); EVP_CIPHER_CTX_init(&n->inctx); @@ -71,8 +65,6 @@ node_t *new_node(void) { } void free_node(node_t *n) { - cp(); - if(n->inkey) free(n->inkey); @@ -103,8 +95,6 @@ void free_node(node_t *n) { } void node_add(node_t *n) { - cp(); - avl_insert(node_tree, n); } @@ -113,8 +103,6 @@ void node_del(node_t *n) { edge_t *e; subnet_t *s; - cp(); - for(node = n->subnet_tree->head; node; node = next) { next = node->next; s = node->data; @@ -134,8 +122,6 @@ void node_del(node_t *n) { node_t *lookup_node(char *name) { node_t n = {0}; - cp(); - n.name = name; return avl_search(node_tree, &n); @@ -144,8 +130,6 @@ node_t *lookup_node(char *name) { node_t *lookup_node_udp(const sockaddr_t *sa) { node_t n = {0}; - cp(); - n.address = *sa; n.name = NULL; @@ -174,8 +158,6 @@ void dump_nodes(void) { avl_node_t *node; node_t *n; - cp(); - logger(LOG_DEBUG, _("Nodes:")); for(node = node_tree->head; node; node = node->next) { diff --git a/src/process.c b/src/process.c index 4066610..b8bb821 100644 --- a/src/process.c +++ b/src/process.c @@ -49,7 +49,6 @@ static int saved_debug_level = -1; static void memory_full(int size) { logger(LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exitting."), size); - cp_trace(); exit(1); } @@ -241,8 +240,6 @@ bool init_service(void) { static bool write_pidfile(void) { pid_t pid; - cp(); - pid = check_pid(pidfilename); if(pid) { @@ -271,8 +268,6 @@ bool kill_other(int signal) { #ifndef HAVE_MINGW pid_t pid; - cp(); - pid = read_pid(pidfilename); if(!pid) { @@ -308,8 +303,6 @@ bool kill_other(int signal) { Detach from current terminal, write pidfile, kill parent */ bool detach(void) { - cp(); - setup_signals(); /* First check if we can open a fresh new pidfile */ @@ -359,8 +352,6 @@ bool execute_script(const char *name, char **envp) { char *scriptname, *p; int i; - cp(); - #ifndef HAVE_MINGW len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name); #else @@ -456,14 +447,12 @@ static RETSIGTYPE sigquit_handler(int a) { static RETSIGTYPE fatal_signal_square(int a) { logger(LOG_ERR, _("Got another fatal signal %d (%s): not restarting."), a, strsignal(a)); - cp_trace(); exit(1); } static RETSIGTYPE fatal_signal_handler(int a) { struct sigaction act; logger(LOG_ERR, _("Got fatal signal %d (%s)"), a, strsignal(a)); - cp_trace(); if(do_detach) { logger(LOG_NOTICE, _("Trying to re-execute in 5 seconds...")); @@ -527,7 +516,6 @@ static RETSIGTYPE sigwinch_handler(int a) { static RETSIGTYPE unexpected_signal_handler(int a) { logger(LOG_WARNING, _("Got unexpected signal %d (%s)"), a, strsignal(a)); - cp_trace(); } static RETSIGTYPE ignore_signal_handler(int a) { diff --git a/src/protocol.c b/src/protocol.c index 78781a6..5e08816 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -69,8 +69,6 @@ bool send_request(connection_t *c, const char *format, ...) { char buffer[MAXBUFSIZE]; int len, request; - cp(); - /* Use vsnprintf instead of vxasprintf: faster, no memory fragmentation, cleanup is automatic, and there is a limit on the input buffer anyway */ @@ -107,8 +105,6 @@ bool send_request(connection_t *c, const char *format, ...) { void forward_request(connection_t *from) { int request; - cp(); - ifdebug(PROTOCOL) { sscanf(from->buffer, "%d", &request); ifdebug(META) @@ -128,8 +124,6 @@ void forward_request(connection_t *from) { bool receive_request(connection_t *c) { int request; - cp(); - if(sscanf(c->buffer, "%d", &request) == 1) { if((request < 0) || (request >= LAST) || !request_handlers[request]) { ifdebug(META) @@ -179,8 +173,6 @@ static int past_request_compare(const past_request_t *a, const past_request_t *b } static void free_past_request(past_request_t *r) { - cp(); - if(r->request) free(r->request); @@ -188,22 +180,16 @@ static void free_past_request(past_request_t *r) { } void init_requests(void) { - cp(); - past_request_tree = avl_alloc_tree((avl_compare_t) past_request_compare, (avl_action_t) free_past_request); } void exit_requests(void) { - cp(); - avl_delete_tree(past_request_tree); } bool seen_request(char *request) { past_request_t *new, p = {0}; - cp(); - p.request = request; if(avl_search(past_request_tree, &p)) { @@ -223,8 +209,6 @@ void age_past_requests(void) { past_request_t *p; int left = 0, deleted = 0; - cp(); - for(node = past_request_tree->head; node; node = next) { next = node->next; p = node->data; diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 5926a12..1c6df40 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -39,8 +39,6 @@ #include "xalloc.h" bool send_id(connection_t *c) { - cp(); - return send_request(c, "%d %s %d", ID, myself->connection->name, myself->connection->protocol_version); } @@ -48,8 +46,6 @@ bool send_id(connection_t *c) { bool id_h(connection_t *c) { char name[MAX_STRING_SIZE]; - cp(); - if(sscanf(c->buffer, "%*d " MAX_STRING " %d", name, &c->protocol_version) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ID", c->name, c->hostname); @@ -117,8 +113,6 @@ bool send_metakey(connection_t *c) { int len; bool x; - cp(); - len = RSA_size(c->rsa_key); /* Allocate buffers for the meta key */ @@ -129,7 +123,7 @@ bool send_metakey(connection_t *c) { if(!c->outctx) c->outctx = xmalloc_and_zero(sizeof(*c->outctx)); - cp(); + /* Copy random data to the buffer */ RAND_pseudo_bytes((unsigned char *)c->outkey, len); @@ -201,8 +195,6 @@ bool metakey_h(connection_t *c) { int cipher, digest, maclength, compression; int len; - cp(); - if(sscanf(c->buffer, "%*d %d %d %d %d " MAX_STRING, &cipher, &digest, &maclength, &compression, buffer) != 5) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "METAKEY", c->name, c->hostname); @@ -298,8 +290,6 @@ bool send_challenge(connection_t *c) { char *buffer; int len; - cp(); - /* CHECKME: what is most reasonable value for len? */ len = RSA_size(c->rsa_key); @@ -328,8 +318,6 @@ bool challenge_h(connection_t *c) { char buffer[MAX_STRING_SIZE]; int len; - cp(); - if(sscanf(c->buffer, "%*d " MAX_STRING, buffer) != 1) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHALLENGE", c->name, c->hostname); @@ -365,8 +353,6 @@ bool send_chal_reply(connection_t *c) { char hash[EVP_MAX_MD_SIZE * 2 + 1]; EVP_MD_CTX ctx; - cp(); - /* Calculate the hash from the challenge we received */ if(!EVP_DigestInit(&ctx, c->indigest) @@ -392,8 +378,6 @@ bool chal_reply_h(connection_t *c) { char myhash[EVP_MAX_MD_SIZE]; EVP_MD_CTX ctx; - cp(); - if(sscanf(c->buffer, "%*d " MAX_STRING, hishash) != 1) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHAL_REPLY", c->name, c->hostname); @@ -453,8 +437,6 @@ bool send_ack(connection_t *c) { struct timeval now; bool choice; - cp(); - /* Estimate weight */ gettimeofday(&now, NULL); @@ -515,8 +497,6 @@ bool ack_h(connection_t *c) { long int options; node_t *n; - cp(); - if(sscanf(c->buffer, "%*d " MAX_STRING " %d %lx", hisport, &weight, &options) != 3) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name, c->hostname); @@ -571,7 +551,6 @@ bool ack_h(connection_t *c) { /* Create an edge_t for this connection */ c->edge = new_edge(); - cp(); c->edge->from = myself; c->edge->to = n; sockaddr2str(&c->address, &hisaddress, &dummy); diff --git a/src/protocol_edge.c b/src/protocol_edge.c index 6fa9dee..03a91ba 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -39,8 +39,6 @@ bool send_add_edge(connection_t *c, const edge_t *e) { bool x; char *address, *port; - cp(); - sockaddr2str(&e->address, &address, &port); x = send_request(c, "%d %x %s %s %s %s %lx %d", ADD_EDGE, rand(), @@ -63,8 +61,6 @@ bool add_edge_h(connection_t *c) { long int options; int weight; - cp(); - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING" "MAX_STRING" "MAX_STRING" %lx %d", from_name, to_name, to_address, to_port, &options, &weight) != 6) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_EDGE", c->name, @@ -172,8 +168,6 @@ bool add_edge_h(connection_t *c) { } bool send_del_edge(connection_t *c, const edge_t *e) { - cp(); - return send_request(c, "%d %x %s %s", DEL_EDGE, rand(), e->from->name, e->to->name); } @@ -184,8 +178,6 @@ bool del_edge_h(connection_t *c) { char to_name[MAX_STRING_SIZE]; node_t *from, *to; - cp(); - if(sscanf(c->buffer, "%*d %*x "MAX_STRING" "MAX_STRING, from_name, to_name) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_EDGE", c->name, c->hostname); diff --git a/src/protocol_key.c b/src/protocol_key.c index cd95d9c..8517411 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -37,8 +37,6 @@ bool mykeyused = false; bool send_key_changed() { - cp(); - /* Only send this message if some other daemon requested our key previously. This reduces unnecessary key_changed broadcasts. */ @@ -53,8 +51,6 @@ bool key_changed_h(connection_t *c) { char name[MAX_STRING_SIZE]; node_t *n; - cp(); - if(sscanf(c->buffer, "%*d %*x " MAX_STRING, name) != 1) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "KEY_CHANGED", c->name, c->hostname); @@ -84,8 +80,6 @@ bool key_changed_h(connection_t *c) { } bool send_req_key(node_t *to) { - cp(); - return send_request(to->nexthop->connection, "%d %s %s", REQ_KEY, myself->name, to->name); } @@ -94,8 +88,6 @@ bool req_key_h(connection_t *c) { char to_name[MAX_STRING_SIZE]; node_t *from, *to; - cp(); - if(sscanf(c->buffer, "%*d " MAX_STRING " " MAX_STRING, from_name, to_name) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "REQ_KEY", c->name, c->hostname); @@ -141,8 +133,6 @@ bool req_key_h(connection_t *c) { bool send_ans_key(node_t *to) { char *key; - cp(); - // Set key parameters to->incipher = myself->incipher; to->inkeylength = myself->inkeylength; @@ -182,8 +172,6 @@ bool ans_key_h(connection_t *c) { int cipher, digest, maclength, compression; node_t *from, *to; - cp(); - if(sscanf(c->buffer, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d", from_name, to_name, key, &cipher, &digest, &maclength, &compression) != 7) { diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 5499b34..8a536e3 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -34,8 +34,6 @@ int maxoutbufsize = 0; /* Status and error notification routines */ bool send_status(connection_t *c, int statusno, const char *statusstring) { - cp(); - if(!statusstring) statusstring = "Status"; @@ -46,8 +44,6 @@ bool status_h(connection_t *c) { int statusno; char statusstring[MAX_STRING_SIZE]; - cp(); - if(sscanf(c->buffer, "%*d %d " MAX_STRING, &statusno, statusstring) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "STATUS", c->name, c->hostname); @@ -61,8 +57,6 @@ bool status_h(connection_t *c) { } bool send_error(connection_t *c, int err, const char *errstring) { - cp(); - if(!errstring) errstring = "Error"; @@ -73,8 +67,6 @@ bool error_h(connection_t *c) { int err; char errorstring[MAX_STRING_SIZE]; - cp(); - if(sscanf(c->buffer, "%*d %d " MAX_STRING, &err, errorstring) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ERROR", c->name, c->hostname); @@ -90,22 +82,16 @@ bool error_h(connection_t *c) { } bool send_termreq(connection_t *c) { - cp(); - return send_request(c, "%d", TERMREQ); } bool termreq_h(connection_t *c) { - cp(); - terminate_connection(c, c->status.active); return true; } bool send_ping(connection_t *c) { - cp(); - c->status.pinged = true; c->last_ping_time = now; @@ -113,20 +99,14 @@ bool send_ping(connection_t *c) { } bool ping_h(connection_t *c) { - cp(); - return send_pong(c); } bool send_pong(connection_t *c) { - cp(); - return send_request(c, "%d", PONG); } bool pong_h(connection_t *c) { - cp(); - c->status.pinged = false; /* Succesful connection, reset timeout if this is an outgoing connection. */ @@ -140,8 +120,6 @@ bool pong_h(connection_t *c) { /* Sending and receiving packets via TCP */ bool send_tcppacket(connection_t *c, vpn_packet_t *packet) { - cp(); - /* If there already is a lot of data in the outbuf buffer, discard this packet. We use a very simple Random Early Drop algorithm. */ @@ -157,8 +135,6 @@ bool send_tcppacket(connection_t *c, vpn_packet_t *packet) { bool tcppacket_h(connection_t *c) { short int len; - cp(); - if(sscanf(c->buffer, "%*d %hd", &len) != 1) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, c->hostname); diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index c6c0187..cdfcb6d 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -35,8 +35,6 @@ bool send_add_subnet(connection_t *c, const subnet_t *subnet) { char netstr[MAXNETSTR]; - cp(); - if(!net2str(netstr, sizeof netstr, subnet)) return false; @@ -49,8 +47,6 @@ bool add_subnet_h(connection_t *c) { node_t *owner; subnet_t s = {0}, *new; - cp(); - if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ADD_SUBNET", c->name, c->hostname); @@ -152,8 +148,6 @@ bool add_subnet_h(connection_t *c) { bool send_del_subnet(connection_t *c, const subnet_t *s) { char netstr[MAXNETSTR]; - cp(); - if(!net2str(netstr, sizeof netstr, s)) return false; @@ -166,8 +160,6 @@ bool del_subnet_h(connection_t *c) { node_t *owner; subnet_t s = {0}, *find; - cp(); - if(sscanf(c->buffer, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) { logger(LOG_ERR, _("Got bad %s from %s (%s)"), "DEL_SUBNET", c->name, c->hostname); diff --git a/src/raw_socket/device.c b/src/raw_socket/device.c index 5cefbce..e52097e 100644 --- a/src/raw_socket/device.c +++ b/src/raw_socket/device.c @@ -42,8 +42,6 @@ bool setup_device(void) { struct ifreq ifr; struct sockaddr_ll sa; - cp(); - if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) iface = xstrdup("eth0"); @@ -83,8 +81,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - close(device_fd); free(device); @@ -94,8 +90,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - if((lenin = read(device_fd, packet->data, MTU)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); @@ -113,8 +107,6 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -130,8 +122,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/route.c b/src/route.c index 6cc2fc1..7538bec 100644 --- a/src/route.c +++ b/src/route.c @@ -104,8 +104,6 @@ static void learn_mac(mac_t *address) { avl_node_t *node; connection_t *c; - cp(); - subnet = lookup_subnet_mac(address); /* If we don't know this MAC address yet, store it */ @@ -139,8 +137,6 @@ void age_subnets(void) { connection_t *c; avl_node_t *node, *next, *node2; - cp(); - for(node = myself->subnet_tree->head; node; node = next) { next = node->next; s = node->data; @@ -175,8 +171,6 @@ static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, uint8_t if(ratelimit(3)) return; - cp(); - /* Swap Ethernet source and destination addresses */ swap_mac_addresses(packet); @@ -246,8 +240,6 @@ static void fragment_ipv4_packet(node_t *dest, vpn_packet_t *packet) { uint8_t *offset; uint16_t ip_off, origf; - cp(); - memcpy(&ip, packet->data + ether_size, ip_size); fragment.priority = packet->priority; @@ -294,8 +286,6 @@ static void route_ipv4_unicast(node_t *source, vpn_packet_t *packet) { node_t *via; ipv4_t dest; - cp(); - memcpy(&dest, &packet->data[30], sizeof dest); subnet = lookup_subnet_ipv4(&dest); @@ -340,8 +330,6 @@ static void route_ipv4_unicast(node_t *source, vpn_packet_t *packet) { } static void route_ipv4(node_t *source, vpn_packet_t *packet) { - cp(); - if(!checklength(source, packet, ether_size + ip_size)) return; @@ -372,8 +360,6 @@ static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, uint8_t if(ratelimit(3)) return; - cp(); - /* Swap Ethernet source and destination addresses */ swap_mac_addresses(packet); @@ -442,8 +428,6 @@ static void route_ipv6_unicast(node_t *source, vpn_packet_t *packet) { node_t *via; ipv6_t dest; - cp(); - memcpy(&dest, &packet->data[38], sizeof dest); subnet = lookup_subnet_ipv6(&dest); @@ -500,8 +484,6 @@ static void route_neighborsol(node_t *source, vpn_packet_t *packet) { uint32_t next; } pseudo; - cp(); - if(!checklength(source, packet, ether_size + ip6_size + ns_size)) return; @@ -627,8 +609,6 @@ static void route_neighborsol(node_t *source, vpn_packet_t *packet) { } static void route_ipv6(node_t *source, vpn_packet_t *packet) { - cp(); - if(!checklength(source, packet, ether_size + ip6_size)) return; @@ -650,8 +630,6 @@ static void route_arp(node_t *source, vpn_packet_t *packet) { subnet_t *subnet; struct in_addr addr; - cp(); - if(!checklength(source, packet, ether_size + arp_size)) return; @@ -715,9 +693,6 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { subnet_t *subnet; mac_t dest; - cp(); - - /* Learn source address */ if(source == myself) { @@ -766,10 +741,7 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { send_packet(subnet->owner, packet); } - void route(node_t *source, vpn_packet_t *packet) { - cp(); - if(!checklength(source, packet, ether_size)) return; diff --git a/src/solaris/device.c b/src/solaris/device.c index 71d9bda..f1d648d 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -46,8 +46,6 @@ bool setup_device(void) { int ppa; char *ptr; - cp(); - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) device = xstrdup(DEFAULT_DEVICE); @@ -107,8 +105,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - close(device_fd); free(device); @@ -118,8 +114,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) { logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info, device, strerror(errno)); @@ -153,8 +147,6 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - cp(); - ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Writing packet of %d bytes to %s"), packet->len, device_info); @@ -170,8 +162,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); diff --git a/src/subnet.c b/src/subnet.c index fa1ee63..db7aeb1 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -130,7 +130,6 @@ int subnet_compare(const subnet_t *a, const subnet_t *b) { default: logger(LOG_ERR, _("subnet_compare() was called with unknown subnet type %d, exitting!"), a->type); - cp_trace(); exit(0); } @@ -140,50 +139,36 @@ int subnet_compare(const subnet_t *a, const subnet_t *b) { /* Initialising trees */ void init_subnets(void) { - cp(); - subnet_tree = avl_alloc_tree((avl_compare_t) subnet_compare, (avl_action_t) free_subnet); subnet_cache_flush(); } void exit_subnets(void) { - cp(); - avl_delete_tree(subnet_tree); } avl_tree_t *new_subnet_tree(void) { - cp(); - return avl_alloc_tree((avl_compare_t) subnet_compare, NULL); } void free_subnet_tree(avl_tree_t *subnet_tree) { - cp(); - avl_delete_tree(subnet_tree); } /* Allocating and freeing space for subnets */ subnet_t *new_subnet(void) { - cp(); - return xmalloc_and_zero(sizeof(subnet_t)); } void free_subnet(subnet_t *subnet) { - cp(); - free(subnet); } /* Adding and removing subnets */ void subnet_add(node_t *n, subnet_t *subnet) { - cp(); - subnet->owner = n; avl_insert(subnet_tree, subnet); @@ -193,8 +178,6 @@ void subnet_add(node_t *n, subnet_t *subnet) { } void subnet_del(node_t *n, subnet_t *subnet) { - cp(); - avl_delete(n->subnet_tree, subnet); avl_delete(subnet_tree, subnet); @@ -208,8 +191,6 @@ bool str2net(subnet_t *subnet, const char *subnetstr) { uint16_t x[8]; int weight = 10; - cp(); - if(sscanf(subnetstr, "%hu.%hu.%hu.%hu/%d#%d", &x[0], &x[1], &x[2], &x[3], &l, &weight) >= 5) { if(l < 0 || l > 32) @@ -285,8 +266,6 @@ bool str2net(subnet_t *subnet, const char *subnetstr) { } 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; @@ -332,7 +311,6 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { logger(LOG_ERR, _("net2str() was called with unknown subnet type %d, exiting!"), subnet->type); - cp_trace(); exit(0); } @@ -342,16 +320,12 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { /* Subnet lookup routines */ subnet_t *lookup_subnet(const node_t *owner, const subnet_t *subnet) { - cp(); - return avl_search(owner->subnet_tree, subnet); } subnet_t *lookup_subnet_mac(const mac_t *address) { subnet_t *p, subnet = {0}; - cp(); - subnet.type = SUBNET_MAC; subnet.net.mac.address = *address; subnet.owner = NULL; @@ -366,8 +340,6 @@ subnet_t *lookup_subnet_ipv4(const ipv4_t *address) { avl_node_t *n; int i; - cp(); - // Check if this address is cached for(i = 0; i < 2; i++) { @@ -412,8 +384,6 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address) { avl_node_t *n; int i; - cp(); - // Check if this address is cached for(i = 0; i < 2; i++) { @@ -525,8 +495,6 @@ void dump_subnets(void) { subnet_t *subnet; avl_node_t *node; - cp(); - logger(LOG_DEBUG, _("Subnet list:")); for(node = subnet_tree->head; node; node = node->next) { diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c index fa46f65..aaaab44 100644 --- a/src/uml_socket/device.c +++ b/src/uml_socket/device.c @@ -65,8 +65,6 @@ bool setup_device(void) { } name; struct timeval tv; - cp(); - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) xasprintf(&device, LOCALSTATEDIR "/run/%s.umlsocket", identname); @@ -152,8 +150,6 @@ bool setup_device(void) { } void close_device(void) { - cp(); - if(listen_fd >= 0) close(listen_fd); @@ -175,8 +171,6 @@ void close_device(void) { bool read_packet(vpn_packet_t *packet) { int lenin; - cp(); - switch(state) { case 0: { struct sockaddr sa; @@ -253,8 +247,6 @@ bool read_packet(vpn_packet_t *packet) { } bool write_packet(vpn_packet_t *packet) { - cp(); - if(state != 2) { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Dropping packet of %d bytes to %s: not connected to UML yet"), packet->len, device_info); @@ -279,8 +271,6 @@ bool write_packet(vpn_packet_t *packet) { } void dump_device_stats(void) { - cp(); - logger(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device); logger(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in); logger(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out); -- 2.25.1