X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=266dbab7b7048199cc1d3bbae187d59846e7cab2;hp=2c08dcf2460e8e175e4867f3e6a37d1098645a1e;hb=4f9dad0972ac0f665a1b6050b059bd52f93e6221;hpb=428482d86f860d1fb09de722c1b6576ec2eef1ce diff --git a/src/net.c b/src/net.c index 2c08dcf2..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.110 2001/05/28 08:56:57 guus Exp $ + $Id: net.c,v 1.35.4.111 2001/06/05 16:09:55 guus Exp $ */ #include "config.h" @@ -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; @@ -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 */