@@ -406,10 +406,10 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
406406
407407 buf [0 ] = '\0' ;
408408
409- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_NEXT_HOP ) ))
409+ if (bgp_attr_exists (attr , BGP_ATTR_NEXT_HOP ))
410410 snprintfrr (buf , size , "nexthop %pI4" , & attr -> nexthop );
411411
412- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_ORIGIN ) ))
412+ if (bgp_attr_exists (attr , BGP_ATTR_ORIGIN ))
413413 snprintf (buf + strlen (buf ), size - strlen (buf ), ", origin %s" ,
414414 bgp_origin_str [attr -> origin ]);
415415
@@ -426,54 +426,54 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
426426 if (attr -> mp_nexthop_len == BGP_ATTR_NHLEN_IPV4 )
427427 snprintfrr (buf , size , "nexthop %pI4" , & attr -> nexthop );
428428
429- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_LOCAL_PREF ) ))
429+ if (bgp_attr_exists (attr , BGP_ATTR_LOCAL_PREF ))
430430 snprintf (buf + strlen (buf ), size - strlen (buf ),
431431 ", localpref %u" , attr -> local_pref );
432432
433- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_AIGP ) ))
433+ if (bgp_attr_exists (attr , BGP_ATTR_AIGP ))
434434 snprintf (buf + strlen (buf ), size - strlen (buf ),
435435 ", aigp-metric %" PRIu64 ,
436436 (unsigned long long )bgp_attr_get_aigp_metric (attr ));
437437
438- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_MULTI_EXIT_DISC ) ))
438+ if (bgp_attr_exists (attr , BGP_ATTR_MULTI_EXIT_DISC ))
439439 snprintf (buf + strlen (buf ), size - strlen (buf ), ", metric %u" ,
440440 attr -> med );
441441
442- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_COMMUNITIES ) ))
442+ if (bgp_attr_exists (attr , BGP_ATTR_COMMUNITIES ))
443443 snprintf (buf + strlen (buf ), size - strlen (buf ),
444444 ", community %s" ,
445445 community_str (bgp_attr_get_community (attr ), false,
446446 true));
447447
448- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_LARGE_COMMUNITIES ) ))
448+ if (bgp_attr_exists (attr , BGP_ATTR_LARGE_COMMUNITIES ))
449449 snprintf (buf + strlen (buf ), size - strlen (buf ),
450450 ", large-community %s" ,
451451 lcommunity_str (bgp_attr_get_lcommunity (attr ), false,
452452 true));
453453
454- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_EXT_COMMUNITIES ) ))
454+ if (bgp_attr_exists (attr , BGP_ATTR_EXT_COMMUNITIES ))
455455 snprintf (buf + strlen (buf ), size - strlen (buf ),
456456 ", extcommunity %s" ,
457457 ecommunity_str (bgp_attr_get_ecommunity (attr )));
458458
459- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_IPV6_EXT_COMMUNITIES ) ))
459+ if (bgp_attr_exists (attr , BGP_ATTR_IPV6_EXT_COMMUNITIES ))
460460 snprintf (buf + strlen (buf ), size - strlen (buf ), ", ipv6-extcommunity %s" ,
461461 ecommunity_str (bgp_attr_get_ipv6_ecommunity (attr )));
462462
463- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_ATOMIC_AGGREGATE ) ))
463+ if (bgp_attr_exists (attr , BGP_ATTR_ATOMIC_AGGREGATE ))
464464 snprintf (buf + strlen (buf ), size - strlen (buf ),
465465 ", atomic-aggregate" );
466466
467- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_AGGREGATOR ) ))
467+ if (bgp_attr_exists (attr , BGP_ATTR_AGGREGATOR ))
468468 snprintfrr (buf + strlen (buf ), size - strlen (buf ),
469469 ", aggregated by %u %pI4" , attr -> aggregator_as ,
470470 & attr -> aggregator_addr );
471471
472- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_ORIGINATOR_ID ) ))
472+ if (bgp_attr_exists (attr , BGP_ATTR_ORIGINATOR_ID ))
473473 snprintfrr (buf + strlen (buf ), size - strlen (buf ),
474474 ", originator %pI4" , & attr -> originator_id );
475475
476- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_CLUSTER_LIST ) )) {
476+ if (bgp_attr_exists (attr , BGP_ATTR_CLUSTER_LIST )) {
477477 struct cluster_list * cluster ;
478478 int i ;
479479
@@ -486,21 +486,21 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size)
486486 " %pI4" , & cluster -> list [i ]);
487487 }
488488
489- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_PMSI_TUNNEL ) ))
489+ if (bgp_attr_exists (attr , BGP_ATTR_PMSI_TUNNEL ))
490490 snprintf (buf + strlen (buf ), size - strlen (buf ),
491491 ", pmsi tnltype %u" , bgp_attr_get_pmsi_tnl_type (attr ));
492492
493- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_AS_PATH ) ))
493+ if (bgp_attr_exists (attr , BGP_ATTR_AS_PATH ))
494494 snprintf (buf + strlen (buf ), size - strlen (buf ), ", path %s" ,
495495 aspath_print (attr -> aspath ));
496496
497- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_PREFIX_SID ) )) {
497+ if (bgp_attr_exists (attr , BGP_ATTR_PREFIX_SID )) {
498498 if (attr -> label_index != BGP_INVALID_LABEL_INDEX )
499499 snprintf (buf + strlen (buf ), size - strlen (buf ),
500500 ", label-index %u" , attr -> label_index );
501501 }
502502
503- if (CHECK_FLAG (attr -> flag , ATTR_FLAG_BIT ( BGP_ATTR_NHC ) )) {
503+ if (bgp_attr_exists (attr , BGP_ATTR_NHC )) {
504504 struct bgp_nhc_tlv * tlv ;
505505 struct bgp_nhc * nhc = bgp_attr_get_nhc (attr );
506506
0 commit comments