From: David Lamparter Date: Thu, 7 Sep 2017 13:27:12 +0000 (+0200) Subject: bgpd: add comment on bgp_attr_intern X-Git-Tag: frr-4.0-dev~327^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=dbbac180c111d55b473b2352d95ef3a17695a7db;p=mirror%2Ffrr.git bgpd: add comment on bgp_attr_intern This is confusing enough to warrant a comment. Signed-off-by: David Lamparter --- diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index fe43afeb39..97b6273cb4 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -690,6 +690,12 @@ struct attr *bgp_attr_intern(struct attr *attr) } #endif + /* At this point, attr only contains intern'd pointers. that means + * if we find it in attrhash, it has all the same pointers and we + * correctly updated the refcounts on these. + * If we don't find it, we need to allocate a one because in all + * cases this returns a new reference to a hashed attr, but the input + * wasn't on hash. */ find = (struct attr *)hash_get(attrhash, attr, bgp_attr_hash_alloc); find->refcnt++;