diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-29 00:33:13 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-29 00:33:13 +0200 |
commit | 1a8f3c7cef8e1fbd812cf1c29b5cf8c0ac641bee (patch) | |
tree | 0e1fb4cc2ed6669b3b30307c84f3853bced3e8f7 /ffd/ffd.c | |
parent | 40cd665392ef400eaf9b815c22b46874d83c629d (diff) | |
download | ffd-1a8f3c7cef8e1fbd812cf1c29b5cf8c0ac641bee.tar ffd-1a8f3c7cef8e1fbd812cf1c29b5cf8c0ac641bee.zip |
Minor fixups for neighbour handling
Diffstat (limited to 'ffd/ffd.c')
-rw-r--r-- | ffd/ffd.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -312,26 +312,26 @@ static void handle_tlv_hello(const ffd_tlv_hello_t *tlv_hello, size_t len, const uint16_t seqno = ntohs(tlv_hello->seqno); if (neigh->last_hello.tv_sec) { - int16_t seqdiff = seqno - neigh->last_seqno; - if (seqdiff <= 0) { - fprintf(stderr, "debug: seqno already seen, ignorin.\n"); - return; - } - int timediff = timespec_diff(&now, &neigh->last_hello)/10; uint16_t seqexp = neigh->last_seqno + (timediff - neigh->hello_interval/2)/neigh->hello_interval; /* cast to int16_t to ensure correct handling of seqno wrapping */ if (abs((int16_t)(seqno - seqexp)) > 16) { - fprintf(stderr, "info: neighbor was reset.\n"); + fprintf(stderr, "info: neighbour was reset.\n"); neigh->hello_log = 0; } else { + int16_t seqdiff = seqno - neigh->last_seqno; + if (seqdiff <= 0) { + fprintf(stderr, "debug: seqno already seen, ignoring.\n"); + return; + } + neigh->hello_log <<= seqdiff; } } else { - fprintf(stderr, "info: received hello from new neighbor.\n"); + fprintf(stderr, "info: received hello from new neighbour.\n"); } neigh->hello_log |= 1; |