]> git.meshlink.io Git - meshlink/blobdiff - src/route.c
Merge branch 'master' into 1.1
[meshlink] / src / route.c
index fd0c697d77b8d57d9603efd291f45f2072603ac7..3c0cf5b5b3a0d7aedc02807da006d46f26dbcc1a 100644 (file)
@@ -136,13 +136,12 @@ static void age_subnets(int fd, short events, void *data) {
                event_add(&age_subnets_event, &(struct timeval){10, 0});
 }
 
-static void learn_mac(mac_t *address)
-{
+static void learn_mac(mac_t *address) {
        subnet_t *subnet;
        splay_node_t *node;
        connection_t *c;
 
-       subnet = lookup_subnet_mac(address);
+       subnet = lookup_subnet_mac(myself, address);
 
        /* If we don't know this MAC address yet, store it */
 
@@ -155,6 +154,7 @@ static void learn_mac(mac_t *address)
                subnet->type = SUBNET_MAC;
                subnet->expires = time(NULL) + macexpire;
                subnet->net.mac.address = *address;
+               subnet->weight = 10;
                subnet_add(myself, subnet);
 
                /* And tell all other tinc daemons it's our MAC */
@@ -720,7 +720,7 @@ static void route_mac(node_t *source, vpn_packet_t *packet) {
        /* Lookup destination address */
 
        memcpy(&dest, &packet->data[0], sizeof dest);
-       subnet = lookup_subnet_mac(&dest);
+       subnet = lookup_subnet_mac(NULL, &dest);
 
        if(!subnet) {
                broadcast_packet(source, packet);