summaryrefslogtreecommitdiffstats
path: root/proto/ospf/ospf.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>1999-05-31 20:56:20 +0200
committerOndrej Filip <feela@network.cz>1999-05-31 20:56:20 +0200
commit35ff423d54ebabffc5ab9dd757dfa2a1a70e9676 (patch)
tree332a9b17de30332d9a9eae199d41092f9028a987 /proto/ospf/ospf.c
parentbb027be1e232ca2207a03a8e001441965cc07801 (diff)
downloadbird-35ff423d54ebabffc5ab9dd757dfa2a1a70e9676.tar
bird-35ff423d54ebabffc5ab9dd757dfa2a1a70e9676.zip
Some RX_Hello checks added.
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r--proto/ospf/ospf.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 5fdbc22..606ab9d 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -37,6 +37,30 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
log("%s: Discarding",p->name);
return;
}
+
+ if(ntohs(ps->helloint)!=ifa->helloint)
+ {
+ log("%s: Bad OSPF packet from %d received: hello interval mismatch.",
+ p->name, ntohl(((struct ospf_packet *)ps)->routerid));
+ log("%s: Discarding",p->name);
+ return;
+ }
+
+ if(ntohl(ps->deadint)!=ifa->helloint*ifa->deadc)
+ {
+ log("%s: Bad OSPF packet from %d received: dead interval mismatch.",
+ p->name, ntohl(((struct ospf_packet *)ps)->routerid));
+ log("%s: Discarding",p->name);
+ return;
+ }
+
+ if(ps->options!=ifa->options)
+ {
+ log("%s: Bad OSPF packet from %d received: options mismatch.",
+ p->name, ntohl(((struct ospf_packet *)ps)->routerid));
+ log("%s: Discarding",p->name);
+ return;
+ }
switch(ifa->state)
{
@@ -309,10 +333,10 @@ hello_timer_hook(timer *timer)
pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
ipa_hton(pkt->netmask);
- pkt->hello_int=ntohs(ifa->helloint);
+ pkt->helloint=ntohs(ifa->helloint);
pkt->options=ifa->options;
pkt->priority=ifa->priority;
- pkt->deadint=htonl(ifa->deadint*ifa->helloint);
+ pkt->deadint=htonl(ifa->deadc*ifa->helloint);
pkt->dr=ifa->drid;
pkt->bdr=ifa->bdrid;
@@ -423,7 +447,7 @@ ospf_iface_default(struct ospf_iface *ifa)
ifa->iftransdelay=IFTRANSDELAY_D;
ifa->priority=PRIORITY_D;
ifa->helloint=HELLOINT_D;
- ifa->deadint=DEADINT_D;
+ ifa->deadc=DEADC_D;
ifa->autype=0;
for(i=0;i<8;i++) ifa->aukey[i]=0;
ifa->options=2;