0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

"My own IP problem" fixed.

This commit is contained in:
Ondrej Filip 1999-08-09 18:49:50 +00:00
parent a4c2ee717c
commit 2be22ddb4c

View File

@ -237,7 +237,6 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
return; return;
} }
if(ps->options!=ifa->options) if(ps->options!=ifa->options)
{ {
log("%s: Bad OSPF packet from %u received: options mismatch.", log("%s: Bad OSPF packet from %u received: options mismatch.",
@ -410,28 +409,28 @@ ospf_rx_hook(sock *sk, int size)
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size); ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
if(ps==NULL) if(ps==NULL)
{ {
log("%s: Bad packet received: bad IP header", p->name); log("%s: Bad OSPF packet received: bad IP header", p->name);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
if(size < sizeof(struct ospf_packet)) if(size < sizeof(struct ospf_packet))
{ {
log("%s: Bad packet received: too short (%u bytes)", p->name, size); log("%s: Bad OSPF packet received: too short (%u bytes)", p->name, size);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
if(ntohs(ps->length) != size) if(ntohs(ps->length) != size)
{ {
log("%s: Bad packet received: size field does not match", p->name); log("%s: Bad OSPF packet received: size field does not match", p->name);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
if(ps->version!=OSPF_VERSION) if(ps->version!=OSPF_VERSION)
{ {
log("%s: Bad packet received: version %u", p->name, ps->version); log("%s: Bad OSPF packet received: version %u", p->name, ps->version);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
@ -439,7 +438,7 @@ ospf_rx_hook(sock *sk, int size)
if(!ipsum_verify(ps, 16,(void *)ps+sizeof(struct ospf_packet), if(!ipsum_verify(ps, 16,(void *)ps+sizeof(struct ospf_packet),
ntohs(ps->length)-sizeof(struct ospf_packet), NULL)) ntohs(ps->length)-sizeof(struct ospf_packet), NULL))
{ {
log("%s: Bad packet received: bad checksum", p->name); log("%s: Bad OSPF packet received: bad checksum", p->name);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
@ -448,11 +447,26 @@ ospf_rx_hook(sock *sk, int size)
if(ps->areaid!=ifa->area) if(ps->areaid!=ifa->area)
{ {
log("%s: Bad packet received: other area %ld", p->name, ps->areaid); log("%s: Bad OSPF packet received: other area %ld", p->name, ps->areaid);
log("%s: Discarding",p->name); log("%s: Discarding",p->name);
return(1); return(1);
} }
if(ntohl(ps->routerid)==p->cf->global->router_id)
{
log("%s: Bad OSPF packet received: received my own IP!.", p->name);
log("%s: Discarding",p->name);
return(1);
}
if(ntohl(ps->routerid)==0)
{
log("%s: Bad OSPF packet received: Id 0.0.0.0 is not allowed.", p->name);
log("%s: Discarding",p->name);
return(1);
}
/* Dump packet */ /* Dump packet */
pu8=(u8 *)(sk->rbuf+5*4); pu8=(u8 *)(sk->rbuf+5*4);
for(i=0;i<ntohs(ps->length);i+=4) for(i=0;i<ntohs(ps->length);i+=4)