summaryrefslogtreecommitdiffstats
path: root/proto/ospf/hello.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2004-07-01 17:01:04 +0200
committerOndrej Filip <feela@network.cz>2004-07-01 17:01:04 +0200
commitbc4ea680cea9eca46cd2c5f41db91c3014f90167 (patch)
tree6f7e189eca97d70a500010f283bf5d7bc222e818 /proto/ospf/hello.c
parentea357b8b6de387a55930a3fc831b8ccbcef24582 (diff)
downloadbird-bc4ea680cea9eca46cd2c5f41db91c3014f90167.tar
bird-bc4ea680cea9eca46cd2c5f41db91c3014f90167.zip
Hello reading bugfix.
Diffstat (limited to 'proto/ospf/hello.c')
-rw-r--r--proto/ospf/hello.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index b6d04ee..bc5e876 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -1,7 +1,7 @@
/*
* BIRD -- OSPF
*
- * (c) 1999 - 2004 Ondrej Filip <feela@network.cz>
+ * (c) 1999--2004 Ondrej Filip <feela@network.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
@@ -17,7 +17,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
ip_addr mask;
char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
struct proto *p = (struct proto *) ifa->proto;
- unsigned int size = ntohs(ps->ospf_packet.length), i, twoway, oldpriority, eligible = 0;
+ unsigned int size = ntohs(ps->ospf_packet.length), i, twoway, oldpriority, eligible = 0, peers;
OSPF_TRACE(D_PACKETS, "Received hello from %I via %s", faddr,
ifa->iface->name);
@@ -101,8 +101,10 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
pnrid = (u32 *) ((struct ospf_hello_packet *) (ps + 1));
+ peers = (size - sizeof(struct ospf_hello_packet))/ sizeof(u32);
+
twoway = 0;
- for (i = 0; i < size - (sizeof(struct ospf_hello_packet)); i++)
+ for (i = 0; i < peers; i++)
{
if (ntohl(*(pnrid + i)) == p->cf->global->router_id)
{