summaryrefslogtreecommitdiffstats
path: root/proto/ospf/hello.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2004-06-26 22:15:34 +0200
committerOndrej Filip <feela@network.cz>2004-06-26 22:15:34 +0200
commit3e2bd0f17aab3d2bd460d5f7aef4d3bc152ea1ab (patch)
treee6be2d6e0af3d2b67fccf4eca6516e3c6a1a1e92 /proto/ospf/hello.c
parent5236fb03afecd3d7a6ec6e96712c79a31be32132 (diff)
downloadbird-3e2bd0f17aab3d2bd460d5f7aef4d3bc152ea1ab.tar
bird-3e2bd0f17aab3d2bd460d5f7aef4d3bc152ea1ab.zip
Md5 authentification added (unsested).
Packet receiving clean up.
Diffstat (limited to 'proto/ospf/hello.c')
-rw-r--r--proto/ospf/hello.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index c805973..b6d04ee 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -200,7 +200,7 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
/* Now fill ospf_hello header */
op = (struct ospf_packet *) pkt;
- fill_ospf_pkt_hdr(ifa, pkt, HELLO_P);
+ ospf_pkt_fill_hdr(ifa, pkt, HELLO_P);
pkt->netmask = ipa_mkmask(ifa->iface->addr->pxlen);
ipa_hton(pkt->netmask);
@@ -218,6 +218,11 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
pp = (u32 *) (((u8 *) pkt) + sizeof(struct ospf_hello_packet));
WALK_LIST(neigh, ifa->neigh_list)
{
+ if ((i+1) * sizeof(u32) + sizeof(struct ospf_hello_packet) > ospf_pkt_maxsize(ifa))
+ {
+ OSPF_TRACE(D_PACKETS, "Too many neighbors on the interface!");
+ break;
+ }
*(pp + i) = htonl(neigh->rid);
i++;
}
@@ -225,15 +230,12 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
length = sizeof(struct ospf_hello_packet) + i * sizeof(u32);
op->length = htons(length);
- ospf_pkt_finalize(ifa, op);
-
- /* And finally send it :-) */
switch(ifa->type)
{
case OSPF_IT_NBMA:
if (timer == NULL) /* Response to received hello */
{
- ospf_send_to(ifa->ip_sk, length, dirn->ip);
+ ospf_send_to(ifa->ip_sk, dirn->ip, ifa);
}
else
{
@@ -258,7 +260,7 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
if ((poll == 1) && (send))
{
if (toall || (meeli && nb->eligible))
- ospf_send_to(ifa->ip_sk, length, nb->ip);
+ ospf_send_to(ifa->ip_sk, nb->ip, ifa);
}
}
if (poll == 0)
@@ -267,16 +269,16 @@ ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn)
{
if (toall || (n1->rid == ifa->drid) || (n1->rid == ifa->bdrid) ||
(meeli && (n1->priority > 0)))
- ospf_send_to(ifa->ip_sk, length, n1->ip);
+ ospf_send_to(ifa->ip_sk, n1->ip, ifa);
}
}
}
break;
case OSPF_IT_VLINK:
- ospf_send_to(ifa->ip_sk, length, ifa->vip);
+ ospf_send_to(ifa->ip_sk, ifa->vip, ifa);
break;
default:
- sk_send(ifa->hello_sk, length);
+ ospf_send_to(ifa->hello_sk, IPA_NONE, ifa);
}
OSPF_TRACE(D_PACKETS, "Hello sent via %s", ifa->iface->name);
}