summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_snmp.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2010-01-15 14:22:10 +0100
committerDenis Ovsienko <infrastation@yandex.ru>2010-01-15 14:22:10 +0100
commit65957886bfd0dd9d95360d8b015781fc82cc09be (patch)
tree71352e214bd59277a50a43779bb2cbafbace6cc3 /bgpd/bgp_snmp.c
parentospfd: Fix debug messages that were masked by DISCARD_LSA (diff)
downloadfrr-65957886bfd0dd9d95360d8b015781fc82cc09be.tar.xz
frr-65957886bfd0dd9d95360d8b015781fc82cc09be.zip
bgp: use monotonic clock for time of day
BGP uses time() to get system time of day; but that value fluctuates with time adjustments from NTP. This can cause premature flapping of peer sessions and other failures. Use the system monotonic clock supported by Quagga thread library to avoid issue. See: http://bugzilla.vyatta.com/show_bug.cgi?id=4467 * bgpd/bgp_fsm.c * bgp_uptime_reset(): dismiss function * bgpd/bgpd.c * bgp_clock(): new function * bgpd/bgp_damp.c * bgp_reuse_timer(): employ bgp_clock() instead of time(NULL) * bgp_damp_withdraw(): idem * bgp_damp_update(): idem * bgp_damp_scan(): idem * bgp_damp_info_vty(): idem * bgp_damp_reuse_time_vty(): idem * bgpd/bgp_fsm.c * bgp_routeadv_timer(): idem * bgp_stop(): idem * bgp_establish(): idem * bgpd/bgp_packet.c * bgp_update_receive(): idem * bgpd/bgp_route.c * bgp_update_rsclient(): idem * bgp_update_main(): idem * bgp_static_update_rsclient(): idem * bgp_static_update_main(): idem * bgp_static_update_vpnv4(): idem * bgp_aggregate_route(): idem * bgp_aggregate_add(): idem * bgp_redistribute_add(): idem * bgpd/bgp_snmp.c * bgpPeerTable(): idem * bgpTrapEstablished(): idem * bgpTrapBackwardTransition(): idem * bgpd/bgpd.c * peer_create(): idem * peer_uptime(): idem * bgp_master_init(): idem
Diffstat (limited to 'bgpd/bgp_snmp.c')
-rw-r--r--bgpd/bgp_snmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 1e37f266a..86cc08794 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -546,7 +546,7 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length,
if (peer->uptime == 0)
return SNMP_INTEGER (0);
else
- return SNMP_INTEGER (time (NULL) - peer->uptime);
+ return SNMP_INTEGER (bgp_clock () - peer->uptime);
break;
case BGPPEERCONNECTRETRYINTERVAL:
*write_method = write_bgpPeerTable;
@@ -584,7 +584,7 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length,
if (peer->update_time == 0)
return SNMP_INTEGER (0);
else
- return SNMP_INTEGER (time (NULL) - peer->update_time);
+ return SNMP_INTEGER (bgp_clock () - peer->update_time);
break;
default:
return NULL;
@@ -859,7 +859,7 @@ bgpTrapEstablished (struct peer *peer)
smux_trap (bgp_oid, sizeof bgp_oid / sizeof (oid),
index, IN_ADDR_SIZE,
bgpTrapList, sizeof bgpTrapList / sizeof (struct trap_object),
- bm->start_time - time (NULL), BGPESTABLISHED);
+ bm->start_time - bgp_clock (), BGPESTABLISHED);
}
void
@@ -878,7 +878,7 @@ bgpTrapBackwardTransition (struct peer *peer)
smux_trap (bgp_oid, sizeof bgp_oid / sizeof (oid),
index, IN_ADDR_SIZE,
bgpTrapList, sizeof bgpTrapList / sizeof (struct trap_object),
- bm->start_time - time (NULL), BGPBACKWARDTRANSITION);
+ bm->start_time - bgp_clock (), BGPBACKWARDTRANSITION);
}
void