0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Checksum control added.

This commit is contained in:
Ondrej Filip 1999-05-13 09:18:36 +00:00
parent 296ecb56eb
commit 7426ee3d49

View File

@ -19,6 +19,7 @@
#include "lib/socket.h" #include "lib/socket.h"
#include "lib/lists.h" #include "lib/lists.h"
#include "lib/timer.h" #include "lib/timer.h"
#include "lib/checksum.h"
#include "ospf.h" #include "ospf.h"
@ -37,6 +38,12 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
DBG(ifa->iface->name); DBG(ifa->iface->name);
DBG("\n"); DBG("\n");
break; 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: default:
die("%s: Iface %s in unknown state?",p->name, ifa->iface->name); die("%s: Iface %s in unknown state?",p->name, ifa->iface->name);
break; break;
@ -85,6 +92,14 @@ ospf_rx_hook(sock *sk, int size)
return(1); 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: Count checksum */
/* FIXME: Do authetification */ /* FIXME: Do authetification */