ospfd: Fix maxage/flush to not try flood twice, remember maxages for longer

2006-05-30 Paul Jakma <paul.jakma@sun.com>

	* (general) Fix confusion around MaxAge-ing and problem with
	  high-latency networks. Analysis and suggested fixes by
	  Phillip Spagnolo, in [quagga-dev 4132], on which this commit
	  expands slightly.
	* ospf_flood.{c,h}: (ospf_lsa_flush) new function.
	  Scope-general form of existing flush functions, essentially
	  the dormant ospf_maxage_flood() but without the ambiguity of
	  whether it is responsible for flooding.
	* ospf_lsa.c: (ospf_lsa_maxage) Role minimised to simply setup
	  LSA on the Maxage list and schedule removal - no more.
	  ospf_lsa_flush* being the primary way to kick-off flushes
	  of LSAs.
	  Don't hardcode the remover-timer value, which was too
	  short for very high-latency networks.
	  (ospf_maxage_lsa_remover) Just do what needs to be done to
	  remove maxage LSAs from the maxage list, remove the call
	  to ospf_flood_through().
	  Don't hardcode remove-timer value.
	  (ospf_lsa_{install,flush_schedule}) ospf_lsa_flush is the correct
	  entrypoint to flushing maxaged LSAs.
	  (lsa_header_set) Use a define for the initial age, useful for
	  testing.
	* ospf_opaque.c: (ospf_opaque_lsa_refresh) ditto.
	  (ospf_opaque_lsa_flush_schedule) ditto.
	* ospfd.h: ({struct ospf,ospf_new}) Add maxage_delay parameter,
	  interval to wait before running the maxage_remover. Supply a
	  suitable default.
	  Add a define for OSPF_LSA_INITIAL_AGE, see lsa_header_set().
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index b7dc676..0e57c45 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -58,6 +58,7 @@
 #endif
 #define OSPF_MIN_LS_INTERVAL                     5
 #define OSPF_MIN_LS_ARRIVAL                      1
+#define OSPF_LSA_INITIAL_AGE                     0	/* useful for debug */
 #define OSPF_LSA_MAXAGE                       3600
 #define OSPF_CHECK_AGE                         300
 #define OSPF_LSA_MAXAGE_DIFF                   900
@@ -66,7 +67,6 @@
 #define OSPF_INITIAL_SEQUENCE_NUMBER    0x80000001
 #define OSPF_MAX_SEQUENCE_NUMBER        0x7fffffff
 
-#define OSPF_LSA_MAXAGE_CHECK_INTERVAL          30
 #define OSPF_NSSA_TRANS_STABLE_DEFAULT		40
 
 #define OSPF_ALLSPFROUTERS              0xe0000005      /* 224.0.0.5 */
@@ -260,8 +260,13 @@
 #ifdef HAVE_OPAQUE_LSA
   struct thread *t_opaque_lsa_self;	/* Type-11 Opaque-LSAs origin event. */
 #endif /* HAVE_OPAQUE_LSA */
+
+#define OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT	60
+  unsigned int maxage_delay;		/* Delay on Maxage remover timer, sec */
   struct thread *t_maxage;              /* MaxAge LSA remover timer. */
+#define OSPF_LSA_MAXAGE_CHECK_INTERVAL		30
   struct thread *t_maxage_walker;       /* MaxAge LSA checking timer. */
+
   struct thread *t_deferred_shutdown;	/* deferred/stub-router shutdown timer*/
 
   struct thread *t_write;