Commit 67ff9130 authored by Ondřej Filip's avatar Ondřej Filip
Browse files

Netmask checking for hello packets added.
parent 7426ee3d
......@@ -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);
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment