mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-31 00:23:50 +00:00
Only allow abreviated SID's in route announcements
This commit is contained in:
parent
4b2b8f1783
commit
4658251ebe
@ -522,7 +522,7 @@ int overlay_address_parse(struct decode_context *context, struct overlay_buffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we must assume that we wont be able to understand the rest of the packet
|
// we must assume that we wont be able to understand the rest of the packet
|
||||||
if (code<=0x0f)
|
if (code<=0x0f || context->abbreviations_only)
|
||||||
return WHYF("Unsupported abbreviation code %d", code);
|
return WHYF("Unsupported abbreviation code %d", code);
|
||||||
|
|
||||||
return find_subscr_buffer(context, b, -1, SID_SIZE,1,subscriber);
|
return find_subscr_buffer(context, b, -1, SID_SIZE,1,subscriber);
|
||||||
|
@ -108,6 +108,7 @@ struct broadcast{
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct decode_context{
|
struct decode_context{
|
||||||
|
int abbreviations_only;
|
||||||
int invalid_addresses;
|
int invalid_addresses;
|
||||||
struct overlay_frame *please_explain;
|
struct overlay_frame *please_explain;
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,8 @@ int add_advertisement(struct subscriber *subscriber, void *context){
|
|||||||
|
|
||||||
if (subscriber->node){
|
if (subscriber->node){
|
||||||
overlay_node *n=subscriber->node;
|
overlay_node *n=subscriber->node;
|
||||||
|
// never send the full sid in an advertisement
|
||||||
|
subscriber->send_full=0;
|
||||||
if (overlay_address_append(e,subscriber) ||
|
if (overlay_address_append(e,subscriber) ||
|
||||||
ob_append_byte(e,n->best_link_score) ||
|
ob_append_byte(e,n->best_link_score) ||
|
||||||
ob_append_byte(e,n->observations[n->best_observation].gateways_en_route)){
|
ob_append_byte(e,n->observations[n->best_observation].gateways_en_route)){
|
||||||
@ -181,7 +182,9 @@ int overlay_route_add_advertisements(overlay_interface *interface, struct overla
|
|||||||
int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct decode_context *context, time_ms_t now)
|
int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct decode_context *context, time_ms_t now)
|
||||||
{
|
{
|
||||||
IN();
|
IN();
|
||||||
while(f->payload->position < f->payload->sizeLimit)
|
context->abbreviations_only=1;
|
||||||
|
// minimum record length is (address code, 3 byte sid, score, gateways)
|
||||||
|
while(f->payload->position +6 <= f->payload->sizeLimit)
|
||||||
{
|
{
|
||||||
struct subscriber *subscriber;
|
struct subscriber *subscriber;
|
||||||
context->invalid_addresses=0;
|
context->invalid_addresses=0;
|
||||||
@ -216,6 +219,6 @@ int overlay_route_saw_advertisements(int i, struct overlay_frame *f, struct deco
|
|||||||
score,gateways_en_route);
|
score,gateways_en_route);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
context->abbreviations_only=0;
|
||||||
RETURN(0);;
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user