1 /* Community attribute related functions.
2 * Copyright (C) 1998, 2001 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #include "bgpd/bgp_memory.h"
29 #include "bgpd/bgp_community.h"
31 /* Hash of community attribute. */
32 static struct hash
*comhash
;
34 /* Allocate a new communities value. */
35 static struct community
*community_new(void)
37 return XCALLOC(MTYPE_COMMUNITY
, sizeof(struct community
));
40 /* Free communities value. */
41 void community_free(struct community
**com
)
43 XFREE(MTYPE_COMMUNITY_VAL
, (*com
)->val
);
44 XFREE(MTYPE_COMMUNITY_STR
, (*com
)->str
);
47 json_object_free((*com
)->json
);
51 XFREE(MTYPE_COMMUNITY
, (*com
));
54 /* Add one community value to the community. */
55 static void community_add_val(struct community
*com
, uint32_t val
)
59 com
->val
= XREALLOC(MTYPE_COMMUNITY_VAL
, com
->val
,
62 com
->val
= XMALLOC(MTYPE_COMMUNITY_VAL
, com_length(com
));
65 memcpy(com_lastval(com
), &val
, sizeof(uint32_t));
68 /* Delete one community. */
69 void community_del_val(struct community
*com
, uint32_t *val
)
77 while (i
< com
->size
) {
78 if (memcmp(com
->val
+ i
, val
, sizeof(uint32_t)) == 0) {
79 c
= com
->size
- i
- 1;
82 memmove(com
->val
+ i
, com
->val
+ (i
+ 1),
88 com
->val
= XREALLOC(MTYPE_COMMUNITY_VAL
,
89 com
->val
, com_length(com
));
91 XFREE(MTYPE_COMMUNITY_VAL
, com
->val
);
99 /* Delete all communities listed in com2 from com1 */
100 struct community
*community_delete(struct community
*com1
,
101 struct community
*com2
)
105 while (i
< com2
->size
) {
106 community_del_val(com1
, com2
->val
+ i
);
113 /* Callback function from qsort(). */
114 static int community_compare(const void *a1
, const void *a2
)
119 memcpy(&v1
, a1
, sizeof(uint32_t));
120 memcpy(&v2
, a2
, sizeof(uint32_t));
131 bool community_include(struct community
*com
, uint32_t val
)
137 for (i
= 0; i
< com
->size
; i
++)
138 if (memcmp(&val
, com_nthval(com
, i
), sizeof(uint32_t)) == 0)
143 uint32_t community_val_get(struct community
*com
, int i
)
148 p
= (uint8_t *)com
->val
;
149 p
+= (i
* COMMUNITY_SIZE
);
151 memcpy(&val
, p
, sizeof(uint32_t));
156 /* Sort and uniq given community. */
157 struct community
*community_uniq_sort(struct community
*com
)
160 struct community
*new;
166 new = community_new();
169 for (i
= 0; i
< com
->size
; i
++) {
170 val
= community_val_get(com
, i
);
172 if (!community_include(new, val
))
173 community_add_val(new, val
);
176 qsort(new->val
, new->size
, sizeof(uint32_t), community_compare
);
181 /* Convert communities attribute to string.
183 For Well-known communities value, below keyword is used.
186 0xFFFF0000 "graceful-shutdown"
187 0xFFFF0001 "accept-own"
188 0xFFFF0002 "route-filter-translated-v4"
189 0xFFFF0003 "route-filter-v4"
190 0xFFFF0004 "route-filter-translated-v6"
191 0xFFFF0005 "route-filter-v6"
192 0xFFFF0006 "llgr-stale"
194 0xFFFF0008 "accept-own-nexthop"
195 0xFFFF029A "blackhole"
196 0xFFFFFF01 "no-export"
197 0xFFFFFF02 "no-advertise"
198 0xFFFFFF03 "local-AS"
201 For other values, "AS:VAL" format is used. */
202 static void set_community_string(struct community
*com
, bool make_json
)
211 json_object
*json_community_list
= NULL
;
212 json_object
*json_string
= NULL
;
218 com
->json
= json_object_new_object();
219 json_community_list
= json_object_new_array();
222 /* When communities attribute is empty. */
223 if (com
->size
== 0) {
224 str
= XMALLOC(MTYPE_COMMUNITY_STR
, 1);
228 json_object_string_add(com
->json
, "string", "");
229 json_object_object_add(com
->json
, "list",
230 json_community_list
);
236 /* Memory allocation is time consuming work. So we calculate
237 required string length first. */
240 for (i
= 0; i
< com
->size
; i
++) {
241 memcpy(&comval
, com_nthval(com
, i
), sizeof(uint32_t));
242 comval
= ntohl(comval
);
245 case COMMUNITY_INTERNET
:
246 len
+= strlen(" internet");
248 case COMMUNITY_GSHUT
:
249 len
+= strlen(" graceful-shutdown");
251 case COMMUNITY_ACCEPT_OWN
:
252 len
+= strlen(" accept-own");
254 case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4
:
255 len
+= strlen(" route-filter-translated-v4");
257 case COMMUNITY_ROUTE_FILTER_v4
:
258 len
+= strlen(" route-filter-v4");
260 case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6
:
261 len
+= strlen(" route-filter-translated-v6");
263 case COMMUNITY_ROUTE_FILTER_v6
:
264 len
+= strlen(" route-filter-v6");
266 case COMMUNITY_LLGR_STALE
:
267 len
+= strlen(" llgr-stale");
269 case COMMUNITY_NO_LLGR
:
270 len
+= strlen(" no-llgr");
272 case COMMUNITY_ACCEPT_OWN_NEXTHOP
:
273 len
+= strlen(" accept-own-nexthop");
275 case COMMUNITY_BLACKHOLE
:
276 len
+= strlen(" blackhole");
278 case COMMUNITY_NO_EXPORT
:
279 len
+= strlen(" no-export");
281 case COMMUNITY_NO_ADVERTISE
:
282 len
+= strlen(" no-advertise");
284 case COMMUNITY_LOCAL_AS
:
285 len
+= strlen(" local-AS");
287 case COMMUNITY_NO_PEER
:
288 len
+= strlen(" no-peer");
291 len
+= strlen(" 65536:65535");
296 /* Allocate memory. */
297 str
= XCALLOC(MTYPE_COMMUNITY_STR
, len
);
300 /* Fill in string. */
301 for (i
= 0; i
< com
->size
; i
++) {
302 memcpy(&comval
, com_nthval(com
, i
), sizeof(uint32_t));
303 comval
= ntohl(comval
);
308 strlcat(str
, " ", len
);
311 case COMMUNITY_INTERNET
:
312 strlcat(str
, "internet", len
);
315 json_object_new_string("internet");
316 json_object_array_add(json_community_list
,
320 case COMMUNITY_GSHUT
:
321 strlcat(str
, "graceful-shutdown", len
);
323 json_string
= json_object_new_string(
325 json_object_array_add(json_community_list
,
329 case COMMUNITY_ACCEPT_OWN
:
330 strlcat(str
, "accept-own", len
);
332 json_string
= json_object_new_string(
334 json_object_array_add(json_community_list
,
338 case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4
:
339 strlcat(str
, "route-filter-translated-v4", len
);
341 json_string
= json_object_new_string(
342 "routeFilterTranslatedV4");
343 json_object_array_add(json_community_list
,
347 case COMMUNITY_ROUTE_FILTER_v4
:
348 strlcat(str
, "route-filter-v4", len
);
350 json_string
= json_object_new_string(
352 json_object_array_add(json_community_list
,
356 case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6
:
357 strlcat(str
, "route-filter-translated-v6", len
);
359 json_string
= json_object_new_string(
360 "routeFilterTranslatedV6");
361 json_object_array_add(json_community_list
,
365 case COMMUNITY_ROUTE_FILTER_v6
:
366 strlcat(str
, "route-filter-v6", len
);
368 json_string
= json_object_new_string(
370 json_object_array_add(json_community_list
,
374 case COMMUNITY_LLGR_STALE
:
375 strlcat(str
, "llgr-stale", len
);
377 json_string
= json_object_new_string(
379 json_object_array_add(json_community_list
,
383 case COMMUNITY_NO_LLGR
:
384 strlcat(str
, "no-llgr", len
);
386 json_string
= json_object_new_string(
388 json_object_array_add(json_community_list
,
392 case COMMUNITY_ACCEPT_OWN_NEXTHOP
:
393 strlcat(str
, "accept-own-nexthop", len
);
395 json_string
= json_object_new_string(
397 json_object_array_add(json_community_list
,
401 case COMMUNITY_BLACKHOLE
:
402 strlcat(str
, "blackhole", len
);
404 json_string
= json_object_new_string(
406 json_object_array_add(json_community_list
,
410 case COMMUNITY_NO_EXPORT
:
411 strlcat(str
, "no-export", len
);
414 json_object_new_string("noExport");
415 json_object_array_add(json_community_list
,
419 case COMMUNITY_NO_ADVERTISE
:
420 strlcat(str
, "no-advertise", len
);
423 json_object_new_string("noAdvertise");
424 json_object_array_add(json_community_list
,
428 case COMMUNITY_LOCAL_AS
:
429 strlcat(str
, "local-AS", len
);
431 json_string
= json_object_new_string("localAs");
432 json_object_array_add(json_community_list
,
436 case COMMUNITY_NO_PEER
:
437 strlcat(str
, "no-peer", len
);
439 json_string
= json_object_new_string("noPeer");
440 json_object_array_add(json_community_list
,
445 as
= (comval
>> 16) & 0xFFFF;
446 val
= comval
& 0xFFFF;
448 snprintf(buf
, sizeof(buf
), "%u:%d", as
, val
);
449 strlcat(str
, buf
, len
);
451 json_string
= json_object_new_string(buf
);
452 json_object_array_add(json_community_list
,
460 json_object_string_add(com
->json
, "string", str
);
461 json_object_object_add(com
->json
, "list", json_community_list
);
466 /* Intern communities attribute. */
467 struct community
*community_intern(struct community
*com
)
469 struct community
*find
;
471 /* Assert this community structure is not interned. */
472 assert(com
->refcnt
== 0);
474 /* Lookup community hash. */
475 find
= (struct community
*)hash_get(comhash
, com
, hash_alloc_intern
);
477 /* Arguemnt com is allocated temporary. So when it is not used in
478 hash, it should be freed. */
480 community_free(&com
);
482 /* Increment refrence counter. */
487 set_community_string(find
, false);
492 /* Free community attribute. */
493 void community_unintern(struct community
**com
)
495 struct community
*ret
;
500 /* Pull off from hash. */
501 if ((*com
)->refcnt
== 0) {
502 /* Community value com must exist in hash. */
503 ret
= (struct community
*)hash_release(comhash
, *com
);
510 /* Create new community attribute. */
511 struct community
*community_parse(uint32_t *pnt
, unsigned short length
)
513 struct community tmp
;
514 struct community
*new;
516 /* If length is malformed return NULL. */
517 if (length
% COMMUNITY_SIZE
)
520 /* Make temporary community for hash look up. */
521 tmp
.size
= length
/ COMMUNITY_SIZE
;
524 new = community_uniq_sort(&tmp
);
526 return community_intern(new);
529 struct community
*community_dup(struct community
*com
)
531 struct community
*new;
533 new = XCALLOC(MTYPE_COMMUNITY
, sizeof(struct community
));
534 new->size
= com
->size
;
536 new->val
= XMALLOC(MTYPE_COMMUNITY_VAL
,
537 com
->size
* COMMUNITY_SIZE
);
538 memcpy(new->val
, com
->val
, com
->size
* COMMUNITY_SIZE
);
544 /* Retrun string representation of communities attribute. */
545 char *community_str(struct community
*com
, bool make_json
)
550 if (make_json
&& !com
->json
&& com
->str
)
551 XFREE(MTYPE_COMMUNITY_STR
, com
->str
);
554 set_community_string(com
, make_json
);
558 /* Make hash value of community attribute. This function is used by
560 unsigned int community_hash_make(const struct community
*com
)
562 uint32_t *pnt
= com
->val
;
564 return jhash2(pnt
, com
->size
, 0x43ea96c1);
567 bool community_match(const struct community
*com1
, const struct community
*com2
)
572 if (com1
== NULL
&& com2
== NULL
)
575 if (com1
== NULL
|| com2
== NULL
)
578 if (com1
->size
< com2
->size
)
581 /* Every community on com2 needs to be on com1 for this to match */
582 while (i
< com1
->size
&& j
< com2
->size
) {
583 if (memcmp(com1
->val
+ i
, com2
->val
+ j
, sizeof(uint32_t)) == 0)
594 /* If two aspath have same value then return 1 else return 0. This
595 function is used by hash package. */
596 bool community_cmp(const struct community
*com1
, const struct community
*com2
)
598 if (com1
== NULL
&& com2
== NULL
)
600 if (com1
== NULL
|| com2
== NULL
)
603 if (com1
->size
== com2
->size
)
604 if (memcmp(com1
->val
, com2
->val
, com1
->size
* COMMUNITY_SIZE
)
610 /* Add com2 to the end of com1. */
611 struct community
*community_merge(struct community
*com1
,
612 struct community
*com2
)
616 XREALLOC(MTYPE_COMMUNITY_VAL
, com1
->val
,
617 (com1
->size
+ com2
->size
) * COMMUNITY_SIZE
);
619 com1
->val
= XMALLOC(MTYPE_COMMUNITY_VAL
,
620 (com1
->size
+ com2
->size
) * COMMUNITY_SIZE
);
622 memcpy(com1
->val
+ com1
->size
, com2
->val
, com2
->size
* COMMUNITY_SIZE
);
623 com1
->size
+= com2
->size
;
628 /* Community token enum. */
629 enum community_token
{
631 community_token_gshut
,
632 community_token_accept_own
,
633 community_token_route_filter_translated_v4
,
634 community_token_route_filter_v4
,
635 community_token_route_filter_translated_v6
,
636 community_token_route_filter_v6
,
637 community_token_llgr_stale
,
638 community_token_no_llgr
,
639 community_token_accept_own_nexthop
,
640 community_token_blackhole
,
641 community_token_no_export
,
642 community_token_no_advertise
,
643 community_token_local_as
,
644 community_token_no_peer
,
645 community_token_unknown
648 /* Get next community token from string. */
650 community_gettoken(const char *buf
, enum community_token
*token
, uint32_t *val
)
654 /* Skip white space. */
655 while (isspace((unsigned char)*p
))
658 /* Check the end of the line. */
662 /* Well known community string check. */
663 if (isalpha((unsigned char)*p
)) {
664 if (strncmp(p
, "internet", strlen("internet")) == 0) {
665 *val
= COMMUNITY_INTERNET
;
666 *token
= community_token_no_export
;
667 p
+= strlen("internet");
670 if (strncmp(p
, "graceful-shutdown", strlen("graceful-shutdown"))
672 *val
= COMMUNITY_GSHUT
;
673 *token
= community_token_gshut
;
674 p
+= strlen("graceful-shutdown");
677 if (strncmp(p
, "accept-own", strlen("accept-own"))
679 *val
= COMMUNITY_ACCEPT_OWN
;
680 *token
= community_token_accept_own
;
681 p
+= strlen("accept-own");
684 if (strncmp(p
, "route-filter-translated-v4",
685 strlen("route-filter-translated-v4"))
687 *val
= COMMUNITY_ROUTE_FILTER_TRANSLATED_v4
;
688 *token
= community_token_route_filter_translated_v4
;
689 p
+= strlen("route-filter-translated-v4");
692 if (strncmp(p
, "route-filter-v4", strlen("route-filter-v4"))
694 *val
= COMMUNITY_ROUTE_FILTER_v4
;
695 *token
= community_token_route_filter_v4
;
696 p
+= strlen("route-filter-v4");
699 if (strncmp(p
, "route-filter-translated-v6",
700 strlen("route-filter-translated-v6"))
702 *val
= COMMUNITY_ROUTE_FILTER_TRANSLATED_v6
;
703 *token
= community_token_route_filter_translated_v6
;
704 p
+= strlen("route-filter-translated-v6");
707 if (strncmp(p
, "route-filter-v6", strlen("route-filter-v6"))
709 *val
= COMMUNITY_ROUTE_FILTER_v6
;
710 *token
= community_token_route_filter_v6
;
711 p
+= strlen("route-filter-v6");
714 if (strncmp(p
, "llgr-stale", strlen("llgr-stale"))
716 *val
= COMMUNITY_LLGR_STALE
;
717 *token
= community_token_llgr_stale
;
718 p
+= strlen("llgr-stale");
721 if (strncmp(p
, "no-llgr", strlen("no-llgr"))
723 *val
= COMMUNITY_NO_LLGR
;
724 *token
= community_token_no_llgr
;
725 p
+= strlen("no-llgr");
728 if (strncmp(p
, "accept-own-nexthop",
729 strlen("accept-own-nexthop"))
731 *val
= COMMUNITY_ACCEPT_OWN_NEXTHOP
;
732 *token
= community_token_accept_own_nexthop
;
733 p
+= strlen("accept-own-nexthop");
736 if (strncmp(p
, "blackhole", strlen("blackhole"))
738 *val
= COMMUNITY_BLACKHOLE
;
739 *token
= community_token_blackhole
;
740 p
+= strlen("blackhole");
743 if (strncmp(p
, "no-export", strlen("no-export")) == 0) {
744 *val
= COMMUNITY_NO_EXPORT
;
745 *token
= community_token_no_export
;
746 p
+= strlen("no-export");
749 if (strncmp(p
, "no-advertise", strlen("no-advertise")) == 0) {
750 *val
= COMMUNITY_NO_ADVERTISE
;
751 *token
= community_token_no_advertise
;
752 p
+= strlen("no-advertise");
755 if (strncmp(p
, "local-AS", strlen("local-AS")) == 0) {
756 *val
= COMMUNITY_LOCAL_AS
;
757 *token
= community_token_local_as
;
758 p
+= strlen("local-AS");
761 if (strncmp(p
, "no-peer", strlen("no-peer")) == 0) {
762 *val
= COMMUNITY_NO_PEER
;
763 *token
= community_token_no_peer
;
764 p
+= strlen("no-peer");
768 /* Unknown string. */
769 *token
= community_token_unknown
;
773 /* Community value. */
774 if (isdigit((unsigned char)*p
)) {
777 uint32_t community_low
= 0;
778 uint32_t community_high
= 0;
780 while (isdigit((unsigned char)*p
) || *p
== ':') {
783 *token
= community_token_unknown
;
789 if (community_low
> UINT16_MAX
) {
791 community_token_unknown
;
795 community_high
= community_low
<< 16;
801 community_low
+= (*p
- '0');
806 *token
= community_token_unknown
;
810 if (community_low
> UINT16_MAX
) {
811 *token
= community_token_unknown
;
815 *val
= community_high
+ community_low
;
816 *token
= community_token_val
;
819 *token
= community_token_unknown
;
823 /* convert string to community structure */
824 struct community
*community_str2com(const char *str
)
826 struct community
*com
= NULL
;
827 struct community
*com_sort
= NULL
;
829 enum community_token token
= community_token_unknown
;
832 str
= community_gettoken(str
, &token
, &val
);
835 case community_token_val
:
836 case community_token_gshut
:
837 case community_token_accept_own
:
838 case community_token_route_filter_translated_v4
:
839 case community_token_route_filter_v4
:
840 case community_token_route_filter_translated_v6
:
841 case community_token_route_filter_v6
:
842 case community_token_llgr_stale
:
843 case community_token_no_llgr
:
844 case community_token_accept_own_nexthop
:
845 case community_token_blackhole
:
846 case community_token_no_export
:
847 case community_token_no_advertise
:
848 case community_token_local_as
:
849 case community_token_no_peer
:
851 com
= community_new();
854 community_add_val(com
, val
);
856 case community_token_unknown
:
858 community_free(&com
);
863 com_sort
= community_uniq_sort(com
);
864 community_free(&com
);
869 /* Return communities hash entry count. */
870 unsigned long community_count(void)
872 return comhash
->count
;
875 /* Return communities hash. */
876 struct hash
*community_hash(void)
881 /* Initialize comminity related hash. */
882 void community_init(void)
885 hash_create((unsigned int (*)(const void *))community_hash_make
,
886 (bool (*)(const void *, const void *))community_cmp
,
887 "BGP Community Hash");
890 void community_finish(void)
896 static struct community
*bgp_aggr_community_lookup(
897 struct bgp_aggregate
*aggregate
,
898 struct community
*community
)
900 return hash_lookup(aggregate
->community_hash
, community
);
903 static void *bgp_aggr_communty_hash_alloc(void *p
)
905 struct community
*ref
= (struct community
*)p
;
906 struct community
*community
= NULL
;
908 community
= community_dup(ref
);
912 static void bgp_aggr_community_prepare(struct hash_bucket
*hb
, void *arg
)
914 struct community
*hb_community
= hb
->data
;
915 struct community
**aggr_community
= arg
;
918 *aggr_community
= community_merge(*aggr_community
,
921 *aggr_community
= community_dup(hb_community
);
924 void bgp_aggr_community_remove(void *arg
)
926 struct community
*community
= arg
;
928 community_free(&community
);
931 void bgp_compute_aggregate_community(struct bgp_aggregate
*aggregate
,
932 struct community
*community
)
934 bgp_compute_aggregate_community_hash(aggregate
, community
);
935 bgp_compute_aggregate_community_val(aggregate
);
939 void bgp_compute_aggregate_community_hash(struct bgp_aggregate
*aggregate
,
940 struct community
*community
)
942 struct community
*aggr_community
= NULL
;
944 if ((aggregate
== NULL
) || (community
== NULL
))
947 /* Create hash if not already created.
949 if (aggregate
->community_hash
== NULL
)
950 aggregate
->community_hash
= hash_create(
951 (unsigned int (*)(const void *))community_hash_make
,
952 (bool (*)(const void *, const void *))community_cmp
,
953 "BGP Aggregator community hash");
955 aggr_community
= bgp_aggr_community_lookup(aggregate
, community
);
956 if (aggr_community
== NULL
) {
957 /* Insert community into hash.
959 aggr_community
= hash_get(aggregate
->community_hash
, community
,
960 bgp_aggr_communty_hash_alloc
);
963 /* Increment reference counter.
965 aggr_community
->refcnt
++;
968 void bgp_compute_aggregate_community_val(struct bgp_aggregate
*aggregate
)
970 struct community
*commerge
= NULL
;
972 if (aggregate
== NULL
)
975 /* Re-compute aggregate's community.
977 if (aggregate
->community
)
978 community_free(&aggregate
->community
);
979 if (aggregate
->community_hash
&&
980 aggregate
->community_hash
->count
) {
981 hash_iterate(aggregate
->community_hash
,
982 bgp_aggr_community_prepare
,
983 &aggregate
->community
);
984 commerge
= aggregate
->community
;
985 aggregate
->community
= community_uniq_sort(commerge
);
987 community_free(&commerge
);
993 void bgp_remove_community_from_aggregate(struct bgp_aggregate
*aggregate
,
994 struct community
*community
)
996 struct community
*aggr_community
= NULL
;
997 struct community
*ret_comm
= NULL
;
1000 || (!aggregate
->community_hash
)
1004 /* Look-up the community in the hash.
1006 aggr_community
= bgp_aggr_community_lookup(aggregate
, community
);
1007 if (aggr_community
) {
1008 aggr_community
->refcnt
--;
1010 if (aggr_community
->refcnt
== 0) {
1011 ret_comm
= hash_release(aggregate
->community_hash
,
1013 community_free(&ret_comm
);
1015 bgp_compute_aggregate_community_val(aggregate
);
1020 void bgp_remove_comm_from_aggregate_hash(struct bgp_aggregate
*aggregate
,
1021 struct community
*community
)
1024 struct community
*aggr_community
= NULL
;
1025 struct community
*ret_comm
= NULL
;
1028 || (!aggregate
->community_hash
)
1032 /* Look-up the community in the hash.
1034 aggr_community
= bgp_aggr_community_lookup(aggregate
, community
);
1035 if (aggr_community
) {
1036 aggr_community
->refcnt
--;
1038 if (aggr_community
->refcnt
== 0) {
1039 ret_comm
= hash_release(aggregate
->community_hash
,
1041 community_free(&ret_comm
);