Nothing is using the per aspath counts in the RDE.
Remove them, makes the code simpler.
OK?
--
:wq Claudio
Index: rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.168
diff -u -p -r1.168 rde.h
--- rde.h 10 Feb 2018 05:54:31 -0000 1.168
+++ rde.h 21 Jun 2018 11:53:21 -0000
@@ -198,8 +198,6 @@ struct rde_aspath {
u_int32_t med; /* multi exit disc */
u_int32_t lpref; /* local pref */
u_int32_t weight; /* low prio lpref */
- u_int32_t prefix_cnt; /* # of prefixes */
- u_int32_t active_cnt; /* # of active prefixes */
u_int32_t flags; /* internally used */
u_int16_t rtlabelid; /* route label id */
u_int16_t pftableid; /* pf table id */
Index: rde_decide.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_decide.c,v
retrieving revision 1.67
diff -u -p -r1.67 rde_decide.c
--- rde_decide.c 5 Feb 2018 03:55:54 -0000 1.67
+++ rde_decide.c 21 Jun 2018 11:57:53 -0000
@@ -249,10 +249,8 @@ prefix_evaluate(struct prefix *p, struct
/* decision process is turned off */
if (p != NULL)
LIST_INSERT_HEAD(&re->prefix_h, p, rib_l);
- if (re->active != NULL) {
- prefix_aspath(re->active)->active_cnt--;
+ if (re->active != NULL)
re->active = NULL;
- }
return;
}
@@ -284,8 +282,6 @@ prefix_evaluate(struct prefix *p, struct
if (re->active != xp) {
/* need to generate an update */
- if (re->active != NULL)
- prefix_aspath(re->active)->active_cnt--;
/*
* Send update with remove for re->active and add for xp
@@ -297,7 +293,5 @@ prefix_evaluate(struct prefix *p, struct
rde_send_kroute(re_rib(re), xp, re->active);
re->active = xp;
- if (xp != NULL)
- prefix_aspath(xp)->active_cnt++;
}
}
Index: rde_rib.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
retrieving revision 1.159
diff -u -p -r1.159 rde_rib.c
--- rde_rib.c 10 Feb 2018 05:54:31 -0000 1.159
+++ rde_rib.c 21 Jun 2018 11:57:02 -0000
@@ -346,12 +346,6 @@ rib_restart(struct rib_context *ctx)
return (re);
}
-/* used to bump correct prefix counters */
-#define PREFIX_COUNT(x, op) \
- do { \
- (x)->prefix_cnt += (op); \
- } while (0)
-
/* path specific functions */
static struct rde_aspath *path_lookup(struct rde_aspath *, struct rde_peer *);
@@ -606,8 +600,8 @@ void
path_destroy(struct rde_aspath *asp)
{
/* path_destroy can only unlink and free empty rde_aspath */
- if (asp->prefix_cnt != 0 || asp->active_cnt != 0)
- log_warnx("path_destroy: prefix count out of sync");
+ if (!TAILQ_EMPTY(&asp->prefixes) || !TAILQ_EMPTY(&asp->updates))
+ log_warnx("path_destroy: still has prefixes, leaking");
nexthop_unlink(asp);
LIST_REMOVE(asp, path_l);
@@ -793,7 +787,6 @@ prefix_move(struct rde_aspath *asp, stru
TAILQ_INSERT_HEAD(&asp->updates, np, path_l);
else
TAILQ_INSERT_HEAD(&asp->prefixes, np, path_l);
- PREFIX_COUNT(asp, 1);
/*
* no need to update the peer prefix count because we are only moving
* the prefix without changing the peer.
@@ -816,7 +809,6 @@ prefix_move(struct rde_aspath *asp, stru
TAILQ_REMOVE(&oasp->updates, p, path_l);
else
TAILQ_REMOVE(&oasp->prefixes, p, path_l);
- PREFIX_COUNT(oasp, -1);
/* as before peer count needs no update because of move */
/* destroy all references to other objects and free the old prefix */
@@ -939,7 +931,7 @@ prefix_writebuf(struct ibuf *buf, struct
}
/*
- * Searches in the prefix list of specified pt_entry for a prefix entry
+ * Searches in the prefix list of specified rib_entry for a prefix entry
* belonging to the peer peer. Returns NULL if no match found.
*/
struct prefix *
@@ -1010,7 +1002,6 @@ prefix_destroy(struct prefix *p)
struct rde_aspath *asp;
asp = prefix_aspath(p);
- PREFIX_COUNT(asp, -1);
prefix_unlink(p);
prefix_free(p);
@@ -1035,7 +1026,6 @@ prefix_network_clean(struct rde_peer *pe
for (p = TAILQ_FIRST(&asp->prefixes); p != NULL; p = xp) {
xp = TAILQ_NEXT(p, path_l);
if (reloadtime > p->lastchange) {
- PREFIX_COUNT(asp, -1);
prefix_unlink(p);
prefix_free(p);
}
@@ -1056,7 +1046,6 @@ prefix_link(struct prefix *pref, struct
TAILQ_INSERT_HEAD(&asp->updates, pref, path_l);
else
TAILQ_INSERT_HEAD(&asp->prefixes, pref, path_l);
- PREFIX_COUNT(asp, 1);
pref->_p._aspath = asp;
pref->re = re;