X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_packet.c;h=81d759a6f7951d1d25f25a2d6151cfa33a3c01fb;hp=725789de721b0461829fed5342f5a70fdc1d5c67;hb=c2b738e7b51fbec2b11fbbf030b9a5a36df55fc4;hpb=80ea653e8d8050878380fbc1446571cbaf578297 diff --git a/src/net_packet.c b/src/net_packet.c index 725789de..81d759a6 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.5 2002/02/26 23:26:41 guus Exp $ + $Id: net_packet.c,v 1.1.2.6 2002/03/01 12:26:56 guus Exp $ */ #include "config.h" @@ -190,6 +190,8 @@ void send_udppacket(node_t *n, vpn_packet_t *inpkt) long int complen = MTU + 12; EVP_CIPHER_CTX ctx; vpn_packet_t *copy; + static int priority = 0; + int origpriority; cp if(!n->status.validkey) { @@ -212,6 +214,7 @@ cp } origlen = inpkt->len; + origpriority = inpkt->priority; /* Compress the packet */ @@ -258,6 +261,15 @@ cp /* Send the packet */ + if(priorityinheritance && origpriority != priority) + { + priority = origpriority; + if(debug_lvl >= DEBUG_TRAFFIC) + syslog(LOG_DEBUG, _("Setting outgoing packet priority to %d"), priority); + if(setsockopt(udp_socket[0], SOL_IP, IP_TOS, &priority, sizeof(priority))) /* SO_PRIORITY doesn't seem to work */ + syslog(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", strerror(errno)); + } + if((sendto(udp_socket[0], (char *)&inpkt->seqno, inpkt->len, 0, &(n->address.sa), SALEN(n->address.sa))) < 0) { syslog(LOG_ERR, _("Error sending packet to %s (%s): %s"), @@ -362,7 +374,8 @@ cp { syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%s"), __FILE__, __LINE__, sock, strerror(errno)); - return; + cp_trace(); + exit(1); } if(x) {