]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Checksum control added.
authorOndrej Filip <feela@network.cz>
Thu, 13 May 1999 09:18:36 +0000 (09:18 +0000)
committerOndrej Filip <feela@network.cz>
Thu, 13 May 1999 09:18:36 +0000 (09:18 +0000)
proto/ospf/ospf.c

index 2db672b4542585717b370b5065355161372f3cd7..6996540f6bab3e4599bf697e25ea85adae2c7559 100644 (file)
@@ -19,6 +19,7 @@
 #include "lib/socket.h"
 #include "lib/lists.h"
 #include "lib/timer.h"
+#include "lib/checksum.h"
 
 #include "ospf.h"
 
@@ -37,6 +38,12 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
       DBG(ifa->iface->name);
       DBG("\n");
       break;
+    case OSPF_IS_PTP:
+    case OSPF_IS_DROTHER:
+    case OSPF_IS_BACKUP:
+    case OSPF_IS_DR:
+      DBG("OSPF, RX, Unimplemented state.\n");
+      break;
     default:
       die("%s: Iface %s in unknown state?",p->name, ifa->iface->name);
       break;
@@ -85,6 +92,14 @@ ospf_rx_hook(sock *sk, int size)
     return(1);
   }
 
+  if(!ipsum_verify(ps, 16,(void *)ps+sizeof(struct ospf_packet),
+    ntohs(ps->length)-sizeof(struct ospf_packet), NULL))
+  {
+    log("%s: Bad packet received: bad checksum", p->name);
+    log("%s: Discarding",p->name);
+    return(1);
+  }
+
   /* FIXME: Count checksum */
   /* FIXME: Do authetification */