summaryrefslogtreecommitdiffstats
path: root/proto/rip
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2004-05-31 20:11:16 +0200
committerMartin Mares <mj@ucw.cz>2004-05-31 20:11:16 +0200
commit3cb96cd343196baabf847f5d670711162e66e298 (patch)
tree1a7cefb9fdbd28358b9135576f249f4247e4612b /proto/rip
parent277a34eff195fe39a63db59731f5f2c8d54abdb2 (diff)
downloadbird-3cb96cd343196baabf847f5d670711162e66e298.tar
bird-3cb96cd343196baabf847f5d670711162e66e298.zip
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)
Diffstat (limited to 'proto/rip')
-rw-r--r--proto/rip/auth.c6
1 files changed, 5 insertions, 1 deletions
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++;