More robust tests in packet receiving.
This commit is contained in:
parent
13741548a6
commit
ff73f1d63d
1 changed files with 3 additions and 7 deletions
|
@ -51,15 +51,11 @@ ospf_rx_hook(sock *sk, int size)
|
||||||
{
|
{
|
||||||
#ifndef IPV6
|
#ifndef IPV6
|
||||||
struct ospf_packet *ps;
|
struct ospf_packet *ps;
|
||||||
struct ospf_iface *ifa;
|
struct ospf_iface *ifa=(struct ospf_iface *)(sk->data);
|
||||||
struct proto *p;
|
struct proto *p=(struct proto *)(ifa->proto);
|
||||||
int i;
|
int i;
|
||||||
u8 *pu8;
|
u8 *pu8;
|
||||||
|
|
||||||
|
|
||||||
ifa=(struct ospf_iface *)(sk->data);
|
|
||||||
|
|
||||||
p=(struct proto *)(ifa->proto);
|
|
||||||
DBG("%s: RX_Hook called on interface %s.\n",p->name, sk->iface->name);
|
DBG("%s: RX_Hook called on interface %s.\n",p->name, sk->iface->name);
|
||||||
|
|
||||||
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
|
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
|
||||||
|
@ -77,7 +73,7 @@ ospf_rx_hook(sock *sk, int size)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ntohs(ps->length) != size)
|
if((ntohs(ps->length)!=size)||(size!=(4*(size/4))))
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: size field does not match", p->name);
|
log("%s: Bad OSPF packet received: size field does not match", p->name);
|
||||||
log("%s: Discarding",p->name);
|
log("%s: Discarding",p->name);
|
||||||
|
|
Loading…
Reference in a new issue