summaryrefslogtreecommitdiffstats
path: root/proto/ospf/packet.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2004-06-17 01:01:49 +0200
committerOndrej Filip <feela@network.cz>2004-06-17 01:01:49 +0200
commitb4d8a0c280d34e6164a88d0e2f9ebf16fd5a1d68 (patch)
tree7447768e011454728116f4409608770a2a347110 /proto/ospf/packet.c
parent1a61882d370e6aef99ebc11d6bbc4e9dc48c6b95 (diff)
downloadbird-b4d8a0c280d34e6164a88d0e2f9ebf16fd5a1d68.tar
bird-b4d8a0c280d34e6164a88d0e2f9ebf16fd5a1d68.zip
Some cisco routers send shorter ospf messages in larger packets.
Well it's strange, but, actually it's correct.
Diffstat (limited to 'proto/ospf/packet.c')
-rw-r--r--proto/ospf/packet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index ef3066e..26cc4d4 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -85,6 +85,7 @@ ospf_rx_hook(sock * sk, int size)
struct ospf_iface *ifa = (struct ospf_iface *) (sk->data);
struct proto *p = (struct proto *) (ifa->proto);
struct ospf_neighbor *n;
+ int osize;
char *mesg = "Bad OSPF packet from ";
if (ifa->stub)
@@ -93,6 +94,7 @@ ospf_rx_hook(sock * sk, int size)
DBG("%s: RX_Hook called on interface %s.\n", p->name, sk->iface->name);
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
+ osize = ntohs(ps->length);
if (ps == NULL)
{
log(L_ERR "%s%I - bad IP header", mesg, sk->faddr);
@@ -105,9 +107,9 @@ ospf_rx_hook(sock * sk, int size)
return 1;
}
- if ((ntohs(ps->length) != size) || (size != (4 * (size / 4))))
+ if ((osize > size) || (osize != (4 * (osize / 4))))
{
- log(L_ERR "%s%I - size field does not match", mesg, sk->faddr);
+ log(L_ERR "%s%I - size field does not match (%d/%d)", mesg, sk->faddr, ntohs(ps->length), size );
return 1;
}