diff options
author | Pavel Machek <pavel@ucw.cz> | 1999-11-25 15:54:08 +0100 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 1999-11-25 15:54:08 +0100 |
commit | d3702d57fd5357e9a11ada6c46769a79da8e547a (patch) | |
tree | 66467d2a69fe0721321d253052d4f181b5c99c0b /proto/rip/rip.c | |
parent | 4aa885a53c479c774aab5befe55a1714b89cdc9e (diff) | |
download | bird-d3702d57fd5357e9a11ada6c46769a79da8e547a.tar bird-d3702d57fd5357e9a11ada6c46769a79da8e547a.zip |
Bugfixes: select right password for password authentication, do not
try to process authentication blocks as datablocks, make it possible
to add data at end of packet. Password authentication should actually work.
Diffstat (limited to 'proto/rip/rip.c')
-rw-r--r-- | proto/rip/rip.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 1fdb179..16c61cf 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -114,7 +114,7 @@ rip_tx( sock *s ) struct rip_connection *c = rif->busy; struct proto *p = c->proto; struct rip_packet *packet = (void *) s->tbuf; - int i; + int i, packetlen; DBG( "Sending to %I\n", s->daddr ); do { @@ -151,17 +151,17 @@ rip_tx( sock *s ) break_loop: - if (P_CF->authtype) - rip_outgoing_authentication(p, (void *) &packet->block[0], packet, i); + packetlen = rip_outgoing_authentication(p, (void *) &packet->block[0], packet, i); DBG( ", sending %d blocks, ", i ); - if (!i) +#if 0 /* FIXME: enable this for production! */ + if (i == !!P_CF->authtype) continue; - +#endif if (ipa_nonzero(c->daddr)) - i = sk_send_to( s, sizeof( struct rip_packet_heading ) + i*sizeof( struct rip_block ), c->daddr, c->dport ); + i = sk_send_to( s, packetlen, c->daddr, c->dport ); else - i = sk_send( s, sizeof( struct rip_packet_heading ) + i*sizeof( struct rip_block ) ); + i = sk_send( s, packetlen ); DBG( "it wants more\n" ); @@ -294,13 +294,12 @@ process_block( struct proto *p, struct rip_block *block, ip_addr whotoldme ) ip_addr network = block->network; CHK_MAGIC; + debug( "block: %I tells me: %I/??? available, metric %d... ", whotoldme, network, metric ); if ((!metric) || (metric > P_CF->infinity)) { log( L_WARN "Got metric %d from %I", metric, whotoldme ); return; } - debug( "block: %I tells me: %I/??? available, metric %d... ", whotoldme, network, metric ); - advertise_entry( p, block, whotoldme ); } @@ -351,12 +350,14 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr for (i=0; i<num; i++) { struct rip_block *block = &packet->block[i]; - if (block->family == 0xffff) - if (!i) { - if (rip_incoming_authentication(p, (void *) block, packet, num)) - BAD( "Authentication failed" ); - authenticated = 1; - } + if (block->family == 0xffff) { + if (i) + BAD( "Authentication header is not the first" ); + if (rip_incoming_authentication(p, (void *) block, packet, num)) + BAD( "Authentication failed" ); + authenticated = 1; + continue; + } if ((!authenticated) && (P_CF->authtype != AT_NONE)) BAD( "Packet is not authenticated and it should be" ); ipa_ntoh( block->network ); |