diff --git a/overlay.c b/overlay.c index 54f80529..23c7d00f 100644 --- a/overlay.c +++ b/overlay.c @@ -231,6 +231,12 @@ int overlay_frame_process(int interface,overlay_frame *f) if (debug&DEBUG_OVERLAYFRAMES) WHY("Source address could not be resolved, so dropping frame."); return -1; } + if (overlay_address_is_local(f->source)) + { + if (debug&DEBUG_OVERLAYROUTING) + WHY("Dropping frame claiming to come from myself."); + return -1; + } if (f->destination_address_status==OA_RESOLVED) { for(i=0;idestination[i]!=0xff) break; diff --git a/overlay_buffer.c b/overlay_buffer.c index 7f108e4d..9055ab6c 100644 --- a/overlay_buffer.c +++ b/overlay_buffer.c @@ -74,7 +74,10 @@ int ob_unlimitsize(overlay_buffer *b) int ob_makespace(overlay_buffer *b,int bytes) { if (b->sizeLimit!=-1) { - if (b->length+bytes>b->sizeLimit) return WHY("Asked to make space beyond size limit"); + if (b->length+bytes>b->sizeLimit) { + if (debug&DEBUG_PACKETFORMATS) WHY("Asked to make space beyond size limit"); + return -1; + } } if (b->length+bytes>=b->allocSize) { diff --git a/overlay_payload.c b/overlay_payload.c index 2798311a..f9fdedc3 100644 --- a/overlay_payload.c +++ b/overlay_payload.c @@ -140,7 +140,9 @@ int overlay_frame_package_fmt1(overlay_frame *p,overlay_buffer *b) if (ob_makespace(b,2+headers->length+p->payload->length)) { /* Not enough space free in output buffer */ ob_free(headers); - return WHY("Could not make enough space free in output buffer"); + if (debug&DEBUG_PACKETFORMATS) + WHY("Could not make enough space free in output buffer"); + return -1; } /* Package up headers and payload */ diff --git a/overlay_route.c b/overlay_route.c index ee92ee24..1b9eccc8 100644 --- a/overlay_route.c +++ b/overlay_route.c @@ -972,6 +972,18 @@ int overlay_route_saw_selfannounce_ack(int interface,overlay_frame *f,long long int overlay_route_record_link(long long now,unsigned char *to,unsigned char *via,unsigned int timestamp,int score,int gateways_en_route) { + int i,slot=-1; + + /* Don't record routes to ourselves */ + if (overlay_address_is_local(to)) return 0; + + for(i=0;i