mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-23 23:12:31 +00:00
Fixed broadcast address and BPI handling for address abbreviation
and propagation.
This commit is contained in:
parent
283b29af6b
commit
7928de5b01
@ -245,6 +245,14 @@ int overlay_abbreviate_address(unsigned char *in,unsigned char *out,int *ofs)
|
|||||||
for(i=0;i<SID_SIZE;i++) if (in[i]!=overlay_abbreviate_previous_address.b[i]) break;
|
for(i=0;i<SID_SIZE;i++) if (in[i]!=overlay_abbreviate_previous_address.b[i]) break;
|
||||||
if (i==SID_SIZE) { out[(*ofs)++]=OA_CODE_PREVIOUS; return 0; }
|
if (i==SID_SIZE) { out[(*ofs)++]=OA_CODE_PREVIOUS; return 0; }
|
||||||
|
|
||||||
|
/* Is it a broadcast address? */
|
||||||
|
if (overlay_address_is_broadcast(in)) {
|
||||||
|
/* write broadcast code followed by 64bit BPI tail */
|
||||||
|
out[(*ofs)++]=OA_CODE_BROADCAST;
|
||||||
|
for(i=0;i<8;i++) out[(*ofs)++]=in[24+i];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!abbrs) {
|
if (!abbrs) {
|
||||||
// Abbreviation table not setup, so allocate it.
|
// Abbreviation table not setup, so allocate it.
|
||||||
// Epoch starts at zero.
|
// Epoch starts at zero.
|
||||||
|
@ -84,7 +84,8 @@ int overlay_frame_package_fmt1(overlay_frame *p,overlay_buffer *b)
|
|||||||
if (overlay_broadcast_drop_check(p->destination))
|
if (overlay_broadcast_drop_check(p->destination))
|
||||||
return WHY("This broadcast packet ID has been seen recently");
|
return WHY("This broadcast packet ID has been seen recently");
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<SID_SIZE;i++) p->nexthop[i]=0xff;
|
/* Copy the broadcast address exactly so that we preserve the BPI */
|
||||||
|
for(i=0;i<SID_SIZE;i++) p->nexthop[i]=p->destination[i];
|
||||||
p->nexthop_address_status=OA_RESOLVED;
|
p->nexthop_address_status=OA_RESOLVED;
|
||||||
} else {
|
} else {
|
||||||
if (overlay_get_nexthop((unsigned char *)p->destination,p->nexthop,&nexthoplen,&p->nexthop_interface)) {
|
if (overlay_get_nexthop((unsigned char *)p->destination,p->nexthop,&nexthoplen,&p->nexthop_interface)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user