mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-19 16:20:53 +00:00
More work towards getting selfannounce acks (and other packet types)
forwarding out.
This commit is contained in:
parent
8ed86bfd89
commit
b402aba22d
3
mphlr.h
3
mphlr.h
@ -611,7 +611,8 @@ int overlay_check_ticks();
|
||||
int overlay_add_selfannouncement();
|
||||
int overlay_frame_package_fmt1(overlay_frame *p,overlay_buffer *b);
|
||||
int overlay_interface_args(char *arg);
|
||||
int overlay_get_nexthop(unsigned char *final_destination,unsigned char *nexthop,int *nexthoplen);
|
||||
int overlay_get_nexthop(unsigned char *d,unsigned char *nexthop,int *nexthoplen,
|
||||
int *interface);
|
||||
|
||||
extern int overlay_interface_count;
|
||||
|
||||
|
@ -209,13 +209,13 @@ int overlay_frame_process(int interface,overlay_frame *f)
|
||||
if (((!ultimatelyForMe)||broadcast)&&(f->ttl>1))
|
||||
{
|
||||
/* Yes, it is. */
|
||||
int len=0;
|
||||
int len=0;
|
||||
|
||||
if (broadcast&&(f->type==OF_TYPE_SELFANNOUNCE)) {
|
||||
// Don't forward broadcast self-announcement packets as that is O(n^2) with
|
||||
// traffic. We have other means to propagating the mesh topology information.
|
||||
} else {
|
||||
if (overlay_get_nexthop(f->destination,f->nexthop,&len))
|
||||
if (overlay_get_nexthop(f->destination,f->nexthop,&len,&f->nexthop_interface))
|
||||
return WHY("Could not find next hop for host - dropping frame");
|
||||
f->ttl--;
|
||||
|
||||
|
@ -333,11 +333,30 @@ int overlay_route_init(int mb_ram)
|
||||
nodes that are only indirectly connected. Indeed, the two are somewhat interconnected as
|
||||
an indirect route may be required to get a self-announce ack back to the sender.
|
||||
*/
|
||||
int overlay_get_nexthop(unsigned char *d,unsigned char *nexthop,int *nexthoplen)
|
||||
int overlay_get_nexthop(unsigned char *d,unsigned char *nexthop,int *nexthoplen,
|
||||
int *interface)
|
||||
{
|
||||
if (!overlay_neighbours) return 0;
|
||||
|
||||
|
||||
overlay_neighbour *neh=overlay_route_get_neighbour_structure(d,0 /* don't create if
|
||||
missing */);
|
||||
|
||||
if (neh) {
|
||||
/* Is a direct neighbour.
|
||||
So in the absence of any better indirect route, we pick the interface that
|
||||
we can hear this neighbour on the most reliably, and then send the frame
|
||||
via that interface and directly addressed to the recipient. */
|
||||
bcopy(d,nexthop,SID_SIZE);
|
||||
(*nexthoplen)=SID_SIZE;
|
||||
|
||||
*interface=0;
|
||||
for(i=1;i<OVERLAY_MAX_INTERFACES;i++)
|
||||
if (neh->scores[i]>neh->scores[*interface]) *interface=i;
|
||||
if (neg->scores[*interface]<1) return WHY("No open path to node");
|
||||
return 0;
|
||||
} else {
|
||||
/* Is not a direct neighbour */
|
||||
}
|
||||
|
||||
return WHY("Not implemented");
|
||||
}
|
||||
@ -530,9 +549,10 @@ int overlay_route_make_neighbour(overlay_node *n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
overlay_neighbour *overlay_route_get_neighbour_structure(unsigned char *packed_sid)
|
||||
overlay_neighbour *overlay_route_get_neighbour_structure(unsigned char *packed_sid,
|
||||
int createP)
|
||||
{
|
||||
overlay_node *n=overlay_route_find_node(packed_sid,1 /* create if necessary */);
|
||||
overlay_node *n=overlay_route_find_node(packed_sid,createP);
|
||||
if (!n) { WHY("Could not find node record for observed node"); return NULL; }
|
||||
|
||||
/* Check if node is already a neighbour, or if not, make it one */
|
||||
|
Loading…
x
Reference in New Issue
Block a user