mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 06:03:12 +00:00
Fix ack's of seq numbers 32<x<64 old
This commit is contained in:
parent
e9cdb67b10
commit
2e618547c9
@ -378,9 +378,7 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
|
|||||||
|
|
||||||
link_add_destinations(frame);
|
link_add_destinations(frame);
|
||||||
|
|
||||||
if (frame->mdp_sequence == -1){
|
if(frame->mdp_sequence != -1 && ((mdp_sequence - frame->mdp_sequence)&0xFFFF) >= 64){
|
||||||
frame->mdp_sequence = mdp_sequence = (mdp_sequence+1)&0xFFFF;
|
|
||||||
}else if(((mdp_sequence - frame->mdp_sequence)&0xFFFF) >= 64){
|
|
||||||
// too late, we've sent too many packets for the next hop to correctly de-duplicate
|
// too late, we've sent too many packets for the next hop to correctly de-duplicate
|
||||||
if (config.debug.overlayframes)
|
if (config.debug.overlayframes)
|
||||||
DEBUGF("Retransmition of frame %p mdp seq %d, is too late to be de-duplicated",
|
DEBUGF("Retransmition of frame %p mdp seq %d, is too late to be de-duplicated",
|
||||||
@ -476,6 +474,10 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frame->mdp_sequence == -1){
|
||||||
|
frame->mdp_sequence = mdp_sequence = (mdp_sequence+1)&0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
char will_retransmit=1;
|
char will_retransmit=1;
|
||||||
if (frame->packet_version<1 || frame->resend<=0 || packet->seq==-1)
|
if (frame->packet_version<1 || frame->resend<=0 || packet->seq==-1)
|
||||||
will_retransmit=0;
|
will_retransmit=0;
|
||||||
|
21
route_link.c
21
route_link.c
@ -1167,14 +1167,19 @@ int link_received_duplicate(struct subscriber *subscriber, int payload_seq)
|
|||||||
|
|
||||||
int offset = (neighbour->mdp_ack_sequence - 1 - payload_seq)&0xFF;
|
int offset = (neighbour->mdp_ack_sequence - 1 - payload_seq)&0xFF;
|
||||||
if (offset < 64){
|
if (offset < 64){
|
||||||
if (neighbour->mdp_ack_mask & (1<<offset)){
|
if (neighbour->mdp_ack_mask & (1ull<<offset)){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
neighbour->mdp_ack_mask |= (1<<offset);
|
neighbour->mdp_ack_mask |= (1ull<<offset);
|
||||||
}else{
|
}else{
|
||||||
int offset = (payload_seq - neighbour->mdp_ack_sequence - 1)&0xFF;
|
int offset = (payload_seq - neighbour->mdp_ack_sequence - 1)&0xFF;
|
||||||
neighbour->mdp_ack_mask = (neighbour->mdp_ack_mask << 1) | 1;
|
if (offset>=64){
|
||||||
neighbour->mdp_ack_mask = neighbour->mdp_ack_mask << offset;
|
neighbour->mdp_ack_mask = 0;
|
||||||
|
DEBUGF("Jump in neighbour mdp seq (%d -> %d)",neighbour->mdp_ack_sequence,payload_seq);
|
||||||
|
}else{
|
||||||
|
neighbour->mdp_ack_mask = (neighbour->mdp_ack_mask << 1) | 1;
|
||||||
|
neighbour->mdp_ack_mask = neighbour->mdp_ack_mask << offset;
|
||||||
|
}
|
||||||
neighbour->mdp_ack_sequence = payload_seq;
|
neighbour->mdp_ack_sequence = payload_seq;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1183,7 +1188,7 @@ int link_received_duplicate(struct subscriber *subscriber, int payload_seq)
|
|||||||
// remote peer has confirmed hearing a recent unicast packet
|
// remote peer has confirmed hearing a recent unicast packet
|
||||||
int link_unicast_ack(struct subscriber *UNUSED(subscriber), struct overlay_interface *UNUSED(interface), struct socket_address *UNUSED(addr))
|
int link_unicast_ack(struct subscriber *UNUSED(subscriber), struct overlay_interface *UNUSED(interface), struct socket_address *UNUSED(addr))
|
||||||
{
|
{
|
||||||
// TODO find / create network destination, keep it alive
|
// NOOP, the packet arrival has already been tracked
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1260,7 @@ int link_received_packet(struct decode_context *context, int sender_seq, char un
|
|||||||
if (config.debug.verbose && config.debug.linkstate)
|
if (config.debug.verbose && config.debug.linkstate)
|
||||||
DEBUGF("LINK STATE; late seq %d from %s on %s",
|
DEBUGF("LINK STATE; late seq %d from %s on %s",
|
||||||
sender_seq, alloca_tohex_sid_t(context->sender->sid), context->interface->name);
|
sender_seq, alloca_tohex_sid_t(context->sender->sid), context->interface->name);
|
||||||
link->ack_mask |= (1<<offset);
|
link->ack_mask |= (1ull<<offset);
|
||||||
}else{
|
}else{
|
||||||
link->ack_mask = (link->ack_mask << 1) | 1;
|
link->ack_mask = (link->ack_mask << 1) | 1;
|
||||||
while(1){
|
while(1){
|
||||||
@ -1269,7 +1274,7 @@ int link_received_packet(struct decode_context *context, int sender_seq, char un
|
|||||||
link->ack_mask = link->ack_mask << 1;
|
link->ack_mask = link->ack_mask << 1;
|
||||||
link->ack_counter --;
|
link->ack_counter --;
|
||||||
|
|
||||||
// we may need to nack promptly
|
// we need to nack promptly
|
||||||
if (neighbour->using_us && link==neighbour->best_link){
|
if (neighbour->using_us && link==neighbour->best_link){
|
||||||
neighbour->next_neighbour_update = now + 5;
|
neighbour->next_neighbour_update = now + 5;
|
||||||
}
|
}
|
||||||
@ -1488,7 +1493,7 @@ int link_receive(struct internal_mdp_header *header, struct overlay_buffer *payl
|
|||||||
// did they miss our last ack?
|
// did they miss our last ack?
|
||||||
if (neighbour->last_update_seq!=-1){
|
if (neighbour->last_update_seq!=-1){
|
||||||
int seq_delta = (ack_seq - neighbour->last_update_seq)&0xFF;
|
int seq_delta = (ack_seq - neighbour->last_update_seq)&0xFF;
|
||||||
if (seq_delta <= 32 && (seq_delta==0 || ack_mask&(1<<(seq_delta-1)))){
|
if (seq_delta <= 32 && (seq_delta==0 || ack_mask&(1ull<<(seq_delta-1)))){
|
||||||
neighbour->last_update_seq = -1;
|
neighbour->last_update_seq = -1;
|
||||||
}else if(seq_delta < 128){
|
}else if(seq_delta < 128){
|
||||||
// send another ack soon
|
// send another ack soon
|
||||||
|
Loading…
Reference in New Issue
Block a user