diff --git a/mphlr.h b/mphlr.h index 2810a92d..82019fe3 100644 --- a/mphlr.h +++ b/mphlr.h @@ -772,7 +772,8 @@ int overlay_route_saw_selfannounce(int interface,overlay_frame *f,long long now) overlay_node *overlay_route_find_node(unsigned char *sid,int createP); unsigned int overlay_route_hash_sid(unsigned char *sid); int overlay_route_init(int mb_ram); -overlay_neighbour *overlay_route_get_neighbour_structure(unsigned char *packed_sid); +overlay_neighbour *overlay_route_get_neighbour_structure(unsigned char *packed_sid, + int createP); unsigned char *overlay_get_my_sid(); int overlay_frame_set_me_as_source(overlay_frame *f); int overlay_frame_set_neighbour_as_source(overlay_frame *f,overlay_neighbour *n); diff --git a/overlay_payload.c b/overlay_payload.c index 42518d9d..49d600ca 100644 --- a/overlay_payload.c +++ b/overlay_payload.c @@ -57,7 +57,7 @@ int overlay_frame_package_fmt1(overlay_frame *p,overlay_buffer *b) int fail=0; if (p->nexthop_address_status!=OA_RESOLVED) { - if (overlay_get_nexthop((unsigned char *)p->destination,p->nexthop,&nexthoplen)) fail++; + if (overlay_get_nexthop((unsigned char *)p->destination,p->nexthop,&nexthoplen,&p->nexthop_interface)) fail++; else p->nexthop_address_status=OA_RESOLVED; } diff --git a/overlay_route.c b/overlay_route.c index 7839928d..f6bb1c97 100644 --- a/overlay_route.c +++ b/overlay_route.c @@ -336,6 +336,7 @@ int overlay_route_init(int mb_ram) int overlay_get_nexthop(unsigned char *d,unsigned char *nexthop,int *nexthoplen, int *interface) { + int i; if (!overlay_neighbours) return 0; overlay_neighbour *neh=overlay_route_get_neighbour_structure(d,0 /* don't create if @@ -352,7 +353,7 @@ int overlay_get_nexthop(unsigned char *d,unsigned char *nexthop,int *nexthoplen, *interface=0; for(i=1;iscores[i]>neh->scores[*interface]) *interface=i; - if (neg->scores[*interface]<1) return WHY("No open path to node"); + if (neh->scores[*interface]<1) return WHY("No open path to node"); return 0; } else { /* Is not a direct neighbour */ @@ -629,7 +630,7 @@ int overlay_route_saw_selfannounce(int interface,overlay_frame *f,long long now) { unsigned int s1,s2; unsigned char sender_interface; - overlay_neighbour *n=overlay_route_get_neighbour_structure(f->source); + overlay_neighbour *n=overlay_route_get_neighbour_structure(f->source,1 /* make neighbour if not yet one */); if (!n) return WHY("overlay_route_get_neighbour_structure() failed");