summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2018-06-21 17:26:16 +0000
committerclaudio <claudio@openbsd.org>2018-06-21 17:26:16 +0000
commit494ab9ef89b3fef10cbb3a2b87b254580cf9842b (patch)
treefb8f3248e7f69911212c41b4efd3c05505f31232
parentAdd 6to4 anycast prefixes to bogon filter (diff)
downloadwireguard-openbsd-494ab9ef89b3fef10cbb3a2b87b254580cf9842b.tar.xz
wireguard-openbsd-494ab9ef89b3fef10cbb3a2b87b254580cf9842b.zip
Nothing is using the active and prefix count in struct rde_aspath.
Remove them to make the code simpler. OK deraadt@ gsoares@
-rw-r--r--usr.sbin/bgpd/rde.h4
-rw-r--r--usr.sbin/bgpd/rde_decide.c10
-rw-r--r--usr.sbin/bgpd/rde_rib.c19
3 files changed, 7 insertions, 26 deletions
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h
index caf682a55e1..39a2359f499 100644
--- a/usr.sbin/bgpd/rde.h
+++ b/usr.sbin/bgpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.168 2018/02/10 05:54:31 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.169 2018/06/21 17:26:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
@@ -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 */
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index 846ed0653fb..098a0f466fd 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.67 2018/02/05 03:55:54 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.68 2018/06/21 17:26:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -249,10 +249,8 @@ prefix_evaluate(struct prefix *p, struct rib_entry *re)
/* 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 rib_entry *re)
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 rib_entry *re)
rde_send_kroute(re_rib(re), xp, re->active);
re->active = xp;
- if (xp != NULL)
- prefix_aspath(xp)->active_cnt++;
}
}
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index fa84dadc53b..0483e67d4d7 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.159 2018/02/10 05:54:31 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.160 2018/06/21 17:26:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -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, struct prefix *p, int flag)
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, struct prefix *p, int flag)
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 bgpd_addr *prefix, u_int8_t plen)
}
/*
- * 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 *peer, time_t reloadtime, u_int32_t flags)
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 rib_entry *re, struct rde_aspath *asp,
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;