diff options
author | Ondrej Filip <feela@network.cz> | 1999-04-22 15:12:28 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 1999-04-22 15:12:28 +0200 |
commit | 93bde8dce23ae10476263a84cc40bbe186263fdc (patch) | |
tree | 8af71f0de9752827ac128ad26a00ef7c3f0e3606 | |
parent | 36bbfc704c7d2153537751e24413db9b9c97bc58 (diff) | |
download | bird-93bde8dce23ae10476263a84cc40bbe186263fdc.tar bird-93bde8dce23ae10476263a84cc40bbe186263fdc.zip |
Work on hello continues.
-rw-r--r-- | proto/ospf/ospf.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index b98e75d..1facfab 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -118,15 +118,39 @@ ospf_iface_clasify(struct iface *ifa) void wait_timer_hook(timer *timer) { - debug(" OSPF: Wait timer expired for interface %s.\n", - ((struct ospf_iface *)(timer->data))->iface->name); + struct ospf_iface *ifa; + + ifa=(struct ospf_iface *)timer->data; + debug(" OSPF: Wait timer fired on interface %s.\n", + ifa->iface->name); + if(ifa->state=OSPF_IS_WAITING) + { + /* + * Wait time fired. Now we must change state + * to DR or DROTHER depending on priority + */ + if(ifa->priority!=0) + { + debug(" OSPF: Changing state into DR.\n"); + ifa->state=OSPF_IS_DR; + ifa->drip=ifa->iface->ip; + /* FIXME: Set ifa->drid */ + } + else + { + debug(" OSPF: Changing state into DROTHER.\n"); + ifa->state=OSPF_IS_DROTHER; + } + /* FIXME: Add hello timer */ + } + /* FIXME: Destroy timer */ } void add_wait_timer(struct ospf_iface *ifa,pool *pool, int wait) { DBG(" OSPF: add_wait_timer called.\n"); - if((ifa->type!=OSPF_IT_PTP) && (ifa->priority>0)) + if((ifa->type!=OSPF_IT_PTP)) { ifa->wait_timer=tm_new(pool); ifa->wait_timer->hook=wait_timer_hook; @@ -183,7 +207,6 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface c=(struct ospf_config *)(p->cf); - DBG(" OSPF: If notify called\n"); if((flags & IF_CHANGE_UP) && is_good_iface(p, new)) |