X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_packet.c;h=aa5bea3415750f07bd3ded17b7563bc92d28a353;hp=e858daa06e1aa2dc238d186749342d2a4269d0f4;hb=b4c913aaa926d80a72aeb97459f84f992b65d1ed;hpb=e449d94caef963809d417f16497f6f978e10d731 diff --git a/src/net_packet.c b/src/net_packet.c index e858daa0..aa5bea34 100644 --- a/src/net_packet.c +++ b/src/net_packet.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_packet.c,v 1.1.2.34 2003/07/17 15:06:26 guus Exp $ + $Id: net_packet.c,v 1.1.2.37 2003/08/08 19:42:35 guus Exp $ */ #include "system.h" @@ -239,7 +239,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *inpkt) if(!n->status.waitingforkey) send_req_key(n->nexthop->connection, myself, n); - n->status.waitingforkey = 1; + n->status.waitingforkey = true; return; } @@ -306,14 +306,12 @@ static void send_udppacket(node_t *n, vpn_packet_t *inpkt) priority = origpriority; ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Setting outgoing packet priority to %d"), priority); if(setsockopt(listen_socket[sock].udp, SOL_IP, IP_TOS, &priority, sizeof(priority))) /* SO_PRIORITY doesn't seem to work */ - logger(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", - strerror(errno)); + logger(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", strerror(errno)); } #endif if((sendto(listen_socket[sock].udp, (char *) &inpkt->seqno, inpkt->len, 0, &(n->address.sa), SALEN(n->address.sa))) < 0) { - logger(LOG_ERR, _("Error sending packet to %s (%s): %s"), n->name, - n->hostname, strerror(errno)); + logger(LOG_ERR, _("Error sending packet to %s (%s): %s"), n->name, n->hostname, strerror(errno)); return; } @@ -323,7 +321,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *inpkt) /* send a packet to the given vpn ip. */ -void send_packet(node_t *n, vpn_packet_t *packet) +void send_packet(const node_t *n, vpn_packet_t *packet) { node_t *via; @@ -350,15 +348,15 @@ void send_packet(node_t *n, vpn_packet_t *packet) n->name, via->name, n->via->hostname); if((myself->options | via->options) & OPTION_TCPONLY) { - if(send_tcppacket(via->connection, packet)) - terminate_connection(via->connection, 1); + if(!send_tcppacket(via->connection, packet)) + terminate_connection(via->connection, true); } else send_udppacket(via, packet); } /* Broadcast a packet using the minimum spanning tree */ -void broadcast_packet(node_t *from, vpn_packet_t *packet) +void broadcast_packet(const node_t *from, vpn_packet_t *packet) { avl_node_t *node; connection_t *c;