0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

The initial sequence number for RIP md5 authentication was always zero.

Bad as when bird e.g. was running for two weeks and then restarted it
would take another two weeks until the peers of this router would accept
data again from this router, as the sequence number would be too low.
Changed to use the the current system time as the starting sequence
number which is a more sane start value.

(by Andreas, cleaned up by me)
This commit is contained in:
Martin Mares 2004-05-31 18:11:16 +00:00
parent 277a34eff1
commit 3cb96cd343

View File

@ -140,11 +140,15 @@ rip_outgoing_authentication( struct proto *p, struct rip_block_auth *block, stru
{
struct rip_md5_tail *tail;
struct MD5Context ctxt;
static uint32_t sequence = 0;
static u32 sequence = 0;
if (num > PACKET_MD5_MAX)
bug( "We can not add MD5 authentication to this long packet" );
/* need to preset the sequence number to a sane value */
if(!sequence)
sequence = (u32) time(NULL);
block->keyid = passwd->id;
block->authlen = sizeof(struct rip_block_auth);
block->seq = sequence++;