X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=266dbab7b7048199cc1d3bbae187d59846e7cab2;hp=b0d3cd1ebd94ff4b4050be338b1591ed89b33a0e;hb=4f9dad0972ac0f665a1b6050b059bd52f93e6221;hpb=65247c063b36a76dd68156fe17b017c7460d982f diff --git a/src/net.c b/src/net.c index b0d3cd1e..266dbab7 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.109 2001/05/28 08:21:43 guus Exp $ + $Id: net.c,v 1.35.4.111 2001/06/05 16:09:55 guus Exp $ */ #include "config.h" @@ -26,7 +26,7 @@ #include #include #include -#ifndef HAVE_FREEBSD +#ifdef HAVE_LINUX #include #include #endif @@ -104,8 +104,6 @@ static int seconds_till_retry; int keylifetime = 0; int keyexpires = 0; -char *unknown = NULL; - void send_udppacket(connection_t *cl, vpn_packet_t *inpkt) { vpn_packet_t outpkt; @@ -261,6 +259,26 @@ cp send_udppacket(cl, packet); } +/* Broadcast a packet to all active connections */ + +void broadcast_packet(connection_t *from, vpn_packet_t *packet) +{ + avl_node_t *node; + connection_t *cl; +cp + if(debug_lvl >= DEBUG_TRAFFIC) + syslog(LOG_INFO, _("Broadcasting packet of %d bytes from %s (%s)"), + packet->len, from->name, from->hostname); + + for(node = connection_tree->head; node; node = node->next) + { + cl = (connection_t *)node->data; + if(cl->status.meta && cl != from) + send_packet(cl, packet); + } +cp +} + void flush_queue(connection_t *cl) { list_node_t *node, *next; @@ -385,7 +403,7 @@ cp option = 1; setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); setsockopt(nfd, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option)); -#ifndef HAVE_FREEBSD +#ifdef HAVE_LINUX setsockopt(nfd, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); option = IPTOS_LOWDELAY; @@ -515,7 +533,7 @@ cp option = 1; setsockopt(cl->meta_socket, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option)); -#ifndef HAVE_FREEBSD +#ifdef HAVE_LINUX setsockopt(cl->meta_socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); option = IPTOS_LOWDELAY; @@ -731,7 +749,7 @@ int setup_myself(void) cp myself = new_connection(); - asprintf(&myself->hostname, "MYSELF"); + asprintf(&myself->hostname, _("MYSELF")); myself->options = 0; myself->protocol_version = PROT_CURRENT; @@ -1011,7 +1029,7 @@ cp return NULL; } - p->name = unknown; + asprintf(&p->name, _("UNKNOWN")); p->address = ntohl(ci.sin_addr.s_addr); p->hostname = hostlookup(ci.sin_addr.s_addr); p->port = htons(ci.sin_port); /* This one will be overwritten later */