Keep track of the number of correct, non-replayed UDP packets that have been
received, regardless of their content. This can be compared to the sequence
number to determine the real packet loss.
if(inpkt->seqno > n->received_seqno)
n->received_seqno = inpkt->seqno;
+ n->received++;
+
if(n->received_seqno > MAX_SEQNO)
regenerate_key();
uint32_t sent_seqno; /* Sequence number last sent to this node */
uint32_t received_seqno; /* Sequence number last received from this node */
+ uint32_t received; /* Total valid packets received from this node */
uint32_t farfuture; /* Packets in a row that have arrived from the far future */
unsigned char* late; /* Bitfield marking late packets */
// Reset sequence number and late packet window
mykeyused = true;
to->received_seqno = 0;
+ to->received = 0;
if(replaywin) memset(to->late, 0, replaywin);
return send_request(to->nexthop->connection, "%d %s %s %s %d %d %d %d", ANS_KEY,
if(seqno > s->inseqno)
s->inseqno = seqno + 1;
+ if(!s->inseqno)
+ s->received = 0;
+ else
+ s->received++;
// Decrypt.
cipher_set_counter(&s->incipher, &seqno, sizeof seqno);
cipher_t incipher;
digest_t indigest;
uint32_t inseqno;
+ uint32_t received;
unsigned int replaywin;
unsigned int farfuture;
char *late;