]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Some RX_Hello checks added.
authorOndrej Filip <feela@network.cz>
Mon, 31 May 1999 18:56:20 +0000 (18:56 +0000)
committerOndrej Filip <feela@network.cz>
Mon, 31 May 1999 18:56:20 +0000 (18:56 +0000)
proto/ospf/ospf.c
proto/ospf/ospf.h

index 5fdbc226ddc88de617e080cff4232f515d527d3d..606ab9d81c5a40b1237123b63666d8494ddc4f06 100644 (file)
@@ -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;
index a0fdf816a9a13ac163eb2e31937f2001cdfdeaff..19c9eeb1e46f693340dea2a64c6dd47a2b17fc25 100644 (file)
@@ -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;