From 7426ee3d49fab13428f198c78c8b7f3da131382e Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Thu, 13 May 1999 09:18:36 +0000 Subject: Checksum control added. --- proto/ospf/ospf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'proto') 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 */ -- cgit v1.2.3