diff options
author | Ondrej Filip <feela@network.cz> | 1999-05-13 09:18:36 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 1999-05-13 09:18:36 +0000 |
commit | 7426ee3d49fab13428f198c78c8b7f3da131382e (patch) | |
tree | 67e8609515d276af017e1bad0b8d819becf9556c /proto/ospf/ospf.c | |
parent | 296ecb56eb4d1951d23d74d502d2c48a42eb6eee (diff) |
Checksum control added.
Diffstat (limited to 'proto/ospf/ospf.c')
-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 2db672b4..6996540f 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 */ |