]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: Fix json Crash with inactive timer
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 2 Dec 2016 13:19:26 +0000 (08:19 -0500)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 2 Dec 2016 15:59:02 +0000 (16:59 +0100)
When nbr->t_inactivity is not active, and
you do a show json over the neighbor it
will crash ospfd.  Fix the code so it
prints out -1 when the timer is inactive.

Ticket:CM-13835
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
(cherry picked from commit 78d8fcb9623ab4d9cebf6187a451448e056a84bf)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd/ospf_vty.c

index 43a443421f9f811daf89bec4e7ec1d38ff01d7be..4eeb5c15d99777775360db333896c6a52cbb3c2d 100644 (file)
@@ -4590,10 +4590,15 @@ show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
   /* Show Router Dead interval timer. */
   if (use_json)
     {
-      struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
-      unsigned long time_store = 0;
-      time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
-      json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+      if (nbr->t_inactivity)
+       {
+         struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
+         unsigned long time_store = 0;
+         time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
+         json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+       }
+      else
+       json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", -1);
     }
   else
     vty_out (vty, "    Dead timer due in %s%s",