summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>1999-05-14 10:46:06 +0200
committerOndrej Filip <feela@network.cz>1999-05-14 10:46:06 +0200
commit67ff91302f21f6a40201bcc8a01c9c76eaaf1ed1 (patch)
tree1b8bcef47c9caa316f0e9034fa02696d31d5affc /proto/ospf
parent7426ee3d49fab13428f198c78c8b7f3da131382e (diff)
downloadbird-67ff91302f21f6a40201bcc8a01c9c76eaaf1ed1.tar
bird-67ff91302f21f6a40201bcc8a01c9c76eaaf1ed1.zip
Netmask checking for hello packets added.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/ospf.c14
-rw-r--r--proto/ospf/ospf.h4
2 files changed, 15 insertions, 3 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 6996540..5c303d4 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);
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index eb49ca5..92e7468 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -102,8 +102,8 @@ struct ospf_packet {
};
struct ospf_hello_packet {
- struct ospf_packet;
- u32 netmask;
+ struct ospf_packet ospf_packet;
+ ip_addr netmask;
u16 hello_int;
u8 options;
u8 priority;