summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--proto/ospf/lsupd.c11
-rw-r--r--proto/ospf/lsupd.h3
-rw-r--r--proto/ospf/ospf.c49
-rw-r--r--proto/ospf/topology.c2
-rw-r--r--proto/ospf/topology.h1
5 files changed, 54 insertions, 12 deletions
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index 002dea0..6ae6866 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -434,3 +434,14 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
}
}
+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);
+}
+
diff --git a/proto/ospf/lsupd.h b/proto/ospf/lsupd.h
index a03ed8c..56368ba 100644
--- a/proto/ospf/lsupd.h
+++ b/proto/ospf/lsupd.h
@@ -16,5 +16,8 @@ void ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
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_ */
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 7e04a51..fde33f5 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -112,12 +112,6 @@ ospf_rte_same(struct rte *new, struct rte *old)
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)
{
@@ -129,6 +123,32 @@ ospf_import_control(struct proto *p, rte **new, ea_list **attrs, struct linpool
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)
{
@@ -139,13 +159,20 @@ 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);
+ }
}
}
@@ -155,5 +182,5 @@ struct protocol proto_ospf = {
init: ospf_init,
dump: ospf_dump,
start: ospf_start,
- postconfig: ospf_postconfig,
+ shutdown: ospf_shutdown
};
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index c02b0b7..f54c63b 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -350,7 +350,7 @@ originate_ext_lsa_body(net *n, rte *e, struct proto_ospf *po)
}
void
-originate_ext_lsa(net *n, rte *e, u16 *len, struct proto_ospf *po)
+originate_ext_lsa(net *n, rte *e, struct proto_ospf *po)
{
struct ospf_lsa_header lsa;
u32 rtid=po->proto.cf->global->router_id;
diff --git a/proto/ospf/topology.h b/proto/ospf/topology.h
index 92b7143..23620b8 100644
--- a/proto/ospf/topology.h
+++ b/proto/ospf/topology.h
@@ -49,5 +49,6 @@ void addifa_rtlsa(struct ospf_iface *ifa);
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_ */