From: Vittorio Gambaletta (VittGam) Date: Wed, 12 Oct 2016 11:52:17 +0000 (+0200) Subject: route: Support ToS/DiffServ priority inheritance when routing IPv6 packets. X-Git-Tag: release-1.1pre15~39 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3e643d5d7e5c7db35eacb3703d497c584e93cf18;p=oweals%2Ftinc.git route: Support ToS/DiffServ priority inheritance when routing IPv6 packets. Signed-off-by: Vittorio Gambaletta --- diff --git a/src/route.c b/src/route.c index 0c9f2aa..c10fddb 100644 --- a/src/route.c +++ b/src/route.c @@ -683,6 +683,9 @@ static void route_ipv6(node_t *source, vpn_packet_t *packet) { if(!do_decrement_ttl(source, packet)) return; + if(priorityinheritance) + packet->priority = ((DATA(packet)[14] & 0x0f) << 4) | (DATA(packet)[15] >> 4); + via = (subnet->owner->via == myself) ? subnet->owner->nexthop : subnet->owner->via; if(via == source) { @@ -954,8 +957,12 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { uint16_t type = DATA(packet)[12] << 8 | DATA(packet)[13]; - if(priorityinheritance && type == ETH_P_IP && packet->len >= ether_size + ip_size) - packet->priority = DATA(packet)[15]; + if(priorityinheritance) { + if(type == ETH_P_IP && packet->len >= ether_size + ip_size) + packet->priority = DATA(packet)[15]; + else if(type == ETH_P_IPV6 && packet->len >= ether_size + ip6_size) + packet->priority = ((DATA(packet)[14] & 0x0f) << 4) | (DATA(packet)[15] >> 4); + } // Handle packets larger than PMTU