diff options
author | Ondrej Filip <feela@network.cz> | 2000-05-10 23:41:18 +0000 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-05-10 23:41:18 +0000 |
commit | ff73f1d63d2d1e49737ea2471dc5cb92e9591847 (patch) | |
tree | 616b5be13b7ea9f26b1f011ef81dbedcb94d610c /proto | |
parent | 13741548a6a75479577ea991bad1e38a4fba6320 (diff) |
More robust tests in packet receiving.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/ospf/packet.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c index 37156d3b..67db3616 100644 --- a/proto/ospf/packet.c +++ b/proto/ospf/packet.c @@ -51,15 +51,11 @@ ospf_rx_hook(sock *sk, int size) { #ifndef IPV6 struct ospf_packet *ps; - struct ospf_iface *ifa; - struct proto *p; + struct ospf_iface *ifa=(struct ospf_iface *)(sk->data); + struct proto *p=(struct proto *)(ifa->proto); int i; 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); ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size); @@ -77,7 +73,7 @@ ospf_rx_hook(sock *sk, int size) 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: Discarding",p->name); |