Netmask checking for hello packets added.
This commit is contained in:
parent
7426ee3d49
commit
67ff91302f
2 changed files with 15 additions and 3 deletions
|
@ -27,6 +27,18 @@ void
|
||||||
ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
|
ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
|
||||||
struct ospf_iface *ifa)
|
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)
|
switch(ifa->state)
|
||||||
{
|
{
|
||||||
case OSPF_IS_DOWN:
|
case OSPF_IS_DOWN:
|
||||||
|
|
|
@ -102,8 +102,8 @@ struct ospf_packet {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ospf_hello_packet {
|
struct ospf_hello_packet {
|
||||||
struct ospf_packet;
|
struct ospf_packet ospf_packet;
|
||||||
u32 netmask;
|
ip_addr netmask;
|
||||||
u16 hello_int;
|
u16 hello_int;
|
||||||
u8 options;
|
u8 options;
|
||||||
u8 priority;
|
u8 priority;
|
||||||
|
|
Loading…
Reference in a new issue