[ospfd] Bug #134, ospfd should be more robust to backward time change
2006-08-25 Paul Jakma <paul.jakma@sun.com>
* (general) Bug #134. Be more robust to backward time changes,
use the newly added libzebra time functions.
In most cases: recent_time -> recent_relative_time()
gettimeofday -> quagga_gettime (QUAGGA_CLK_MONOTONIC, ..)
time -> quagga_time.
(ospf_make_md5_digest) time() call deliberately not changed.
(ospf_external_lsa_refresh) remove useless gettimeofday, LSA
tv_orig time was already set in ospf_lsa_new, called via
ospf_external_lsa_new.
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 912f1d0..04e1df4 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -2691,7 +2691,7 @@
vty_out (vty, " SPF algorithm ");
if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec)
{
- result = tv_sub (recent_time, ospf->ts_spf);
+ result = tv_sub (recent_relative_time (), ospf->ts_spf);
vty_out (vty, "last executed %s ago%s",
ospf_timeval_dump (&result, timebuf, sizeof (timebuf)),
VTY_NEWLINE);
@@ -3157,7 +3157,8 @@
vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec)
{
- struct timeval res = tv_sub (recent_time, nbr->ts_last_progress);
+ struct timeval res
+ = tv_sub (recent_relative_time (), nbr->ts_last_progress);
vty_out (vty, " Most recent state change statistics:%s",
VTY_NEWLINE);
vty_out (vty, " Progressive change %s ago%s",
@@ -3166,7 +3167,8 @@
}
if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec)
{
- struct timeval res = tv_sub (recent_time, nbr->ts_last_regress);
+ struct timeval res
+ = tv_sub (recent_relative_time (), nbr->ts_last_regress);
vty_out (vty, " Regressive change %s ago, due to %s%s",
ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
(nbr->last_regress_str ? nbr->last_regress_str : "??"),