Commit b9ed99f7 authored by Ondřej Filip's avatar Ondřej Filip

Cleanup in iface.c

parent a5918961
This diff is collapsed.
/*
* BIRD -- OSPF
*
* (c) 1999 - 2000 Ondrej Filip <feela@network.cz>
* (c) 1999 - 2004 Ondrej Filip <feela@network.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*
......@@ -10,20 +10,11 @@
#ifndef _BIRD_OSPF_IFACE_H_
#define _BIRD_OSPF_IFACE_H_
void iface_chstate(struct ospf_iface *ifa, u8 state);
void downint(struct ospf_iface *ifa);
void ospf_int_sm(struct ospf_iface *ifa, int event);
sock *ospf_open_mc_socket(struct ospf_iface *ifa);
sock *ospf_open_ip_socket(struct ospf_iface *ifa);
u8 is_good_iface(struct proto *p, struct iface *iface);
u8 ospf_iface_clasify(struct iface *ifa, struct proto *p);
void ospf_add_timers(struct ospf_iface *ifa, pool *pool);
void ospf_iface_default(struct ospf_iface *ifa);
struct ospf_iface *find_iface(struct proto_ospf *p, struct iface *what);
void ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface);
void ospf_iface_chstate(struct ospf_iface *ifa, u8 state);
void ospf_iface_sm(struct ospf_iface *ifa, int event);
struct ospf_iface *ospf_iface_find(struct proto_ospf *p, struct iface *what);
void ospf_iface_notify(struct proto *p, unsigned flags, struct iface *iface);
void ospf_iface_info(struct ospf_iface *ifa);
void ospf_iface_shutdown(struct ospf_iface *ifa);
void ospf_ifa_add(struct object_lock *lock);
void schedule_net_lsa(struct ospf_iface *ifa);
#endif /* _BIRD_OSPF_IFACE_H_ */
......@@ -103,9 +103,9 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
n->ip, ospf_ns[oldstate], ospf_ns[state]);
if((state==NEIGHBOR_2WAY) && (oldstate<NEIGHBOR_2WAY))
ospf_int_sm(ifa, ISM_NEICH);
ospf_iface_sm(ifa, ISM_NEICH);
if((state<NEIGHBOR_2WAY) && (oldstate>=NEIGHBOR_2WAY))
ospf_int_sm(ifa, ISM_NEICH);
ospf_iface_sm(ifa, ISM_NEICH);
if(oldstate==NEIGHBOR_FULL) /* Decrease number of adjacencies */
{
......@@ -448,11 +448,11 @@ bdr_election(struct ospf_iface *ifa)
DBG("DR=%I, BDR=%I\n", ifa->drid, ifa->bdrid);
if(myid==ifa->drid) iface_chstate(ifa, OSPF_IS_DR);
if(myid==ifa->drid) ospf_iface_chstate(ifa, OSPF_IS_DR);
else
{
if(myid==ifa->bdrid) iface_chstate(ifa, OSPF_IS_BACKUP);
else iface_chstate(ifa, OSPF_IS_DROTHER);
if(myid==ifa->bdrid) ospf_iface_chstate(ifa, OSPF_IS_BACKUP);
else ospf_iface_chstate(ifa, OSPF_IS_DROTHER);
}
rem_node(NODE &me);
......
......@@ -109,7 +109,7 @@ ospf_start(struct proto *p)
oa->disp_timer->randomize=0;
oa->disp_timer->hook=area_disp;
oa->disp_timer->recurrent=oa->tick;
tm_start(oa->disp_timer,oa->tick);
tm_start(oa->disp_timer, 1);
oa->calcrt=0;
oa->origrt=0;
init_list(&oa->net_list);
......@@ -168,7 +168,7 @@ ospf_init(struct proto_config *c)
p->make_tmp_attrs = ospf_make_tmp_attrs;
p->store_tmp_attrs = ospf_store_tmp_attrs;
p->rt_notify = ospf_rt_notify;
p->if_notify = ospf_if_notify;
p->if_notify = ospf_iface_notify;
p->rte_better = ospf_rte_better;
p->rte_same = ospf_rte_same;
......@@ -244,6 +244,12 @@ ospf_build_attrs(ea_list *next, struct linpool *pool, u32 m1, u32 m2, u32 tag)
return l;
}
void
schedule_net_lsa(struct ospf_iface *ifa)
{
ifa->orignet = 1;
}
void
schedule_rt_lsa(struct ospf_area *oa)
{
......
......@@ -444,6 +444,7 @@ void ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old,ea_list *attrs);
void area_disp(timer *timer);
void schedule_rt_lsa(struct ospf_area *oa);
void schedule_rtcalc(struct ospf_area *oa);
void schedule_net_lsa(struct ospf_iface *ifa);
void ospf_sh_neigh(struct proto *p, char *iff);
void ospf_sh(struct proto *p);
void ospf_sh_iface(struct proto *p, char *iff);
......
This diff is collapsed.
/*
* BIRD -- OSPF
*
* (c) 1999 - 2000 Ondrej Filip <feela@network.cz>
* (c) 1999 - 2004 Ondrej Filip <feela@network.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
......@@ -9,19 +9,20 @@
#ifndef _BIRD_OSPF_TOPOLOGY_H_
#define _BIRD_OSPF_TOPOLOGY_H_
struct top_hash_entry { /* Index for fast mapping (type,rtrid,LSid)->vertex */
struct top_hash_entry
{ /* Index for fast mapping (type,rtrid,LSid)->vertex */
snode n;
node cn; /* For adding into list of candidates
* in intra-area routing table
* calculation
*/
struct top_hash_entry *next; /* Next in hash chain */
node cn; /* For adding into list of candidates
* in intra-area routing table
* calculation
*/
struct top_hash_entry *next; /* Next in hash chain */
struct ospf_lsa_header lsa;
void *lsa_body;
bird_clock_t inst_t; /* Time of installation into DB */
ip_addr nh; /* Next hop */
bird_clock_t inst_t; /* Time of installation into DB */
ip_addr nh; /* Next hop */
struct iface *nhi;
u16 dist; /* Distance from the root */
u16 dist; /* Distance from the root */
u16 ini_age;
u8 color;
#define OUTSPF 0
......@@ -31,9 +32,10 @@ struct top_hash_entry { /* Index for fast mapping (type,rtrid,LSid)->vertex */
u16 padding2;
};
struct top_graph {
pool *pool; /* Pool we allocate from */
slab *hash_slab; /* Slab for hash entries */
struct top_graph
{
pool *pool; /* Pool we allocate from */
slab *hash_slab; /* Slab for hash entries */
struct top_hash_entry **hash_table; /* Hashing (modelled a`la fib) */
unsigned int hash_size;
unsigned int hash_order;
......@@ -45,16 +47,20 @@ struct top_graph {
struct top_graph *ospf_top_new(pool *, struct proto_ospf *);
void ospf_top_free(struct top_graph *);
void ospf_top_dump(struct top_graph *, struct proto *);
struct top_hash_entry *ospf_hash_find_header(struct top_graph *f, struct ospf_lsa_header *h);
struct top_hash_entry *ospf_hash_get_header(struct top_graph *f, struct ospf_lsa_header *h);
struct top_hash_entry *ospf_hash_find(struct top_graph *, u32 lsa, u32 rtr, u32 type);
struct top_hash_entry *ospf_hash_get(struct top_graph *, u32 lsa, u32 rtr, u32 type);
struct top_hash_entry *ospf_hash_find_header(struct top_graph *f,
struct ospf_lsa_header *h);
struct top_hash_entry *ospf_hash_get_header(struct top_graph *f,
struct ospf_lsa_header *h);
struct top_hash_entry *ospf_hash_find(struct top_graph *, u32 lsa, u32 rtr,
u32 type);
struct top_hash_entry *ospf_hash_get(struct top_graph *, u32 lsa, u32 rtr,
u32 type);
void ospf_hash_delete(struct top_graph *, struct top_hash_entry *);
void addifa_rtlsa(struct ospf_iface *ifa);
void originate_rt_lsa(struct ospf_area *oa);
void originate_net_lsa(struct ospf_iface *ifa);
int can_flush_lsa(struct ospf_area *oa);
int max_ext_lsa(unsigned pxlen);
void originate_ext_lsa(net *n, rte *e, struct proto_ospf *po, struct ea_list *attrs);
void originate_ext_lsa(net * n, rte * e, struct proto_ospf *po,
struct ea_list *attrs);
#endif /* _BIRD_OSPF_TOPOLOGY_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment