Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

This commit is contained in:
Donald Sharp 2016-04-08 13:16:21 -04:00
commit 7707478a33
4 changed files with 26 additions and 2 deletions

View File

@ -171,6 +171,7 @@ extern void zlog_backtrace_sigsafe(int priority, void *program_counter);
It caches the most recent localtime result and can therefore It caches the most recent localtime result and can therefore
avoid multiple calls within the same second. If buflen is too small, avoid multiple calls within the same second. If buflen is too small,
*buf will be set to '\0', and 0 will be returned. */ *buf will be set to '\0', and 0 will be returned. */
#define QUAGGA_TIMESTAMP_LEN 40
extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */, extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */,
char *buf, size_t buflen); char *buf, size_t buflen);
@ -181,7 +182,7 @@ struct timestamp_control {
size_t len; /* length of rendered timestamp */ size_t len; /* length of rendered timestamp */
int precision; /* configuration parameter */ int precision; /* configuration parameter */
int already_rendered; /* should be initialized to 0 */ int already_rendered; /* should be initialized to 0 */
char buf[40]; /* will contain the rendered timestamp */ char buf[QUAGGA_TIMESTAMP_LEN]; /* will contain the rendered timestamp */
}; };
/* Defines for use in command construction: */ /* Defines for use in command construction: */

View File

@ -208,7 +208,7 @@ vty_log_out (struct vty *vty, const char *level, const char *proto_str,
void void
vty_time_print (struct vty *vty, int cr) vty_time_print (struct vty *vty, int cr)
{ {
char buf [25]; char buf[QUAGGA_TIMESTAMP_LEN];
if (quagga_timestamp(0, buf, sizeof(buf)) == 0) if (quagga_timestamp(0, buf, sizeof(buf)) == 0)
{ {

View File

@ -835,6 +835,12 @@ if_down_del_nbr_connected (struct interface *ifp)
void void
if_up (struct interface *ifp) if_up (struct interface *ifp)
{ {
struct zebra_if *zif;
zif = ifp->info;
zif->up_count++;
quagga_timestamp (2, zif->up_last, sizeof (zif->up_last));
/* Notify the protocol daemons. */ /* Notify the protocol daemons. */
if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) { if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) {
zlog_warn("%s: interface %s hasn't passed ptm check\n", __func__, zlog_warn("%s: interface %s hasn't passed ptm check\n", __func__,
@ -859,6 +865,12 @@ if_up (struct interface *ifp)
void void
if_down (struct interface *ifp) if_down (struct interface *ifp)
{ {
struct zebra_if *zif;
zif = ifp->info;
zif->down_count++;
quagga_timestamp (2, zif->down_last, sizeof (zif->down_last));
/* Notify to the protocol daemons. */ /* Notify to the protocol daemons. */
zebra_interface_down_update (ifp); zebra_interface_down_update (ifp);
@ -1035,6 +1047,11 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
vty_out (vty, "down%s", VTY_NEWLINE); vty_out (vty, "down%s", VTY_NEWLINE);
} }
vty_out (vty, " Link ups: %5u last: %s%s", zebra_if->up_count,
zebra_if->up_last[0] ? zebra_if->up_last : "(never)", VTY_NEWLINE);
vty_out (vty, " Link downs: %5u last: %s%s", zebra_if->down_count,
zebra_if->down_last[0] ? zebra_if->down_last : "(never)", VTY_NEWLINE);
zebra_ptm_show_status(vty, ifp); zebra_ptm_show_status(vty, ifp);
vrf = vrf_lookup(ifp->vrf_id); vrf = vrf_lookup(ifp->vrf_id);

View File

@ -189,6 +189,12 @@ struct zebra_if
/* Installed addresses chains tree. */ /* Installed addresses chains tree. */
struct route_table *ipv4_subnets; struct route_table *ipv4_subnets;
/* Information about up/down changes */
unsigned int up_count;
char up_last[QUAGGA_TIMESTAMP_LEN];
unsigned int down_count;
char down_last[QUAGGA_TIMESTAMP_LEN];
#if defined(HAVE_RTADV) #if defined(HAVE_RTADV)
struct rtadvconf rtadv; struct rtadvconf rtadv;
#endif /* HAVE_RTADV */ #endif /* HAVE_RTADV */