]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: remove refcnt from the route_entry structure
authorRenato Westphal <renato@opensourcerouting.org>
Thu, 31 Aug 2017 23:36:14 +0000 (20:36 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 1 Sep 2017 00:17:11 +0000 (21:17 -0300)
This reference counter was introduced in 2001, apparently to solve a
problem with connected routes being added/removed multiple times. The RIB
code changed a lot since then, and giving the current callers of rib_add()
and rib_delete() it's safe to assume that we don't need this anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_vty.c

index 9b1ce23b082e3ca4f19895cac08f47f7308df82b..4cc69377d8abc52216e541a147c412926dcfda41 100644 (file)
@@ -45,9 +45,6 @@ struct route_entry {
        /* Nexthop structure */
        struct nexthop *nexthop;
 
-       /* Refrence count. */
-       unsigned long refcnt;
-
        /* Tag */
        route_tag_t tag;
 
index bcf21783ae490e35754f19b5432105c0fceef524..c9e770e2042f3ff8cb434858736efda124b96304 100644 (file)
@@ -2061,10 +2061,9 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
                   is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr))
                             : "",
                   re->vrf_id);
-       zlog_debug(
-               "%s: refcnt == %lu, uptime == %lu, type == %u, instance == %d, table == %d",
-               func, re->refcnt, (unsigned long)re->uptime, re->type,
-               re->instance, re->table);
+       zlog_debug("%s: uptime == %lu, type == %u, instance == %d, table == %d",
+                  func, (unsigned long)re->uptime, re->type, re->instance,
+                  re->table);
        zlog_debug(
                "%s: metric == %u, mtu == %u, distance == %u, flags == %u, status == %u",
                func, re->metric, re->mtu, re->distance, re->flags, re->status);
@@ -2335,12 +2334,6 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
                    && rtnh->type == NEXTHOP_TYPE_IFINDEX && nh) {
                        if (rtnh->ifindex != nh->ifindex)
                                continue;
-                       if (re->refcnt) {
-                               re->refcnt--;
-                               route_unlock_node(rn);
-                               route_unlock_node(rn);
-                               return;
-                       }
                        same = re;
                        break;
                }
@@ -2480,7 +2473,6 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
                         && rtnh->type == NEXTHOP_TYPE_IFINDEX
                         && rtnh->ifindex == nh->ifindex
                         && !CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
-                       re->refcnt++;
                        return 0;
                }
        }
index 98ce98534492795d4cdf0d8e5af31b499cfd3682..95ba19b1f62b535e4fffc46f8c92fafd5bdbb30f 100644 (file)
@@ -402,8 +402,6 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
                }
                if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
                        vty_out(vty, ", best");
-               if (re->refcnt)
-                       vty_out(vty, ", refcnt %ld", re->refcnt);
                vty_out(vty, "\n");
 
                if (re->type == ZEBRA_ROUTE_RIP || re->type == ZEBRA_ROUTE_OSPF