From 3cb96cd343196baabf847f5d670711162e66e298 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 31 May 2004 18:11:16 +0000 Subject: 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) --- proto/rip/auth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'proto/rip') diff --git a/proto/rip/auth.c b/proto/rip/auth.c index 78064b5..0d2edd3 100644 --- a/proto/rip/auth.c +++ b/proto/rip/auth.c @@ -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++; -- cgit v1.2.3