summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-02-08 14:34:48 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-02-08 14:34:48 +0100
commitc259669fa33ca13b5c6ae60eb8ffa0874ddc01b2 (patch)
tree09003c2fa4d614b1e4f1fb10d16fba21acb56b4d /proto/bgp
parent82f42ea09176afdb67ab119258d714e8c8e54d12 (diff)
parentda65a3d898fde0ce567782d86919a66e29916ed7 (diff)
Merge branch 'master' into int-new
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c14
-rw-r--r--proto/bgp/bgp.c4
2 files changed, 16 insertions, 2 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index d5bf2add..73318c6a 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1224,6 +1224,15 @@ bgp_init_prefix_table(struct bgp_channel *c)
c->prefix_slab = alen ? sl_new(c->pool, sizeof(struct bgp_prefix) + alen) : NULL;
}
+void
+bgp_free_prefix_table(struct bgp_channel *c)
+{
+ HASH_FREE(c->prefix_hash);
+
+ rfree(c->prefix_slab);
+ c->prefix_slab = NULL;
+}
+
static struct bgp_prefix *
bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id)
{
@@ -1323,6 +1332,7 @@ bgp_import_control(struct proto *P, rte **new, ea_list **attrs UNUSED, struct li
return 0;
}
+
static adata null_adata; /* adata of length 0 */
static ea_list *
@@ -1394,11 +1404,11 @@ bgp_update_attrs(struct bgp_proto *p, struct bgp_channel *c, rte *e, ea_list *at
/* Prepend src cluster ID */
if (src->rr_cluster_id)
- ad = int_set_add(pool, ad, src->rr_cluster_id);
+ ad = int_set_prepend(pool, ad, src->rr_cluster_id);
/* Prepend dst cluster ID if src and dst clusters are different */
if (p->rr_cluster_id && (src->rr_cluster_id != p->rr_cluster_id))
- ad = int_set_add(pool, ad, p->rr_cluster_id);
+ ad = int_set_prepend(pool, ad, p->rr_cluster_id);
/* Should be at least one prepended cluster ID */
bgp_set_attr_ptr(&attrs, pool, BA_CLUSTER_LIST, 0, ad);
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 61d24f42..5e95e6b4 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -559,6 +559,10 @@ bgp_conn_leave_established_state(struct bgp_proto *p)
BGP_TRACE(D_EVENTS, "BGP session closed");
p->conn = NULL;
+ // XXXX free these tables to avoid memory leak during graceful restart
+ // bgp_free_prefix_table(p);
+ // bgp_free_bucket_table(p);
+
if (p->p.proto_state == PS_UP)
bgp_stop(p, 0);
}