summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/ospf.c30
-rw-r--r--proto/ospf/ospf.h6
2 files changed, 30 insertions, 6 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 5fdbc226..606ab9d8 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;
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index a0fdf816..19c9eeb1 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -43,7 +43,7 @@ struct ospf_iface {
interface. LSAs contained in the update */
u8 priority; /* A router priority for DR election */
u16 helloint; /* number of seconds between hello sending */
- u32 deadint; /* after "deadint" missing hellos is router dead */
+ u32 deadc; /* after "deadint" missing hellos is router dead */
u16 autype;
u8 aukey[8];
u8 options;
@@ -70,7 +70,7 @@ struct ospf_iface {
#define IFTRANSDELAY_D 1
#define PRIORITY_D 1
#define HELLOINT_D 10
-#define DEADINT_D 4
+#define DEADC_D 4
#define WAIT_DMH 2 /* Value of Wait timer - not found it in RFC - using 2*HELLO */
};
@@ -100,7 +100,7 @@ struct ospf_packet {
struct ospf_hello_packet {
struct ospf_packet ospf_packet;
ip_addr netmask;
- u16 hello_int;
+ u16 helloint;
u8 options;
u8 priority;
u32 deadint;