summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>1999-05-13 11:18:36 +0200
committerOndrej Filip <feela@network.cz>1999-05-13 11:18:36 +0200
commit7426ee3d49fab13428f198c78c8b7f3da131382e (patch)
tree67e8609515d276af017e1bad0b8d819becf9556c
parent296ecb56eb4d1951d23d74d502d2c48a42eb6eee (diff)
downloadbird-7426ee3d49fab13428f198c78c8b7f3da131382e.tar
bird-7426ee3d49fab13428f198c78c8b7f3da131382e.zip
Checksum control added.
-rw-r--r--proto/ospf/ospf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 2db672b..6996540 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -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 */