diff options
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r-- | proto/ospf/ospf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 6996540f..5c303d4f 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -27,10 +27,22 @@ void ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, struct ospf_iface *ifa) { + char sip[100]; /* FIXME: Should be smaller */ + + if(ipa_mklen(ipa_ntoh(ps->netmask))!=ifa->iface->addr->pxlen) + { + ip_ntop(ps->netmask,sip); + log("%s: Bad OSPF packet from %d received: bad netmask %s.", + p->name, ntohl(((struct ospf_packet *)ps)->routerid), sip); + /*ip_ntop(ps->netmask, sip));*/ + log("%s: Discarding",p->name); + return; + } + switch(ifa->state) { case OSPF_IS_DOWN: - die("%s: Iface %s in down state?",p->name, ifa->iface->name); + die("%s: Iface %s in down state?", p->name, ifa->iface->name); break; case OSPF_IS_WAITING: DBG(p->name); |