X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Froute.c;h=50449897355ac97c28e1f24bf23adca247ec1023;hp=907197b8e85c6900299a0647dda1a79fe23419e9;hb=87438e342ce96b4321343c69b77ed84b16853785;hpb=1fd2208e444552c5009c13a2747fd89dda1dcbf5 diff --git a/src/route.c b/src/route.c index 907197b8..50449897 100644 --- a/src/route.c +++ b/src/route.c @@ -2,6 +2,7 @@ route.c -- routing Copyright (C) 2000-2005 Ivo Timmermans, 2000-2014 Guus Sliepen + 2015 Vittorio Gambaletta This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -674,6 +675,9 @@ static void route_ipv6_unicast(node_t *source, vpn_packet_t *packet) { if(!do_decrement_ttl(source, packet)) return; + if(priorityinheritance) + packet->priority = ((packet->data[14] & 0x0f) << 4) | (packet->data[15] >> 4); + via = (subnet->owner->via == myself) ? subnet->owner->nexthop : subnet->owner->via; if(via == source) { @@ -962,8 +966,12 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { uint16_t type = packet->data[12] << 8 | packet->data[13]; - if(priorityinheritance && type == ETH_P_IP && packet->len >= ether_size + ip_size) - packet->priority = packet->data[15]; + if(priorityinheritance) { + if(type == ETH_P_IP && packet->len >= ether_size + ip_size) + packet->priority = packet->data[15]; + else if(type == ETH_P_IPV6 && packet->len >= ether_size + ip6_size) + packet->priority = ((packet->data[14] & 0x0f) << 4) | (packet->data[15] >> 4); + } // Handle packets larger than PMTU