summaryrefslogtreecommitdiff
path: root/proto/ospf/hello.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-06-08 01:49:19 +0000
committerOndrej Filip <feela@network.cz>2000-06-08 01:49:19 +0000
commit423230f2f1080c6a4f6d05b6d7705cfaee500f48 (patch)
tree4eb4479aab98c983cb94854fbed70ce94fca4380 /proto/ospf/hello.c
parent17e29574bcf0e03e3243a48e784b0248925cc5b4 (diff)
Ehm, my (B)DR election was based on router id, but RFC says ip!
Diffstat (limited to 'proto/ospf/hello.c')
-rw-r--r--proto/ospf/hello.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index de1669f0..09dbfae1 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -53,7 +53,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
u32 nrid, *pnrid;
struct ospf_neighbor *neigh,*n;
u8 i,twoway,oldpriority;
- u32 olddr,oldbdr;
+ ip_addr olddr,oldbdr;
char *beg=": Bad OSPF hello packet from ", *rec=" received: ";
nrid=ntohl(((struct ospf_packet *)ps)->routerid);
@@ -153,21 +153,22 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
if(n->priority!=oldpriority) ospf_int_sm(ifa, ISM_NEICH);
/* Router is declaring itself ad DR and there is no BDR */
- if((n->rid==n->dr) && (n->bdr==0) && (n->state!=NEIGHBOR_FULL))
+ if((ipa_compare(n->ip,n->dr)==0) && (ipa_to_u32(n->bdr)==0)
+ && (n->state!=NEIGHBOR_FULL))
ospf_int_sm(ifa, ISM_BACKS);
/* Neighbor is declaring itself as BDR */
- if((n->rid==n->bdr) && (n->state!=NEIGHBOR_FULL))
+ if((ipa_compare(n->ip,n->bdr)==0) && (n->state!=NEIGHBOR_FULL))
ospf_int_sm(ifa, ISM_BACKS);
/* Neighbor is newly declaring itself as DR or BDR */
- if(((n->rid==n->dr) && (n->dr!=olddr)) || ((n->rid==n->bdr) &&
- (n->bdr!=oldbdr)))
+ if(((ipa_compare(n->ip,n->dr)==0) && (ipa_compare(n->dr,olddr)!=0))
+ || ((ipa_compare(n->ip,n->bdr)==0) && (ipa_compare(n->bdr,oldbdr)!=0)))
ospf_int_sm(ifa, ISM_NEICH);
/* Neighbor is no more declaring itself as DR or BDR */
- if(((n->rid==olddr) && (n->dr!=olddr)) || ((n->rid==oldbdr) &&
- (n->bdr!=oldbdr)))
+ if(((ipa_compare(n->ip,olddr)==0) && (ipa_compare(n->dr,olddr)!=0))
+ || ((ipa_compare(n->ip,oldbdr)==0) && (ipa_compare(n->bdr,oldbdr)!=0)))
ospf_int_sm(ifa, ISM_NEICH);
}
@@ -212,8 +213,8 @@ hello_timer_hook(timer *timer)
pkt->options=ifa->options;
pkt->priority=ifa->priority;
pkt->deadint=htonl(ifa->deadc*ifa->helloint);
- pkt->dr=htonl(ifa->drid);
- pkt->bdr=htonl(ifa->bdrid);
+ pkt->dr=htonl(ifa->drip);
+ pkt->bdr=htonl(ifa->bdrip);
/* Fill all neighbors */
i=0;