summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-05-14 20:03:09 +0200
committerMartin Mares <mj@ucw.cz>1999-05-14 20:03:09 +0200
commitb23c5e0ff4e9071b2568bf2f7d437bc13273d17d (patch)
tree2e6ff94f799923b0c8cd70ebedd431368f67b059 /proto/ospf
parent11ce4490fac7d0446802738f5fb8fd68c36bd30b (diff)
downloadbird-b23c5e0ff4e9071b2568bf2f7d437bc13273d17d.tar
bird-b23c5e0ff4e9071b2568bf2f7d437bc13273d17d.zip
Added ip_skip_header() and modified OSPF to use it.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/ospf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index ef65064..954df8e 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -80,16 +80,15 @@ ospf_rx_hook(sock *sk, int size)
DBG(sk->iface->name);
DBG(".\n");
- ps=(struct ospf_packet *)(sk->rbuf+5*4);
-
- if(size<=(20+sizeof(struct ospf_packet)))
+ ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
+ if(!ps || size < sizeof(struct ospf_packet))
{
log("%s: Bad packet received: too short", p->name);
log("%s: Discarding",p->name);
return(1);
}
- if((ntohs(ps->length))!=(size-20))
+ if(ntohs(ps->length) != size)
{
log("%s: Bad packet received: size fields does not match", p->name);
log("%s: Discarding",p->name);