diff options
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/ospf.c | 15 |
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 */ |