Some RX_Hello checks added.
This commit is contained in:
parent
bb027be1e2
commit
35ff423d54
2 changed files with 30 additions and 6 deletions
|
@ -37,6 +37,30 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
|
||||||
log("%s: Discarding",p->name);
|
log("%s: Discarding",p->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ntohs(ps->helloint)!=ifa->helloint)
|
||||||
|
{
|
||||||
|
log("%s: Bad OSPF packet from %d received: hello interval mismatch.",
|
||||||
|
p->name, ntohl(((struct ospf_packet *)ps)->routerid));
|
||||||
|
log("%s: Discarding",p->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ntohl(ps->deadint)!=ifa->helloint*ifa->deadc)
|
||||||
|
{
|
||||||
|
log("%s: Bad OSPF packet from %d received: dead interval mismatch.",
|
||||||
|
p->name, ntohl(((struct ospf_packet *)ps)->routerid));
|
||||||
|
log("%s: Discarding",p->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ps->options!=ifa->options)
|
||||||
|
{
|
||||||
|
log("%s: Bad OSPF packet from %d received: options mismatch.",
|
||||||
|
p->name, ntohl(((struct ospf_packet *)ps)->routerid));
|
||||||
|
log("%s: Discarding",p->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(ifa->state)
|
switch(ifa->state)
|
||||||
{
|
{
|
||||||
|
@ -309,10 +333,10 @@ hello_timer_hook(timer *timer)
|
||||||
|
|
||||||
pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
|
pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
|
||||||
ipa_hton(pkt->netmask);
|
ipa_hton(pkt->netmask);
|
||||||
pkt->hello_int=ntohs(ifa->helloint);
|
pkt->helloint=ntohs(ifa->helloint);
|
||||||
pkt->options=ifa->options;
|
pkt->options=ifa->options;
|
||||||
pkt->priority=ifa->priority;
|
pkt->priority=ifa->priority;
|
||||||
pkt->deadint=htonl(ifa->deadint*ifa->helloint);
|
pkt->deadint=htonl(ifa->deadc*ifa->helloint);
|
||||||
pkt->dr=ifa->drid;
|
pkt->dr=ifa->drid;
|
||||||
pkt->bdr=ifa->bdrid;
|
pkt->bdr=ifa->bdrid;
|
||||||
|
|
||||||
|
@ -423,7 +447,7 @@ ospf_iface_default(struct ospf_iface *ifa)
|
||||||
ifa->iftransdelay=IFTRANSDELAY_D;
|
ifa->iftransdelay=IFTRANSDELAY_D;
|
||||||
ifa->priority=PRIORITY_D;
|
ifa->priority=PRIORITY_D;
|
||||||
ifa->helloint=HELLOINT_D;
|
ifa->helloint=HELLOINT_D;
|
||||||
ifa->deadint=DEADINT_D;
|
ifa->deadc=DEADC_D;
|
||||||
ifa->autype=0;
|
ifa->autype=0;
|
||||||
for(i=0;i<8;i++) ifa->aukey[i]=0;
|
for(i=0;i<8;i++) ifa->aukey[i]=0;
|
||||||
ifa->options=2;
|
ifa->options=2;
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct ospf_iface {
|
||||||
interface. LSAs contained in the update */
|
interface. LSAs contained in the update */
|
||||||
u8 priority; /* A router priority for DR election */
|
u8 priority; /* A router priority for DR election */
|
||||||
u16 helloint; /* number of seconds between hello sending */
|
u16 helloint; /* number of seconds between hello sending */
|
||||||
u32 deadint; /* after "deadint" missing hellos is router dead */
|
u32 deadc; /* after "deadint" missing hellos is router dead */
|
||||||
u16 autype;
|
u16 autype;
|
||||||
u8 aukey[8];
|
u8 aukey[8];
|
||||||
u8 options;
|
u8 options;
|
||||||
|
@ -70,7 +70,7 @@ struct ospf_iface {
|
||||||
#define IFTRANSDELAY_D 1
|
#define IFTRANSDELAY_D 1
|
||||||
#define PRIORITY_D 1
|
#define PRIORITY_D 1
|
||||||
#define HELLOINT_D 10
|
#define HELLOINT_D 10
|
||||||
#define DEADINT_D 4
|
#define DEADC_D 4
|
||||||
#define WAIT_DMH 2 /* Value of Wait timer - not found it in RFC - using 2*HELLO */
|
#define WAIT_DMH 2 /* Value of Wait timer - not found it in RFC - using 2*HELLO */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ struct ospf_packet {
|
||||||
struct ospf_hello_packet {
|
struct ospf_hello_packet {
|
||||||
struct ospf_packet ospf_packet;
|
struct ospf_packet ospf_packet;
|
||||||
ip_addr netmask;
|
ip_addr netmask;
|
||||||
u16 hello_int;
|
u16 helloint;
|
||||||
u8 options;
|
u8 options;
|
||||||
u8 priority;
|
u8 priority;
|
||||||
u32 deadint;
|
u32 deadint;
|
||||||
|
|
Loading…
Reference in a new issue