X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Froute.c;h=00ba4c05b19a7a33f5ed978270ed3b24f99b8a7a;hb=b80cbaba040775ba20159b20d02c8c903c84e0e1;hp=7bb9996179e6de082fbb736deb2864ff4eb91b65;hpb=6bc5d626a8726fc23365ee705761a3c666a08ad4;p=tinc diff --git a/src/route.c b/src/route.c index 7bb99961..00ba4c05 100644 --- a/src/route.c +++ b/src/route.c @@ -1,7 +1,7 @@ /* route.c -- routing Copyright (C) 2000-2005 Ivo Timmermans, - 2000-2012 Guus Sliepen + 2000-2013 Guus Sliepen 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 @@ -229,7 +229,7 @@ static void learn_mac(mac_t *address) { subnet = new_subnet(); subnet->type = SUBNET_MAC; - subnet->expires = time(NULL) + macexpire; + subnet->expires = now.tv_sec + macexpire; subnet->net.mac.address = *address; subnet->weight = 10; subnet_add(myself, subnet); @@ -244,7 +244,7 @@ static void learn_mac(mac_t *address) { timeout_add(&age_subnets_timeout, age_subnets, NULL, &(struct timeval){10, rand() % 100000}); } else { if(subnet->expires) - subnet->expires = time(NULL) + macexpire; + subnet->expires = now.tv_sec + macexpire; } } @@ -835,6 +835,11 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { if(forwarding_mode == FMODE_OFF && source != myself && subnet->owner != myself) return; + 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]; + // Handle packets larger than PMTU node_t *via = (subnet->owner->via == myself) ? subnet->owner->nexthop : subnet->owner->via; @@ -844,7 +849,6 @@ static void route_mac(node_t *source, vpn_packet_t *packet) { if(via && packet->len > via->mtu && via != myself) { logger(DEBUG_TRAFFIC, LOG_INFO, "Packet for %s (%s) length %d larger than MTU %d", subnet->owner->name, subnet->owner->hostname, packet->len, via->mtu); - uint16_t type = packet->data[12] << 8 | packet->data[13]; length_t ethlen = 14; if(type == ETH_P_8021Q) {