]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: add comment on bgp_attr_intern
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 7 Sep 2017 13:27:12 +0000 (15:27 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 7 Sep 2017 13:29:32 +0000 (15:29 +0200)
This is confusing enough to warrant a comment.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_attr.c

index fe43afeb394996f0872ee9f3926333d7476ee6a6..97b6273cb4733b8a3e4634ff3a55d1f372fc7977 100644 (file)
@@ -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++;