]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Netmask checking for hello packets added.
authorOndrej Filip <feela@network.cz>
Fri, 14 May 1999 08:46:06 +0000 (08:46 +0000)
committerOndrej Filip <feela@network.cz>
Fri, 14 May 1999 08:46:06 +0000 (08:46 +0000)
proto/ospf/ospf.c
proto/ospf/ospf.h

index 6996540f6bab3e4599bf697e25ea85adae2c7559..5c303d4f6de1213c96e58f74c7b891b3fa87392f 100644 (file)
@@ -27,10 +27,22 @@ void
 ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
   struct ospf_iface *ifa)
 {
+  char sip[100]; /* FIXME: Should be smaller */
+
+  if(ipa_mklen(ipa_ntoh(ps->netmask))!=ifa->iface->addr->pxlen)
+  {
+    ip_ntop(ps->netmask,sip);
+    log("%s: Bad OSPF packet from %d received: bad netmask %s.",
+      p->name, ntohl(((struct ospf_packet *)ps)->routerid), sip);
+      /*ip_ntop(ps->netmask, sip));*/
+    log("%s: Discarding",p->name);
+    return;
+  }
+
   switch(ifa->state)
   {
     case OSPF_IS_DOWN:
-      die("%s: Iface %s in down state?",p->name, ifa->iface->name);
+      die("%s: Iface %s in down state?", p->name, ifa->iface->name);
       break;
     case OSPF_IS_WAITING:
       DBG(p->name);
index eb49ca5445d51bee259a0b2a06043e4f654fc046..92e7468cd909696c3a5dc62c0155204a0c345674 100644 (file)
@@ -102,8 +102,8 @@ struct ospf_packet {
 };
 
 struct ospf_hello_packet {
-  struct ospf_packet;
-  u32 netmask;
+  struct ospf_packet ospf_packet;
+  ip_addr netmask;
   u16 hello_int;
   u8 options;
   u8 priority;