]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Introduce mroute_creation in channel oil data structure 4053/head
authorSarita Patra <saritap@vmware.com>
Mon, 1 Apr 2019 06:38:28 +0000 (23:38 -0700)
committerSarita Patra <saritap@vmware.com>
Mon, 1 Apr 2019 06:38:28 +0000 (23:38 -0700)
Issue: (*,G) mroute uptime is not updated in mroute table,
after deleting and adding the RP

Root cause: When RP gets deleted or becomes not reachable, then
we un-install the entry from the kernel, but still maintains the
entry in the stack. When  RP gets re-configured or becomes reachable,
"show ip mroute" shows the uptime, when the channel_oil gets created.

Fix: Introduce a new time mroute_creation in the channel_oil, gets
updated when mroute gets installed in the kernel.

Signed-off-by: Sarita Patra <saritap@vmware.com>
pimd/pim_cmd.c
pimd/pim_mroute.c
pimd/pim_oil.h

index f9140802fbb07545d9447b289f040443ac490232..70b3ae10e58ff2c6222912ef89e016345e68b606 100644 (file)
@@ -4594,7 +4594,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill,
                for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
                     ++oif_vif_index) {
                        struct interface *ifp_out;
-                       char oif_uptime[10];
+                       char mroute_uptime[10];
                        int ttl;
 
                        ttl = c_oil->oil.mfcc_ttls[oif_vif_index];
@@ -4603,8 +4603,8 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill,
 
                        ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index);
                        pim_time_uptime(
-                               oif_uptime, sizeof(oif_uptime),
-                               now - c_oil->oif_creation[oif_vif_index]);
+                               mroute_uptime, sizeof(mroute_uptime),
+                               now - c_oil->mroute_creation);
                        found_oif = 1;
 
                        if (ifp_out)
@@ -4652,7 +4652,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill,
                                                    oif_vif_index);
                                json_object_int_add(json_ifp_out, "ttl", ttl);
                                json_object_string_add(json_ifp_out, "upTime",
-                                                      oif_uptime);
+                                                      mroute_uptime);
                                if (!json_oil) {
                                        json_oil = json_object_new_object();
                                        json_object_object_add(json_source,
@@ -4684,7 +4684,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill,
                                vty_out(vty,
                                        "%-15s %-15s %-6s %-16s %-16s %-3d  %8s\n",
                                        src_str, grp_str, proto, in_ifname,
-                                       out_ifname, ttl, oif_uptime);
+                                       out_ifname, ttl, mroute_uptime);
 
                                if (first) {
                                        src_str[0] = '\0';
index 67b1a95f74789c8dac64d6f193c6e69a627e6279..b5e773fb592b7ba22b020fdb2e8c7a454ed34711 100644 (file)
@@ -964,6 +964,8 @@ int pim_mroute_add(struct channel_oil *c_oil, const char *name)
        }
 
        c_oil->installed = 1;
+       c_oil->mroute_creation = pim_time_monotonic_sec();
+
        return 0;
 }
 
index 5dd4e8b326a38e963a545507b49a38629257b3f8..8b95324142c23f4f5c2261228fb14b7d9a9e37cd 100644 (file)
@@ -97,6 +97,7 @@ struct channel_oil {
        uint32_t oif_flags[MAXVIFS];
        struct channel_counts cc;
        struct pim_upstream *up;
+       time_t mroute_creation;
 };
 
 extern struct list *pim_channel_oil_list;