diff --git a/mphlr.h b/mphlr.h index 83090dc6..b1c51745 100644 --- a/mphlr.h +++ b/mphlr.h @@ -901,4 +901,5 @@ int serval_packetvisualise(FILE *f,char *message,unsigned char *packet,int plen) int overlay_broadcast_drop_check(unsigned char *a); int overlay_address_is_broadcast(unsigned char *a); int overlay_broadcast_generate_address(unsigned char *a); +int overlay_abbreviate_unset_current_sender(); diff --git a/overlay_abbreviations.c b/overlay_abbreviations.c index b39165ea..a46d9b4e 100644 --- a/overlay_abbreviations.c +++ b/overlay_abbreviations.c @@ -131,6 +131,7 @@ sid overlay_abbreviate_previous_address={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, it on most occassions. */ sid overlay_abbreviate_current_sender={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; +int overlay_abbreviate_current_sender_set=0; int overlay_abbreviate_current_sender_id=-1; int overlay_abbreviate_prepare_cache() @@ -330,7 +331,7 @@ int overlay_abbreviate_expand_address(int interface,unsigned char *in,int *inofs used to encode the sender's address there ;) */ (*inofs)++; if (debug&DEBUG_OVERLAYABBREVIATIONS) fprintf(stderr,"Resolving OA_CODE_SELF.\n"); - if (overlay_abbreviate_current_sender_id>=0) { + if (overlay_abbreviate_current_sender_set) { bcopy(&overlay_abbreviate_current_sender.b[0],&out[*ofs],SID_SIZE); overlay_abbreviate_set_most_recent_address(&out[*ofs]); (*ofs)+=SID_SIZE; @@ -523,6 +524,13 @@ int overlay_abbreviate_set_current_sender(unsigned char *in) { bcopy(in,&overlay_abbreviate_current_sender.b[0],SID_SIZE); overlay_abbreviate_current_sender_id=-1; + overlay_abbreviate_current_sender_set=1; + return 0; +} + +int overlay_abbreviate_unset_current_sender() +{ + overlay_abbreviate_current_sender_set=0; return 0; } diff --git a/overlay_packetformats.c b/overlay_packetformats.c index bd7f5c64..2a88c491 100644 --- a/overlay_packetformats.c +++ b/overlay_packetformats.c @@ -95,6 +95,9 @@ int packetOkOverlay(int interface,unsigned char *packet,int len,unsigned char *t f.payload=NULL; f.bytes=NULL; f.bytecount=0; + f.prev=NULL; f.next=NULL; + + overlay_abbreviate_unset_current_sender(); /* Skip magic bytes and version */ for(ofs=4;ofsbytecount=%d\n",f->bytecount); + if (debug&DEBUG_RHIZOME) fprintf(stderr,"rhizome f->bytecount=%d\n", + f->payload->length); return WHY("Not implemented."); }