}
}
+void
+net_flush_lsa(struct top_hash_entry *en, struct proto_ospf *po,
+ struct ospf_area *oa)
+{
+ struct ospf_lsa_header *lsa=&en->lsa;
+
+ lsa->age=LSA_MAXAGE;
+ debug("Premature aging self originated lsa.\n");
+ flood_lsa(NULL,NULL,lsa,po,NULL,oa);
+}
+
int flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
struct ospf_lsa_header *hh, struct proto_ospf *po, struct ospf_iface *iff,
struct ospf_area *oa);
+void net_flush_lsa(struct top_hash_entry *en, struct proto_ospf *po,
+ struct ospf_area *oa);
+
#endif /* _BIRD_OSPF_LSUPD_H_ */
return 1;
}
-static void
-ospf_postconfig(struct proto_config *c)
-{
- DBG( " OSPF: postconfig\n" );
-}
-
int
ospf_import_control(struct proto *p, rte **new, ea_list **attrs, struct linpool *pool)
{
return 0;
}
+static int
+ospf_shutdown(struct proto *p)
+{
+ struct proto_ospf *po=(struct proto_ospf *)p;
+ struct ospf_iface *ifa;
+ struct ospf_neighbor *n;
+ struct ospf_area *oa;
+ debug("%s: Shutdown requested\n", p->name);
+ /* first of all flush my rt LSA */
+
+ WALK_LIST(oa,po->area_list)
+ {
+ net_flush_lsa(oa->rt,po,oa);
+ }
+
+
+ /* And send to all my neighbors 1WAY */
+ WALK_LIST(ifa, po->iface_list)
+ {
+ WALK_LIST(n, ifa->neigh_list) neigh_chstate(n,NEIGHBOR_DOWN);
+ hello_timer_hook(ifa->hello_timer);
+ }
+
+ return PS_DOWN;
+}
+
void
ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old, ea_list *attrs)
{
if(new) /* Got some new route */
{
- int i;
- /* Originate new external LSA */
+ originate_ext_lsa(n, old, po);
}
else
{
- int i;
- /* Flush some old external LSA */
+ u32 rtid=po->proto.cf->global->router_id;
+ struct ospf_area *oa;
+ struct top_hash_entry *en;
+
+ /* Flush old external LSA */
+ WALK_LIST(oa, po->area_list)
+ {
+ if(en=ospf_hash_find(oa->gr, ipa_to_u32(n->n.prefix), rtid, LSA_T_EXT))
+ net_flush_lsa(en,po,oa);
+ }
}
}
init: ospf_init,
dump: ospf_dump,
start: ospf_start,
- postconfig: ospf_postconfig,
+ shutdown: ospf_shutdown
};
void originate_rt_lsa(struct ospf_area *oa,struct proto_ospf *po);
void originate_net_lsa(struct ospf_iface *ifa,struct proto_ospf *po);
int can_flush_lsa(struct ospf_area *oa);
+void originate_ext_lsa(net *n, rte *e, struct proto_ospf *po);
#endif /* _BIRD_OSPF_TOPOLOGY_H_ */