summaryrefslogtreecommitdiffstats
path: root/proto/ospf/hello.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-06-06 01:44:26 +0200
committerOndrej Filip <feela@network.cz>2000-06-06 01:44:26 +0200
commite5b5d18c1c8b33e76e954c0696e056fc11701631 (patch)
tree601de62d327c3fb3d030c239f53f52b5261f9af2 /proto/ospf/hello.c
parent5c18880e35f668d33a993be5b2854547a08d9199 (diff)
downloadbird-e5b5d18c1c8b33e76e954c0696e056fc11701631.tar
bird-e5b5d18c1c8b33e76e954c0696e056fc11701631.zip
NBMA networks should work now.
Diffstat (limited to 'proto/ospf/hello.c')
-rw-r--r--proto/ospf/hello.c80
1 files changed, 55 insertions, 25 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index 3e4bfff..21cd1ea 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -194,39 +194,69 @@ hello_timer_hook(timer *timer)
/* First a common packet header */
if(ifa->type!=OSPF_IT_NBMA)
{
- /* Now fill ospf_hello header */
pkt=(struct ospf_hello_packet *)(ifa->hello_sk->tbuf);
- op=(struct ospf_packet *)pkt;
-
- fill_ospf_pkt_hdr(ifa, pkt, HELLO_P);
-
- pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
- ipa_hton(pkt->netmask);
- pkt->helloint=ntohs(ifa->helloint);
- pkt->options=ifa->options;
- pkt->priority=ifa->priority;
- pkt->deadint=htonl(ifa->deadc*ifa->helloint);
- pkt->dr=htonl(ifa->drid);
- pkt->bdr=htonl(ifa->bdrid);
-
- /* Fill all neighbors */
- i=0;
- pp=(u32 *)(((u8 *)pkt)+sizeof(struct ospf_hello_packet));
- WALK_LIST (neigh, ifa->neigh_list)
- {
- *(pp+i)=htonl(neigh->rid);
- i++;
- }
+ }
+ else
+ {
+ pkt=(struct ospf_hello_packet *)(ifa->ip_sk->tbuf);
+ }
- length=sizeof(struct ospf_hello_packet)+i*sizeof(u32);
- op->length=htons(length);
+ /* Now fill ospf_hello header */
+ op=(struct ospf_packet *)pkt;
- ospf_pkt_finalize(ifa, op);
+ fill_ospf_pkt_hdr(ifa, pkt, HELLO_P);
+
+ pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
+ ipa_hton(pkt->netmask);
+ pkt->helloint=ntohs(ifa->helloint);
+ pkt->options=ifa->options;
+ pkt->priority=ifa->priority;
+ pkt->deadint=htonl(ifa->deadc*ifa->helloint);
+ pkt->dr=htonl(ifa->drid);
+ pkt->bdr=htonl(ifa->bdrid);
+
+ /* Fill all neighbors */
+ i=0;
+ pp=(u32 *)(((u8 *)pkt)+sizeof(struct ospf_hello_packet));
+ WALK_LIST (neigh, ifa->neigh_list)
+ {
+ *(pp+i)=htonl(neigh->rid);
+ i++;
+ }
+
+ length=sizeof(struct ospf_hello_packet)+i*sizeof(u32);
+ op->length=htons(length);
+
+ ospf_pkt_finalize(ifa, op);
/* And finally send it :-) */
+ if(ifa->type!=OSPF_IT_NBMA)
+ {
sk_send(ifa->hello_sk,length);
}
+ else /* NBMA */
+ {
+ list n_list;
+ struct ospf_neighbor *n1;
+ struct nbma_node *nb;
+ int send;
+ init_list(&n_list);
+ WALK_LIST(nb,ifa->nbma_list)
+ {
+ send=1;
+ WALK_LIST(n1, ifa->neigh_list)
+ {
+ if(ipa_compare(nb->ip,n1->ip)==0)
+ {
+ send=0;
+ break;
+ }
+ }
+ if(send) sk_send_to(ifa->ip_sk, length, nb->ip, OSPF_PROTO);
+ }
+ sk_send_to_agt(ifa->ip_sk, length, ifa, NEIGHBOR_DOWN);
+ }
debug("%s: Hello sent via %s\n",p->name,ifa->iface->name);
}