]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #5789 from donaldsharp/bgp_ebgp_reason
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 11 Feb 2020 08:42:23 +0000 (10:42 +0200)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2020 08:42:23 +0000 (10:42 +0200)
bgpd: Update failed reason to distinguish some NHT scenarios

47 files changed:
bgpd/bgp_addpath.c
bgpd/bgp_attr.c
bgpd/bgp_bfd.c
bgpd/bgp_debug.c
bgpd/bgp_evpn.c
bgpd/bgp_fsm.c
bgpd/bgp_main.c
bgpd/bgp_mpath.c
bgpd/bgp_nht.c
bgpd/bgp_open.c
bgpd/bgp_packet.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_updgrp.c
bgpd/bgp_updgrp_adv.c
bgpd/bgp_vty.c
bgpd/bgp_zebra.c
bgpd/bgpd.c
bgpd/bgpd.h
bgpd/rfapi/rfapi_import.c
eigrpd/eigrp_main.c
lib/csv.c
lib/imsg-buffer.c
lib/imsg.c
lib/openbsd-tree.c
lib/printf/printf-pos.c
lib/printf/vfprintf.c
lib/ptm_lib.c
lib/routemap.c
lib/typerb.c
ospf6d/ospf6_area.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_route.c
ospfd/ospf_main.c
ripd/rip_main.c
scripts/coccinelle/replace_bgp_flag_functions.cocci [new file with mode: 0644]
scripts/coccinelle/return_without_parenthesis.cocci [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py
tests/topotests/ldp-topo1/test_ldp_topo1.py
vtysh/vtysh.c
vtysh/vtysh_config.c
vtysh/vtysh_main.c
zebra/redistribute.c
zebra/zebra_mpls_openbsd.c
zebra/zebra_ptm.c
zebra/zebra_routemap.c

index e7e7c3cc1f30637a76acf31c5887ed74d6284d3f..aaa77b04dc7af5fe67840a277985c53ea7c7ebdd 100644 (file)
@@ -380,11 +380,13 @@ void bgp_addpath_set_peer_type(struct peer *peer, afi_t afi, safi_t safi,
 
        if (addpath_type != BGP_ADDPATH_NONE) {
                if (bgp_addpath_dmed_required(addpath_type)) {
-                       if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
+                       if (!CHECK_FLAG(bgp->flags,
+                                       BGP_FLAG_DETERMINISTIC_MED)) {
                                zlog_warn(
                                        "%s: enabling bgp deterministic-med, this is required for addpath-tx-bestpath-per-AS",
                                        peer->host);
-                               bgp_flag_set(bgp, BGP_FLAG_DETERMINISTIC_MED);
+                               SET_FLAG(bgp->flags,
+                                        BGP_FLAG_DETERMINISTIC_MED);
                                bgp_recalculate_all_bestpaths(bgp);
                        }
                }
index c0d88fc521a7cb3ffd46dff333efe17d1366a167..eed465700194a4256b590372866b84833696c0b9 100644 (file)
@@ -933,7 +933,7 @@ struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, uint8_t origin,
                /* If we are not shutting down ourselves and we are
                 * aggregating a route that contains the GSHUT community we
                 * need to remove that community when creating the aggregate */
-               if (!bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)
+               if (!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN)
                    && community_include(community, gshut)) {
                        community_del_val(community, &gshut);
                }
@@ -952,9 +952,8 @@ struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, uint8_t origin,
                attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES);
        }
 
-       if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                bgp_attr_add_gshut_community(&attr);
-       }
 
        attr.label_index = BGP_INVALID_LABEL_INDEX;
        attr.label = MPLS_INVALID_LABEL;
@@ -996,13 +995,13 @@ struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, uint8_t origin,
                        return NULL;
                }
 
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&attr_tmp);
 
                new = bgp_attr_intern(&attr_tmp);
        } else {
 
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&attr);
 
                new = bgp_attr_intern(&attr);
index 0ed6057eac1b795bcb46170b49cd1308d61a2ff9..80ef43f0d3a3c4d4449980ae6edef311fdf53b0f 100644 (file)
@@ -116,10 +116,10 @@ static void bgp_bfd_peer_sendmsg(struct peer *peer, int command)
         * and bfd controlplane check not configured is not kept
         * keep bfd independent controlplane bit set to 1
         */
-       if (!bgp_flag_check(peer->bgp, BGP_FLAG_GRACEFUL_RESTART)
-           && !bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD)
+       if (!CHECK_FLAG(peer->bgp->flags, BGP_FLAG_GRACEFUL_RESTART)
+           && !CHECK_FLAG(peer->bgp->flags, BGP_FLAG_GR_PRESERVE_FWD)
            && !CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CHECK_CONTROLPLANE))
-               SET_FLAG(bfd_info->flags,  BFD_FLAG_BFD_CBIT_ON);
+               SET_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
 
        cbit = CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
 
index f3bd9f59ff5d079a31eaa73468c1bc5baa31e7db..c69bc52e47538ac30c0e6b3892d995493cfa99a4 100644 (file)
@@ -511,7 +511,7 @@ void bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
        char msg_buf[1024];
 
        if (BGP_DEBUG(neighbor_events, NEIGHBOR_EVENTS)
-           || bgp_flag_check(peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
+           || CHECK_FLAG(peer->bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
                code_str = bgp_notify_code_str(bgp_notify->code);
                subcode_str = bgp_notify_subcode_str(bgp_notify->code,
                                                     bgp_notify->subcode);
index a93f81a8d855c34f72845340e176ff1f5e701991..76c7d93ad175b120afae4acb8d74cfcbdb720dbf 100644 (file)
@@ -2526,13 +2526,13 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
 
 static struct bgp_path_info *
 bgp_create_evpn_bgp_path_info(struct bgp_path_info *parent_pi,
-                             struct bgp_node *rn)
+                             struct bgp_node *rn, struct attr *attr)
 {
        struct attr *attr_new;
        struct bgp_path_info *pi;
 
        /* Add (or update) attribute to hash. */
-       attr_new = bgp_attr_intern(parent_pi->attr);
+       attr_new = bgp_attr_intern(attr);
 
        /* Create new route with its attribute. */
        pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0, parent_pi->peer,
@@ -2675,7 +2675,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
                        break;
 
        if (!pi)
-               pi = bgp_create_evpn_bgp_path_info(parent_pi, rn);
+               pi = bgp_create_evpn_bgp_path_info(parent_pi, rn, &attr);
        else {
                if (attrhash_cmp(pi->attr, &attr)
                    && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
@@ -2744,7 +2744,8 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
 
        if (!pi) {
                /* Create an info */
-               (void)bgp_create_evpn_bgp_path_info(parent_pi, rn);
+               (void)bgp_create_evpn_bgp_path_info(parent_pi, rn,
+                                                   parent_pi->attr);
        } else {
                if (attrhash_cmp(pi->attr, parent_pi->attr)
                    && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
index 157013ed557defc97a573d12627cf39b5a8113e5..66cde7b3a28e3d9867e40f686684d11d2b561835 100644 (file)
@@ -103,7 +103,7 @@ static int bgp_peer_reg_with_nht(struct peer *peer)
 
        if (peer->sort == BGP_PEER_EBGP && peer->ttl == BGP_DEFAULT_TTL
            && !CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
-           && !bgp_flag_check(peer->bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
+           && !CHECK_FLAG(peer->bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
                connected = 1;
 
        return bgp_find_or_add_nexthop(
@@ -1146,7 +1146,8 @@ int bgp_stop(struct peer *peer)
                peer->dropped++;
 
                /* bgp log-neighbor-changes of neighbor Down */
-               if (bgp_flag_check(peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
+               if (CHECK_FLAG(peer->bgp->flags,
+                              BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
                        struct vrf *vrf = vrf_lookup_by_id(peer->bgp->vrf_id);
 
                        zlog_info(
@@ -1724,7 +1725,7 @@ static int bgp_update_gr_info(struct peer *peer, afi_t afi, safi_t safi)
        if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)
            && BGP_PEER_RESTARTING_MODE(peer)) {
                /* Check if the forwarding state is preserved */
-               if (bgp_flag_check(bgp, BGP_FLAG_GR_PRESERVE_FWD)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD)) {
                        gr_info = &(bgp->gr_info[afi][safi]);
                        ret = bgp_start_deferral_timer(bgp, afi, safi, gr_info);
                }
@@ -1770,15 +1771,14 @@ static int bgp_establish(struct peer *peer)
        bgp_fsm_change_status(peer, Established);
 
        /* bgp log-neighbor-changes of neighbor Up */
-       if (bgp_flag_check(peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
+       if (CHECK_FLAG(peer->bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
                struct vrf *vrf = vrf_lookup_by_id(peer->bgp->vrf_id);
-               zlog_info("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up",
-                         peer->host,
-                         (peer->hostname) ? peer->hostname : "Unknown",
-                         vrf ? ((vrf->vrf_id != VRF_DEFAULT)
-                                       ? vrf->name
-                                       : VRF_DEFAULT_NAME)
-                             : "");
+               zlog_info(
+                       "%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", peer->host,
+                       (peer->hostname) ? peer->hostname : "Unknown",
+                       vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name
+                                                           : VRF_DEFAULT_NAME)
+                           : "");
        }
        /* assign update-group/subgroup */
        update_group_adjust_peer_afs(peer);
@@ -1825,8 +1825,8 @@ static int bgp_establish(struct peer *peer)
                                        if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(
                                                    peer)
                                            && BGP_PEER_RESTARTING_MODE(peer)
-                                           && bgp_flag_check(
-                                                   peer->bgp,
+                                           && CHECK_FLAG(
+                                                   peer->bgp->flags,
                                                    BGP_FLAG_GR_PRESERVE_FWD))
                                                peer->bgp->gr_info[afi][safi]
                                                        .eor_required++;
index 74e561c743ea3860dbc54156128f9c1d9b0e9b50..c4ece2f082e2f3737a00ea19cc16d891f2962e33 100644 (file)
@@ -493,5 +493,5 @@ int main(int argc, char **argv)
        frr_run(bm->master);
 
        /* Not reached. */
-       return (0);
+       return 0;
 }
index 6bc8134f3649d9d6bfa87f2fc5b5b056ec67171f..9e73acdc01da1d18d1bd9464b0200c7dc58adc61 100644 (file)
@@ -721,8 +721,9 @@ void bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
 
        attr = *new_best->attr;
 
-       if (new_best->peer && bgp_flag_check(new_best->peer->bgp,
-                                            BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
+       if (new_best->peer
+           && CHECK_FLAG(new_best->peer->bgp->flags,
+                         BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
 
                /* aggregate attribute from multipath constituents */
                aspath = aspath_dup(attr.aspath);
index e9496e47a9d60f80d923392e2bb7d3eecf64be99..3060fe482ce8c13573ce9584bb38274ad190353f 100644 (file)
@@ -186,12 +186,13 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
                SET_FLAG(bnc->flags, BGP_STATIC_ROUTE);
 
                /* If we're toggling the type, re-register */
-               if ((bgp_flag_check(bgp_route, BGP_FLAG_IMPORT_CHECK))
+               if ((CHECK_FLAG(bgp_route->flags, BGP_FLAG_IMPORT_CHECK))
                    && !CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)) {
                        SET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH);
                        UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
                        UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
-               } else if ((!bgp_flag_check(bgp_route, BGP_FLAG_IMPORT_CHECK))
+               } else if ((!CHECK_FLAG(bgp_route->flags,
+                                       BGP_FLAG_IMPORT_CHECK))
                           && CHECK_FLAG(bnc->flags,
                                         BGP_STATIC_ROUTE_EXACT_MATCH)) {
                        UNSET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH);
index 473a51c5a0e7cc2984874698ef8e355b9dfcef45..906083f7556ba742795592a352585f631449e355 100644 (file)
@@ -1341,7 +1341,7 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
         * only when GR config is present
         */
        if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)) {
-               if (bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD)
+               if (CHECK_FLAG(peer->bgp->flags, BGP_FLAG_GR_PRESERVE_FWD)
                    && BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
                        zlog_debug("[BGP_GR] F bit Set");
 
@@ -1361,7 +1361,8 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
                                                  &pkt_safi);
                        stream_putw(s, pkt_afi);
                        stream_putc(s, pkt_safi);
-                       if (bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD))
+                       if (CHECK_FLAG(peer->bgp->flags,
+                                      BGP_FLAG_GR_PRESERVE_FWD))
                                stream_putc(s, RESTART_F_BIT);
                        else
                                stream_putc(s, 0);
index afb3a09b6b01eb85c6247cbad0338051d76d215d..c72f7226e2f397c8a79526ee7f20afc629bdd6d0 100644 (file)
@@ -973,7 +973,7 @@ static int bgp_collision_detect(struct peer *new, struct in_addr remote_id)
                if (peer->status == Established || peer->status == Clearing) {
                        bgp_notify_send(new, BGP_NOTIFY_CEASE,
                                        BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
-                       return (-1);
+                       return -1;
                } else if ((peer->status == OpenConfirm)
                           || (peer->status == OpenSent)) {
                        /* 1. The BGP Identifier of the local system is compared
index 5e41f82d4a864823300bda93f4cb833a75217910..34580788bddbe370267708014296f7a4e5983414 100644 (file)
@@ -501,7 +501,7 @@ static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
        if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
                return attr->med;
        else {
-               if (bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST))
                        return BGP_MED_MAX;
                else
                        return 0;
@@ -747,11 +747,11 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
        }
 
        /* 4. AS path length check. */
-       if (!bgp_flag_check(bgp, BGP_FLAG_ASPATH_IGNORE)) {
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE)) {
                int exist_hops = aspath_count_hops(existattr->aspath);
                int exist_confeds = aspath_count_confeds(existattr->aspath);
 
-               if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_CONFED)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED)) {
                        int aspath_hops;
 
                        aspath_hops = aspath_count_hops(newattr->aspath);
@@ -832,8 +832,8 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
                           && aspath_count_hops(newattr->aspath) == 0
                           && aspath_count_hops(existattr->aspath) == 0);
 
-       if (bgp_flag_check(bgp, BGP_FLAG_ALWAYS_COMPARE_MED)
-           || (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED) && confed_as_route)
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_ALWAYS_COMPARE_MED)
+           || (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED) && confed_as_route)
            || aspath_cmp_left(newattr->aspath, existattr->aspath)
            || aspath_cmp_left_confed(newattr->aspath, existattr->aspath)
            || internal_as_route) {
@@ -978,8 +978,8 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
                                zlog_debug(
                                        "%s: %s and %s cannot be multipath, one has a label while the other does not",
                                        pfx_buf, new_buf, exist_buf);
-               } else if (bgp_flag_check(bgp,
-                                         BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
+               } else if (CHECK_FLAG(bgp->flags,
+                                     BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
 
                        /*
                         * For the two paths, all comparison steps till IGP
@@ -1041,7 +1041,7 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
           first (the oldest one).  This step minimizes route-flap, since a
           newer path won't displace an older one, even if it was the
           preferred route based on the additional decision criteria below.  */
-       if (!bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID)
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID)
            && new_sort == BGP_PEER_EBGP && exist_sort == BGP_PEER_EBGP) {
                if (CHECK_FLAG(new->flags, BGP_PATH_SELECTED)) {
                        *reason = bgp_path_selection_older;
@@ -1762,7 +1762,8 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
                           check
                           is already done.  So there is noting to do. */
                        /* no bgp client-to-client reflection check. */
-                       if (bgp_flag_check(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
+                       if (CHECK_FLAG(bgp->flags,
+                                      BGP_FLAG_NO_CLIENT_TO_CLIENT))
                                if (CHECK_FLAG(peer->af_flags[afi][safi],
                                               PEER_FLAG_REFLECTOR_CLIENT))
                                        return 0;
@@ -1894,8 +1895,8 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
                 * of the reflected IBGP routes unless explicitly allowed.
                 */
                if ((from->sort == BGP_PEER_IBGP && peer->sort == BGP_PEER_IBGP)
-                   && !bgp_flag_check(bgp,
-                                      BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
+                   && !CHECK_FLAG(bgp->flags,
+                                  BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
                        dummy_attr = *attr;
                        rmap_path.attr = &dummy_attr;
                }
@@ -1945,7 +1946,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
                if (aspath_check_as_sets(attr->aspath))
                        return 0;
 
-       if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
                if (peer->sort == BGP_PEER_IBGP
                    || peer->sort == BGP_PEER_CONFED) {
                        attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
@@ -2105,7 +2106,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
 
        /* bgp deterministic-med */
        new_select = NULL;
-       if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED)) {
 
                /* Clear BGP_PATH_DMED_SELECTED for all paths */
                for (pi1 = bgp_node_get_bgp_path_info(rn); pi1;
@@ -2212,7 +2213,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
                                continue;
                        }
 
-               if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED)
                    && (!CHECK_FLAG(pi->flags, BGP_PATH_DMED_SELECTED))) {
                        bgp_path_info_unset_flag(rn, pi, BGP_PATH_DMED_CHECK);
                        if (debug)
@@ -2445,14 +2446,14 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
        char pfx_buf[PREFIX2STR_BUFFER];
        int debug = 0;
 
-       if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) {
                if (rn)
                        debug = bgp_debug_bestpath(&rn->p);
                if (debug) {
                        prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
                        zlog_debug(
-                            "%s: bgp delete in progress, ignoring event, p=%s",
-                            __func__, pfx_buf);
+                               "%s: bgp delete in progress, ignoring event, p=%s",
+                               __func__, pfx_buf);
                }
                return;
        }
@@ -3418,10 +3419,9 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
 
                        /* If graceful-shutdown is configured then add the GSHUT
                         * community to all paths received from eBGP peers */
-               } else if (bgp_flag_check(peer->bgp,
-                                         BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+               } else if (CHECK_FLAG(peer->bgp->flags,
+                                     BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&new_attr);
-               }
        }
 
        if (pi) {
@@ -3707,8 +3707,8 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
                            && peer->ttl == BGP_DEFAULT_TTL
                            && !CHECK_FLAG(peer->flags,
                                           PEER_FLAG_DISABLE_CONNECTED_CHECK)
-                           && !bgp_flag_check(
-                                      bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
+                           && !CHECK_FLAG(bgp->flags,
+                                          BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
                                connected = 1;
                        else
                                connected = 0;
@@ -3862,7 +3862,8 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
                    && peer->ttl == BGP_DEFAULT_TTL
                    && !CHECK_FLAG(peer->flags,
                                   PEER_FLAG_DISABLE_CONNECTED_CHECK)
-                   && !bgp_flag_check(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
+                   && !CHECK_FLAG(bgp->flags,
+                                  BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
                        connected = 1;
                else
                        connected = 0;
@@ -4953,13 +4954,13 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
                        return;
                }
 
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&attr_tmp);
 
                attr_new = bgp_attr_intern(&attr_tmp);
        } else {
 
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&attr);
 
                attr_new = bgp_attr_intern(&attr);
@@ -4973,7 +4974,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
        if (pi) {
                if (attrhash_cmp(pi->attr, attr_new)
                    && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
-                   && !bgp_flag_check(bgp, BGP_FLAG_FORCE_STATIC_PROCESS)) {
+                   && !CHECK_FLAG(bgp->flags, BGP_FLAG_FORCE_STATIC_PROCESS)) {
                        bgp_unlock_node(rn);
                        bgp_attr_unintern(&attr_new);
                        aspath_unintern(&attr.aspath);
@@ -5018,7 +5019,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
 #endif
 
                        /* Nexthop reachability check. */
-                       if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)
+                       if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
                            && (safi == SAFI_UNICAST
                                || safi == SAFI_LABELED_UNICAST)) {
 
@@ -5077,7 +5078,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
        new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self,
                        attr_new, rn);
        /* Nexthop reachability check. */
-       if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
            && (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) {
                if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, 0))
                        bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
@@ -5596,7 +5597,7 @@ void bgp_static_redo_import_check(struct bgp *bgp)
        struct bgp_static *bgp_static;
 
        /* Use this flag to force reprocessing of the route */
-       bgp_flag_set(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
+       SET_FLAG(bgp->flags, BGP_FLAG_FORCE_STATIC_PROCESS);
        FOREACH_AFI_SAFI (afi, safi) {
                for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
                     rn = bgp_route_next(rn)) {
@@ -5623,7 +5624,7 @@ void bgp_static_redo_import_check(struct bgp *bgp)
                        }
                }
        }
-       bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_FORCE_STATIC_PROCESS);
 }
 
 static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
@@ -5636,8 +5637,8 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
        /* Do not install the aggregate route if BGP is in the
         * process of termination.
         */
-       if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS) ||
-           (bgp->peer_self == NULL))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)
+           || (bgp->peer_self == NULL))
                return;
 
        table = bgp->rib[afi][safi];
@@ -6146,8 +6147,8 @@ void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
        /* If the bgp instance is being deleted or self peer is deleted
         * then do not create aggregate route
         */
-       if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS) ||
-          (bgp->peer_self == NULL))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)
+           || (bgp->peer_self == NULL))
                return;
 
        /* ORIGIN attribute: If at least one route among routes that are
@@ -7101,7 +7102,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
                        }
                }
 
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        bgp_attr_add_gshut_community(&attr_new);
 
                bn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi,
@@ -7392,7 +7393,8 @@ static void route_vty_short_status_out(struct vty *vty,
 
 static char *bgp_nexthop_hostname(struct peer *peer, struct attr *attr)
 {
-       if (peer->hostname && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME)
+       if (peer->hostname
+           && CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHOW_HOSTNAME)
            && !(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)))
                return peer->hostname;
        return NULL;
@@ -8406,7 +8408,7 @@ static void route_vty_out_advertised_to(struct vty *vty, struct peer *peer,
                }
 
                if (peer->hostname
-                   && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME)) {
+                   && CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHOW_HOSTNAME)) {
                        if (peer->conf_if)
                                vty_out(vty, " %s(%s)", peer->hostname,
                                        peer->conf_if);
@@ -8828,8 +8830,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
                } else {
                        if (path->peer->conf_if) {
                                if (path->peer->hostname
-                                   && bgp_flag_check(path->peer->bgp,
-                                                     BGP_FLAG_SHOW_HOSTNAME))
+                                   && CHECK_FLAG(path->peer->bgp->flags,
+                                                 BGP_FLAG_SHOW_HOSTNAME))
                                        vty_out(vty, " from %s(%s)",
                                                path->peer->hostname,
                                                path->peer->conf_if);
@@ -8838,8 +8840,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
                                                path->peer->conf_if);
                        } else {
                                if (path->peer->hostname
-                                   && bgp_flag_check(path->peer->bgp,
-                                                     BGP_FLAG_SHOW_HOSTNAME))
+                                   && CHECK_FLAG(path->peer->bgp->flags,
+                                                 BGP_FLAG_SHOW_HOSTNAME))
                                        vty_out(vty, " from %s(%s)",
                                                path->peer->hostname,
                                                path->peer->host);
@@ -11333,7 +11335,7 @@ static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi,
        } else {
 
                if (peer->hostname
-                   && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME)) {
+                   && CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHOW_HOSTNAME)) {
                        vty_out(vty, "Prefix counts for %s/%s, %s\n",
                                peer->hostname, peer->host,
                                get_afi_safi_str(afi, safi, false));
index f5de9ac8c67b505b931878cc0b9bf4b3a30f5565..5e6c78240093c5fa8ef01c85cac7c6c9093742e7 100644 (file)
@@ -3706,7 +3706,7 @@ int bgp_route_map_update_timer(struct thread *thread)
 
        route_map_walk_update_list(bgp_route_map_process_update_cb);
 
-       return (0);
+       return 0;
 }
 
 static void bgp_route_map_mark_update(const char *rmap_name)
index 3dbc67521212299b40baa42a952242bcec60b569..50824cd6dd565e5f16c9d9951faf9c12f303cf26 100644 (file)
@@ -1780,7 +1780,7 @@ int update_group_refresh_default_originate_route_map(struct thread *thread)
        THREAD_TIMER_OFF(bgp->t_rmap_def_originate_eval);
        bgp_unlock(bgp);
 
-       return (0);
+       return 0;
 }
 
 /*
index 26dda8ebda449453b5aaec77d78251f5848f6f22..34f80def8c77a92a566d27ea48aa8e69d3ddf4a7 100644 (file)
@@ -783,9 +783,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
                if (!CHECK_FLAG(subgrp->sflags,
                                SUBGRP_STATUS_DEFAULT_ORIGINATE)) {
 
-                       if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+                       if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                                bgp_attr_add_gshut_community(new_attr);
-                       }
 
                        SET_FLAG(subgrp->sflags,
                                 SUBGRP_STATUS_DEFAULT_ORIGINATE);
index f1ec9b49326d044ceb9e73e8c7435130f074c945..e55548f713bcf240e22976245dfd8c71076dcf78 100644 (file)
@@ -422,13 +422,13 @@ int bgp_get_vty(struct bgp **bgp, as_t *as, const char *name,
                               DFLT_BGP_CONNECT_RETRY);
 
                if (DFLT_BGP_IMPORT_CHECK)
-                       bgp_flag_set(*bgp, BGP_FLAG_IMPORT_CHECK);
+                       SET_FLAG((*bgp)->flags, BGP_FLAG_IMPORT_CHECK);
                if (DFLT_BGP_SHOW_HOSTNAME)
-                       bgp_flag_set(*bgp, BGP_FLAG_SHOW_HOSTNAME);
+                       SET_FLAG((*bgp)->flags, BGP_FLAG_SHOW_HOSTNAME);
                if (DFLT_BGP_LOG_NEIGHBOR_CHANGES)
-                       bgp_flag_set(*bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
+                       SET_FLAG((*bgp)->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
                if (DFLT_BGP_DETERMINISTIC_MED)
-                       bgp_flag_set(*bgp, BGP_FLAG_DETERMINISTIC_MED);
+                       SET_FLAG((*bgp)->flags, BGP_FLAG_DETERMINISTIC_MED);
 
                ret = BGP_SUCCESS;
        }
@@ -1992,7 +1992,7 @@ DEFUN (bgp_client_to_client_reflection,
        "reflection of routes allowed\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_NO_CLIENT_TO_CLIENT);
        bgp_clear_star_soft_out(vty, bgp->name);
 
        return CMD_SUCCESS;
@@ -2007,7 +2007,7 @@ DEFUN (no_bgp_client_to_client_reflection,
        "reflection of routes allowed\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
+       SET_FLAG(bgp->flags, BGP_FLAG_NO_CLIENT_TO_CLIENT);
        bgp_clear_star_soft_out(vty, bgp->name);
 
        return CMD_SUCCESS;
@@ -2021,7 +2021,7 @@ DEFUN (bgp_always_compare_med,
        "Allow comparing MED from different neighbors\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
+       SET_FLAG(bgp->flags, BGP_FLAG_ALWAYS_COMPARE_MED);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2035,7 +2035,7 @@ DEFUN (no_bgp_always_compare_med,
        "Allow comparing MED from different neighbors\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_ALWAYS_COMPARE_MED);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2123,8 +2123,8 @@ DEFUN (bgp_deterministic_med,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
-       if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
-               bgp_flag_set(bgp, BGP_FLAG_DETERMINISTIC_MED);
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED)) {
+               SET_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED);
                bgp_recalculate_all_bestpaths(bgp);
        }
 
@@ -2145,7 +2145,7 @@ DEFUN (no_bgp_deterministic_med,
        struct peer *peer;
        struct listnode *node, *nnode;
 
-       if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED)) {
                bestpath_per_as_used = 0;
 
                for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
@@ -2165,7 +2165,7 @@ DEFUN (no_bgp_deterministic_med,
                                "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use\n");
                        return CMD_WARNING_CONFIG_FAILED;
                } else {
-                       bgp_flag_unset(bgp, BGP_FLAG_DETERMINISTIC_MED);
+                       UNSET_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED);
                        bgp_recalculate_all_bestpaths(bgp);
                }
        }
@@ -2277,9 +2277,9 @@ DEFUN (bgp_graceful_restart_select_defer_time,
        defer_time = strtoul(argv[idx_number]->arg, NULL, 10);
        bgp->select_defer_time = defer_time;
        if (defer_time == 0)
-               bgp_flag_set(bgp, BGP_FLAG_SELECT_DEFER_DISABLE);
+               SET_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE);
        else
-               bgp_flag_unset(bgp, BGP_FLAG_SELECT_DEFER_DISABLE);
+               UNSET_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE);
 
        return CMD_SUCCESS;
 }
@@ -2326,7 +2326,7 @@ DEFUN (no_bgp_graceful_restart_select_defer_time,
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
        bgp->select_defer_time = BGP_DEFAULT_SELECT_DEFERRAL_TIME;
-       bgp_flag_unset(bgp, BGP_FLAG_SELECT_DEFER_DISABLE);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE);
 
        return CMD_SUCCESS;
 }
@@ -2339,7 +2339,7 @@ DEFUN (bgp_graceful_restart_preserve_fw,
        "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_GR_PRESERVE_FWD);
+       SET_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD);
        return CMD_SUCCESS;
 }
 
@@ -2352,7 +2352,7 @@ DEFUN (no_bgp_graceful_restart_preserve_fw,
        "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_GR_PRESERVE_FWD);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD);
        return CMD_SUCCESS;
 }
 
@@ -2646,7 +2646,7 @@ DEFUN_HIDDEN (bgp_graceful_restart_disable_eor,
               "Disable EOR Check\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_GR_DISABLE_EOR);
+       SET_FLAG(bgp->flags, BGP_FLAG_GR_DISABLE_EOR);
 
        return CMD_SUCCESS;
 }
@@ -2660,7 +2660,7 @@ DEFUN_HIDDEN (no_bgp_graceful_restart_disable_eor,
               "Disable EOR Check\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_GR_DISABLE_EOR);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_GR_DISABLE_EOR);
 
        return CMD_SUCCESS;
 }
@@ -2714,8 +2714,8 @@ DEFUN (bgp_graceful_shutdown,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
-       if (!bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
-               bgp_flag_set(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN);
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+               SET_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN);
                bgp_static_redo_import_check(bgp);
                bgp_redistribute_redo(bgp);
                bgp_clear_star_soft_out(vty, bgp->name);
@@ -2734,8 +2734,8 @@ DEFUN (no_bgp_graceful_shutdown,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
-       if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
-               bgp_flag_unset(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN);
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
+               UNSET_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN);
                bgp_static_redo_import_check(bgp);
                bgp_redistribute_redo(bgp);
                bgp_clear_star_soft_out(vty, bgp->name);
@@ -2753,7 +2753,7 @@ DEFUN (bgp_fast_external_failover,
        "Immediately reset session if a link to a directly connected external peer goes down\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER);
        return CMD_SUCCESS;
 }
 
@@ -2765,7 +2765,7 @@ DEFUN (no_bgp_fast_external_failover,
        "Immediately reset session if a link to a directly connected external peer goes down\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
+       SET_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER);
        return CMD_SUCCESS;
 }
 
@@ -2778,7 +2778,7 @@ DEFUN (bgp_bestpath_compare_router_id,
        "Compare router-id for identical EBGP paths\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_COMPARE_ROUTER_ID);
+       SET_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2793,7 +2793,7 @@ DEFUN (no_bgp_bestpath_compare_router_id,
        "Compare router-id for identical EBGP paths\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_COMPARE_ROUTER_ID);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2809,7 +2809,7 @@ DEFUN (bgp_bestpath_aspath_ignore,
        "Ignore as-path length in selecting a route\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_ASPATH_IGNORE);
+       SET_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2825,7 +2825,7 @@ DEFUN (no_bgp_bestpath_aspath_ignore,
        "Ignore as-path length in selecting a route\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_ASPATH_IGNORE);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2841,7 +2841,7 @@ DEFUN (bgp_bestpath_aspath_confed,
        "Compare path lengths including confederation sets & sequences in selecting a route\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_ASPATH_CONFED);
+       SET_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2857,7 +2857,7 @@ DEFUN (no_bgp_bestpath_aspath_confed,
        "Compare path lengths including confederation sets & sequences in selecting a route\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_ASPATH_CONFED);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2876,14 +2876,14 @@ DEFUN (bgp_bestpath_aspath_multipath_relax,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
        int idx = 0;
-       bgp_flag_set(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
+       SET_FLAG(bgp->flags, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
 
        /* no-as-set is now the default behavior so we can silently
         * ignore it */
        if (argv_find(argv, argc, "as-set", &idx))
-               bgp_flag_set(bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
+               SET_FLAG(bgp->flags, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
        else
-               bgp_flag_unset(bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
+               UNSET_FLAG(bgp->flags, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
 
        bgp_recalculate_all_bestpaths(bgp);
 
@@ -2902,8 +2902,8 @@ DEFUN (no_bgp_bestpath_aspath_multipath_relax,
        "Do not generate an AS_SET\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
-       bgp_flag_unset(bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
        bgp_recalculate_all_bestpaths(bgp);
 
        return CMD_SUCCESS;
@@ -2917,7 +2917,7 @@ DEFUN (bgp_log_neighbor_changes,
        "Log neighbor up/down and reset reason\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
+       SET_FLAG(bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
        return CMD_SUCCESS;
 }
 
@@ -2929,7 +2929,7 @@ DEFUN (no_bgp_log_neighbor_changes,
        "Log neighbor up/down and reset reason\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
        return CMD_SUCCESS;
 }
 
@@ -2949,10 +2949,10 @@ DEFUN (bgp_bestpath_med,
 
        int idx = 0;
        if (argv_find(argv, argc, "confed", &idx))
-               bgp_flag_set(bgp, BGP_FLAG_MED_CONFED);
+               SET_FLAG(bgp->flags, BGP_FLAG_MED_CONFED);
        idx = 0;
        if (argv_find(argv, argc, "missing-as-worst", &idx))
-               bgp_flag_set(bgp, BGP_FLAG_MED_MISSING_AS_WORST);
+               SET_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST);
 
        bgp_recalculate_all_bestpaths(bgp);
 
@@ -2975,10 +2975,10 @@ DEFUN (no_bgp_bestpath_med,
 
        int idx = 0;
        if (argv_find(argv, argc, "confed", &idx))
-               bgp_flag_unset(bgp, BGP_FLAG_MED_CONFED);
+               UNSET_FLAG(bgp->flags, BGP_FLAG_MED_CONFED);
        idx = 0;
        if (argv_find(argv, argc, "missing-as-worst", &idx))
-               bgp_flag_unset(bgp, BGP_FLAG_MED_MISSING_AS_WORST);
+               UNSET_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST);
 
        bgp_recalculate_all_bestpaths(bgp);
 
@@ -2995,7 +2995,7 @@ DEFUN (no_bgp_default_ipv4_unicast,
        "Activate ipv4-unicast for a peer by default\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_NO_DEFAULT_IPV4);
+       SET_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4);
        return CMD_SUCCESS;
 }
 
@@ -3007,7 +3007,7 @@ DEFUN (bgp_default_ipv4_unicast,
        "Activate ipv4-unicast for a peer by default\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_NO_DEFAULT_IPV4);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4);
        return CMD_SUCCESS;
 }
 
@@ -3020,7 +3020,7 @@ DEFUN (bgp_default_show_hostname,
        "Show hostname in certain command outputs\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_SHOW_HOSTNAME);
+       SET_FLAG(bgp->flags, BGP_FLAG_SHOW_HOSTNAME);
        return CMD_SUCCESS;
 }
 
@@ -3033,7 +3033,7 @@ DEFUN (no_bgp_default_show_hostname,
        "Show hostname in certain command outputs\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_SHOW_HOSTNAME);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_SHOW_HOSTNAME);
        return CMD_SUCCESS;
 }
 
@@ -3046,8 +3046,8 @@ DEFUN (bgp_network_import_check,
        "Check BGP network route exists in IGP\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) {
-               bgp_flag_set(bgp, BGP_FLAG_IMPORT_CHECK);
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)) {
+               SET_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK);
                bgp_static_redo_import_check(bgp);
        }
 
@@ -3070,8 +3070,8 @@ DEFUN (no_bgp_network_import_check,
        "Check BGP network route exists in IGP\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) {
-               bgp_flag_unset(bgp, BGP_FLAG_IMPORT_CHECK);
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)) {
+               UNSET_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK);
                bgp_static_redo_import_check(bgp);
        }
 
@@ -3158,8 +3158,8 @@ DEFUN (bgp_rr_allow_outbound_policy,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
-       if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
-               bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
+               SET_FLAG(bgp->flags, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
                update_group_announce_rrclients(bgp);
                bgp_clear_star_soft_out(vty, bgp->name);
        }
@@ -3177,8 +3177,8 @@ DEFUN (no_bgp_rr_allow_outbound_policy,
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
-       if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
-               bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
+               UNSET_FLAG(bgp->flags, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
                update_group_announce_rrclients(bgp);
                bgp_clear_star_soft_out(vty, bgp->name);
        }
@@ -3405,7 +3405,7 @@ DEFUN (bgp_disable_connected_route_check,
        "Disable checking if nexthop is connected on ebgp sessions\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_set(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
+       SET_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
        bgp_clear_star_soft_in(vty, bgp->name);
 
        return CMD_SUCCESS;
@@ -3419,7 +3419,7 @@ DEFUN (no_bgp_disable_connected_route_check,
        "Disable checking if nexthop is connected on ebgp sessions\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
-       bgp_flag_unset(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
+       UNSET_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
        bgp_clear_star_soft_in(vty, bgp->name);
 
        return CMD_SUCCESS;
@@ -3558,7 +3558,7 @@ static int peer_conf_interface_get(struct vty *vty, const char *conf_if,
                        ret = peer_remote_as(bgp, NULL, conf_if, &as, as_type,
                                             afi, safi);
        } else {
-               if (bgp_flag_check(bgp, BGP_FLAG_NO_DEFAULT_IPV4)
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4)
                    && afi == AFI_IP && safi == SAFI_UNICAST)
                        peer = peer_create(NULL, conf_if, bgp, bgp->as, as,
                                           as_type, 0, 0, NULL);
@@ -8513,14 +8513,14 @@ static void bgp_show_bestpath_json(struct bgp *bgp, json_object *json)
 {
        json_object *bestpath = json_object_new_object();
 
-       if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_IGNORE))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE))
                json_object_string_add(bestpath, "asPath", "ignore");
 
-       if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_CONFED))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED))
                json_object_string_add(bestpath, "asPath", "confed");
 
-       if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
-               if (bgp_flag_check(bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_MULTIPATH_RELAX_AS_SET))
                        json_object_string_add(bestpath, "multiPathRelax",
                                               "as-set");
                else
@@ -8529,13 +8529,13 @@ static void bgp_show_bestpath_json(struct bgp *bgp, json_object *json)
        } else
                json_object_string_add(bestpath, "multiPathRelax", "false");
 
-       if (bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID))
                json_object_string_add(bestpath, "compareRouterId", "true");
-       if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED)
-           || bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST)) {
-               if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED))
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED)
+           || CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED))
                        json_object_string_add(bestpath, "med", "confed");
-               if (bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST))
                        json_object_string_add(bestpath, "med",
                                               "missing-as-worst");
                else
@@ -8658,7 +8658,7 @@ static void bgp_show_failed_summary(struct vty *vty, struct bgp *bgp,
                dn_flag[1] = '\0';
                dn_flag[0] = peer_dynamic_neighbor(peer) ? '*' : '\0';
                if (peer->hostname
-                   && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
+                   && CHECK_FLAG(bgp->flags, BGP_FLAG_SHOW_HOSTNAME))
                        len = vty_out(vty, "%s%s(%s)", dn_flag,
                                      peer->hostname, peer->host);
                else
@@ -8741,8 +8741,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                        dn_flag[0] = '*';
 
                                if (peer->hostname
-                                   && bgp_flag_check(bgp,
-                                                     BGP_FLAG_SHOW_HOSTNAME))
+                                   && CHECK_FLAG(bgp->flags,
+                                                 BGP_FLAG_SHOW_HOSTNAME))
                                        sprintf(neighbor_buf, "%s%s(%s) ",
                                                dn_flag, peer->hostname,
                                                peer->host);
@@ -9103,9 +9103,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                }
 
                                if (peer->hostname
-                                   && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
+                                   && CHECK_FLAG(bgp->flags,
+                                                 BGP_FLAG_SHOW_HOSTNAME))
                                        len = vty_out(vty, "%s%s(%s)", dn_flag,
-                                                     peer->hostname, peer->host);
+                                                     peer->hostname,
+                                                     peer->host);
                                else
                                        len = vty_out(vty, "%s%s", dn_flag, peer->host);
 
@@ -14603,8 +14605,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
        } else {
                if (peer->afc[afi][safi]) {
                        if ((afi == AFI_IP) && (safi == SAFI_UNICAST)) {
-                               if (bgp_flag_check(bgp,
-                                                  BGP_FLAG_NO_DEFAULT_IPV4)) {
+                               if (CHECK_FLAG(bgp->flags,
+                                              BGP_FLAG_NO_DEFAULT_IPV4)) {
                                        vty_out(vty, "  neighbor %s activate\n",
                                                addr);
                                }
@@ -14612,8 +14614,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
                                vty_out(vty, "  neighbor %s activate\n", addr);
                } else {
                        if ((afi == AFI_IP) && (safi == SAFI_UNICAST)) {
-                               if (!bgp_flag_check(bgp,
-                                                   BGP_FLAG_NO_DEFAULT_IPV4)) {
+                               if (!CHECK_FLAG(bgp->flags,
+                                               BGP_FLAG_NO_DEFAULT_IPV4)) {
                                        vty_out(vty,
                                                "  no neighbor %s activate\n",
                                                addr);
@@ -14974,16 +14976,16 @@ int bgp_config_write(struct vty *vty)
                                inet_ntoa(bgp->router_id_static));
 
                /* BGP log-neighbor-changes. */
-               if (!!bgp_flag_check(bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)
+               if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)
                    != SAVE_BGP_LOG_NEIGHBOR_CHANGES)
                        vty_out(vty, " %sbgp log-neighbor-changes\n",
-                               bgp_flag_check(bgp,
-                                              BGP_FLAG_LOG_NEIGHBOR_CHANGES)
+                               CHECK_FLAG(bgp->flags,
+                                          BGP_FLAG_LOG_NEIGHBOR_CHANGES)
                                        ? ""
                                        : "no ");
 
                /* BGP configuration. */
-               if (bgp_flag_check(bgp, BGP_FLAG_ALWAYS_COMPARE_MED))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_ALWAYS_COMPARE_MED))
                        vty_out(vty, " bgp always-compare-med\n");
 
                /* RFC8212 default eBGP policy. */
@@ -14996,7 +14998,7 @@ int bgp_config_write(struct vty *vty)
                        vty_out(vty, " bgp reject-as-sets\n");
 
                /* BGP default ipv4-unicast. */
-               if (bgp_flag_check(bgp, BGP_FLAG_NO_DEFAULT_IPV4))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4))
                        vty_out(vty, " no bgp default ipv4-unicast\n");
 
                /* BGP default local-preference. */
@@ -15005,10 +15007,10 @@ int bgp_config_write(struct vty *vty)
                                bgp->default_local_pref);
 
                /* BGP default show-hostname */
-               if (!!bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)
+               if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_SHOW_HOSTNAME)
                    != SAVE_BGP_SHOW_HOSTNAME)
                        vty_out(vty, " %sbgp default show-hostname\n",
-                               bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)
+                               CHECK_FLAG(bgp->flags, BGP_FLAG_SHOW_HOSTNAME)
                                        ? ""
                                        : "no ");
 
@@ -15019,7 +15021,7 @@ int bgp_config_write(struct vty *vty)
                                bgp->default_subgroup_pkt_queue_max);
 
                /* BGP client-to-client reflection. */
-               if (bgp_flag_check(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_CLIENT_TO_CLIENT))
                        vty_out(vty, " no bgp client-to-client reflection\n");
 
                /* BGP cluster ID. */
@@ -15028,7 +15030,7 @@ int bgp_config_write(struct vty *vty)
                                inet_ntoa(bgp->cluster_id));
 
                /* Disable ebgp connected nexthop check */
-               if (bgp_flag_check(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
                        vty_out(vty,
                                " bgp disable-ebgp-connected-route-check\n");
 
@@ -15050,10 +15052,11 @@ int bgp_config_write(struct vty *vty)
                }
 
                /* BGP deterministic-med. */
-               if (!!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)
+               if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_DETERMINISTIC_MED)
                    != SAVE_BGP_DETERMINISTIC_MED)
                        vty_out(vty, " %sbgp deterministic-med\n",
-                               bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)
+                               CHECK_FLAG(bgp->flags,
+                                          BGP_FLAG_DETERMINISTIC_MED)
                                        ? ""
                                        : "no ");
 
@@ -15107,11 +15110,11 @@ int bgp_config_write(struct vty *vty)
                        vty_out(vty, " bgp graceful-restart-disable\n");
 
                /* BGP graceful-shutdown */
-               if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_SHUTDOWN))
                        vty_out(vty, " bgp graceful-shutdown\n");
 
                /* BGP graceful-restart Preserve State F bit. */
-               if (bgp_flag_check(bgp, BGP_FLAG_GR_PRESERVE_FWD))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD))
                        vty_out(vty,
                                " bgp graceful-restart preserve-fw-state\n");
 
@@ -15122,14 +15125,14 @@ int bgp_config_write(struct vty *vty)
                                bgp->rib_stale_time);
 
                /* BGP bestpath method. */
-               if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_IGNORE))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE))
                        vty_out(vty, " bgp bestpath as-path ignore\n");
-               if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_CONFED))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED))
                        vty_out(vty, " bgp bestpath as-path confed\n");
 
-               if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
-                       if (bgp_flag_check(bgp,
-                                          BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) {
+                       if (CHECK_FLAG(bgp->flags,
+                                      BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
                                vty_out(vty,
                                        " bgp bestpath as-path multipath-relax as-set\n");
                        } else {
@@ -15138,27 +15141,28 @@ int bgp_config_write(struct vty *vty)
                        }
                }
 
-               if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
                        vty_out(vty,
                                " bgp route-reflector allow-outbound-policy\n");
                }
-               if (bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID))
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID))
                        vty_out(vty, " bgp bestpath compare-routerid\n");
-               if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED)
-                   || bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST)) {
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED)
+                   || CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST)) {
                        vty_out(vty, " bgp bestpath med");
-                       if (bgp_flag_check(bgp, BGP_FLAG_MED_CONFED))
+                       if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED))
                                vty_out(vty, " confed");
-                       if (bgp_flag_check(bgp, BGP_FLAG_MED_MISSING_AS_WORST))
+                       if (CHECK_FLAG(bgp->flags,
+                                      BGP_FLAG_MED_MISSING_AS_WORST))
                                vty_out(vty, " missing-as-worst");
                        vty_out(vty, "\n");
                }
 
                /* BGP network import check. */
-               if (!!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)
+               if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
                    != SAVE_BGP_IMPORT_CHECK)
                        vty_out(vty, " %sbgp network import-check\n",
-                               bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)
+                               CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
                                        ? ""
                                        : "no ");
 
index 076b6aabca12b68282c4699cb0cf0cace2d7e32b..068b6794e7de5e10d3851c4b678d0f66c24ffa67 100644 (file)
@@ -1227,7 +1227,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
 
        if ((peer->sort == BGP_PEER_EBGP && peer->ttl != BGP_DEFAULT_TTL)
            || CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
-           || bgp_flag_check(bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
+           || CHECK_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
 
                SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
 
index 60bcc7b8e3482f4dd56cb4912573875edcc61cf9..fa64420cfd6347b32ca8ca79cfbb5dea56128319 100644 (file)
@@ -201,24 +201,6 @@ int bgp_option_check(int flag)
        return CHECK_FLAG(bm->options, flag);
 }
 
-/* BGP flag manipulation.  */
-int bgp_flag_set(struct bgp *bgp, int flag)
-{
-       SET_FLAG(bgp->flags, flag);
-       return 0;
-}
-
-int bgp_flag_unset(struct bgp *bgp, int flag)
-{
-       UNSET_FLAG(bgp->flags, flag);
-       return 0;
-}
-
-int bgp_flag_check(struct bgp *bgp, int flag)
-{
-       return CHECK_FLAG(bgp->flags, flag);
-}
-
 /* Internal function to set BGP structure configureation flag.  */
 static void bgp_config_set(struct bgp *bgp, int config)
 {
@@ -1818,7 +1800,7 @@ int peer_remote_as(struct bgp *bgp, union sockunion *su, const char *conf_if,
                /* If this is IPv4 unicast configuration and "no bgp default
                   ipv4-unicast" is specified. */
 
-               if (bgp_flag_check(bgp, BGP_FLAG_NO_DEFAULT_IPV4)
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4)
                    && afi == AFI_IP && safi == SAFI_UNICAST)
                        peer_create(su, conf_if, bgp, local_as, *as, as_type, 0,
                                    0, NULL);
@@ -2428,7 +2410,7 @@ struct peer_group *peer_group_get(struct bgp *bgp, const char *name)
        for (afi = AFI_IP; afi < AFI_MAX; afi++)
                group->listen_range[afi] = list_new();
        group->conf = peer_new(bgp);
-       if (!bgp_flag_check(bgp, BGP_FLAG_NO_DEFAULT_IPV4))
+       if (!CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4))
                group->conf->afc[AFI_IP][SAFI_UNICAST] = 1;
        XFREE(MTYPE_BGP_PEER_HOST, group->conf->host);
        group->conf->host = XSTRDUP(MTYPE_BGP_PEER_HOST, name);
@@ -3314,7 +3296,7 @@ int bgp_delete(struct bgp *bgp)
        THREAD_OFF(bgp->t_establish_wait);
 
        /* Set flag indicating bgp instance delete in progress */
-       bgp_flag_set(bgp, BGP_FLAG_DELETE_IN_PROGRESS);
+       SET_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS);
 
        /* Delete the graceful restart info */
        FOREACH_AFI_SAFI (afi, safi) {
index 87ba39a04210955b676dbd20fa21766fca9f09d3..e6a7c4b7f92f1319f283999533ccb260158d97c3 100644 (file)
@@ -239,7 +239,7 @@ enum bgp_instance_type {
 };
 
 #define BGP_SEND_EOR(bgp, afi, safi)                                           \
-       (!bgp_flag_check(bgp, BGP_FLAG_GR_DISABLE_EOR)                         \
+       (!CHECK_FLAG(bgp->flags, BGP_FLAG_GR_DISABLE_EOR)                      \
         && ((bgp->gr_info[afi][safi].t_select_deferral == NULL)               \
             || (bgp->gr_info[afi][safi].eor_required                          \
                 == bgp->gr_info[afi][safi].eor_received)))
@@ -674,7 +674,7 @@ struct afi_safi_info {
             && bgp->vrf_id != VRF_UNKNOWN))
 
 #define BGP_SELECT_DEFER_DISABLE(bgp)                                          \
-       (bgp_flag_check(bgp, BGP_FLAG_SELECT_DEFER_DISABLE))
+       (CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE))
 
 /* BGP peer-group support. */
 struct peer_group {
@@ -1763,10 +1763,6 @@ extern int bgp_delete(struct bgp *);
 extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf,
                             vrf_id_t old_vrf_id, bool create);
 
-extern int bgp_flag_set(struct bgp *, int);
-extern int bgp_flag_unset(struct bgp *, int);
-extern int bgp_flag_check(struct bgp *, int);
-
 extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *);
 extern int bgp_router_id_static_set(struct bgp *, struct in_addr);
 
index 660442b49209fd72c6258a6f4eb6fe9d1994938f..61cbae1675e3808864983d5dd4bc2f640b3f136f 100644 (file)
@@ -2388,10 +2388,10 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
                    __func__);
                return 0;
        }
-       if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS)) {
+       if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) {
                vnc_zlog_debug_verbose(
-                   "%s: BGP delete in progress, assume shutdown race condition!!!",
-                   __func__);
+                       "%s: BGP delete in progress, assume shutdown race condition!!!",
+                       __func__);
                return 0;
        }
        assert(wcb->node);
index 922c0fe3e7863b5eff7f305d7242717d61b35628..add758fa210a89313562015decea7247bf463e01 100644 (file)
@@ -229,5 +229,5 @@ int main(int argc, char **argv, char **envp)
        frr_run(master);
 
        /* Not reached. */
-       return (0);
+       return 0;
 }
index 582106ebd429356cf98b6ff224c0f4e89dc6501a..445742807cba4efa4043c87e9079f3e20e264a12 100644 (file)
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -83,7 +83,7 @@ csv_t *csv_init(csv_t *csv, char *buf, int buflen)
                csv = malloc(sizeof(csv_t));
                if (csv == NULL) {
                        log_error("CSV Malloc failed\n");
-                       return (NULL);
+                       return NULL;
                }
        }
        memset(csv, 0, sizeof(csv_t));
@@ -144,7 +144,7 @@ char *csv_field_iter_next(csv_field_t **fld)
 {
        *fld = TAILQ_NEXT(*fld, next_field);
        if ((*fld) == NULL) {
-               return (NULL);
+               return NULL;
        }
        return ((*fld)->field);
 }
@@ -198,7 +198,7 @@ static csv_field_t *csv_add_field_to_record(csv_t *csv, csv_record_t *rec,
        if (!fld) {
                log_error("field malloc failed\n");
                /* more cleanup needed */
-               return (NULL);
+               return NULL;
        }
        TAILQ_INSERT_TAIL(&(rec->fields), fld, next_field);
        fld->field = str + rlen;
@@ -227,7 +227,7 @@ csv_record_t *csv_encode(csv_t *csv, int count, ...)
                str = (char *)malloc(csv->buflen);
                if (!str) {
                        log_error("field str malloc failed\n");
-                       return (NULL);
+                       return NULL;
                }
        }
 
@@ -238,7 +238,7 @@ csv_record_t *csv_encode(csv_t *csv, int count, ...)
                if (!buf)
                        free(str);
                va_end(list);
-               return (NULL);
+               return NULL;
        }
        csv_init_record(rec);
        rec->record = str;
@@ -255,7 +255,7 @@ csv_record_t *csv_encode(csv_t *csv, int count, ...)
                        log_error("fld malloc failed\n");
                        csv_remove_record(csv, rec);
                        va_end(list);
-                       return (NULL);
+                       return NULL;
                }
                if (tempc < (count - 1)) {
                        rec->rec_len += snprintf((str + rec->rec_len),
@@ -494,21 +494,21 @@ csv_record_t *csv_concat_record(csv_t *csv, csv_record_t *rec1,
        if (!csv_is_record_valid(csv, rec1)
            || !csv_is_record_valid(csv, rec2)) {
                log_error("rec1 and/or rec2 invalid\n");
-               return (NULL);
+               return NULL;
        }
 
        /* we can only concat records if no buf was supplied during csv init */
        if (csv->buf) {
                log_error(
                        "un-supported for this csv type - single buf detected\n");
-               return (NULL);
+               return NULL;
        }
 
        /* create a new rec */
        rec = calloc(1, sizeof(csv_record_t));
        if (!rec) {
                log_error("record malloc failed\n");
-               return (NULL);
+               return NULL;
        }
        csv_init_record(rec);
 
index c2f4052b8f5ea66be9be7b5f3cfdcba19cc570a7..4d41702707cdba56cd07dd5650d719d5ed84396a 100644 (file)
@@ -30,10 +30,10 @@ struct ibuf *ibuf_open(size_t len)
        struct ibuf *buf;
 
        if ((buf = calloc(1, sizeof(struct ibuf))) == NULL)
-               return (NULL);
+               return NULL;
        if ((buf->buf = malloc(len)) == NULL) {
                free(buf);
-               return (NULL);
+               return NULL;
        }
        buf->size = buf->max = len;
        buf->fd = -1;
@@ -46,10 +46,10 @@ struct ibuf *ibuf_dynamic(size_t len, size_t max)
        struct ibuf *buf;
 
        if (max < len)
-               return (NULL);
+               return NULL;
 
        if ((buf = ibuf_open(len)) == NULL)
-               return (NULL);
+               return NULL;
 
        if (max > 0)
                buf->max = max;
@@ -64,27 +64,27 @@ static int ibuf_realloc(struct ibuf *buf, size_t len)
        /* on static buffers max is eq size and so the following fails */
        if (buf->wpos + len > buf->max) {
                errno = ERANGE;
-               return (-1);
+               return -1;
        }
 
        b = realloc(buf->buf, buf->wpos + len);
        if (b == NULL)
-               return (-1);
+               return -1;
        buf->buf = b;
        buf->size = buf->wpos + len;
 
-       return (0);
+       return 0;
 }
 
 int ibuf_add(struct ibuf *buf, const void *data, size_t len)
 {
        if (buf->wpos + len > buf->size)
                if (ibuf_realloc(buf, len) == -1)
-                       return (-1);
+                       return -1;
 
        memcpy(buf->buf + buf->wpos, data, len);
        buf->wpos += len;
-       return (0);
+       return 0;
 }
 
 void *ibuf_reserve(struct ibuf *buf, size_t len)
@@ -93,7 +93,7 @@ void *ibuf_reserve(struct ibuf *buf, size_t len)
 
        if (buf->wpos + len > buf->size)
                if (ibuf_realloc(buf, len) == -1)
-                       return (NULL);
+                       return NULL;
 
        b = buf->buf + buf->wpos;
        buf->wpos += len;
@@ -104,7 +104,7 @@ void *ibuf_seek(struct ibuf *buf, size_t pos, size_t len)
 {
        /* only allowed to seek in already written parts */
        if (pos + len > buf->wpos)
-               return (NULL);
+               return NULL;
 
        return (buf->buf + pos);
 }
@@ -146,17 +146,17 @@ again:
                        goto again;
                if (errno == ENOBUFS)
                        errno = EAGAIN;
-               return (-1);
+               return -1;
        }
 
        if (n == 0) { /* connection closed */
                errno = 0;
-               return (0);
+               return 0;
        }
 
        msgbuf_drain(msgbuf, n);
 
-       return (1);
+       return 1;
 }
 
 void ibuf_free(struct ibuf *buf)
@@ -246,12 +246,12 @@ again:
                        goto again;
                if (errno == ENOBUFS)
                        errno = EAGAIN;
-               return (-1);
+               return -1;
        }
 
        if (n == 0) { /* connection closed */
                errno = 0;
-               return (0);
+               return 0;
        }
 
        /*
@@ -265,7 +265,7 @@ again:
 
        msgbuf_drain(msgbuf, n);
 
-       return (1);
+       return 1;
 }
 
 static void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
index f07c56f0a64500b009fe6fa9766bc1f4b51b9abf..b46d5cbc24586f6ffc7763dc4bf8e844f4f49ffe 100644 (file)
@@ -37,7 +37,7 @@ static int available_fds(unsigned int n)
        int ret, fds[256];
 
        if (n > (unsigned int)array_size(fds))
-               return (1);
+               return 1;
 
        ret = 0;
        for (i = 0; i < n; i++) {
@@ -93,7 +93,7 @@ ssize_t imsg_read(struct imsgbuf *ibuf)
        msg.msg_controllen = sizeof(cmsgbuf.buf);
 
        if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
-               return (-1);
+               return -1;
 
 again:
 #ifdef __OpenBSD__
@@ -108,7 +108,7 @@ again:
 #endif
                errno = EAGAIN;
                free(ifd);
-               return (-1);
+               return -1;
        }
 
        n = recvmsg(ibuf->fd, &msg, 0);
@@ -161,21 +161,21 @@ ssize_t imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
        av = ibuf->r.wpos;
 
        if (IMSG_HEADER_SIZE > av)
-               return (0);
+               return 0;
 
        memcpy(&imsg->hdr, ibuf->r.buf, sizeof(imsg->hdr));
        if (imsg->hdr.len < IMSG_HEADER_SIZE || imsg->hdr.len > MAX_IMSGSIZE) {
                errno = ERANGE;
-               return (-1);
+               return -1;
        }
        if (imsg->hdr.len > av)
-               return (0);
+               return 0;
        datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
        ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE;
        if (datalen == 0)
                imsg->data = NULL;
        else if ((imsg->data = malloc(datalen)) == NULL)
-               return (-1);
+               return -1;
 
        if (imsg->hdr.flags & IMSGF_HASFD)
                imsg->fd = imsg_get_fd(ibuf);
@@ -201,16 +201,16 @@ int imsg_compose(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
        struct ibuf *wbuf;
 
        if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
-               return (-1);
+               return -1;
 
        if (imsg_add(wbuf, data, datalen) == -1)
-               return (-1);
+               return -1;
 
        wbuf->fd = fd;
 
        imsg_close(ibuf, wbuf);
 
-       return (1);
+       return 1;
 }
 
 int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
@@ -223,17 +223,17 @@ int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
                datalen += iov[i].iov_len;
 
        if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
-               return (-1);
+               return -1;
 
        for (i = 0; i < iovcnt; i++)
                if (imsg_add(wbuf, iov[i].iov_base, iov[i].iov_len) == -1)
-                       return (-1);
+                       return -1;
 
        wbuf->fd = fd;
 
        imsg_close(ibuf, wbuf);
 
-       return (1);
+       return 1;
 }
 
 /* ARGSUSED */
@@ -248,7 +248,7 @@ struct ibuf *imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
        datalen += IMSG_HEADER_SIZE;
        if (datalen > MAX_IMSGSIZE) {
                errno = ERANGE;
-               return (NULL);
+               return NULL;
        }
 
        hdr.type = type;
@@ -257,10 +257,10 @@ struct ibuf *imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
        if ((hdr.pid = pid) == 0)
                hdr.pid = ibuf->pid;
        if ((wbuf = ibuf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) {
-               return (NULL);
+               return NULL;
        }
        if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1)
-               return (NULL);
+               return NULL;
 
        return (wbuf);
 }
@@ -270,7 +270,7 @@ int imsg_add(struct ibuf *msg, const void *data, uint16_t datalen)
        if (datalen)
                if (ibuf_add(msg, data, datalen) == -1) {
                        ibuf_free(msg);
-                       return (-1);
+                       return -1;
                }
        return (datalen);
 }
@@ -301,7 +301,7 @@ int imsg_get_fd(struct imsgbuf *ibuf)
        struct imsg_fd *ifd;
 
        if ((ifd = TAILQ_POP_FIRST(&ibuf->fds, entry)) == NULL)
-               return (-1);
+               return -1;
 
        fd = ifd->fd;
        free(ifd);
@@ -313,8 +313,8 @@ int imsg_flush(struct imsgbuf *ibuf)
 {
        while (ibuf->w.queued)
                if (msgbuf_write(&ibuf->w) <= 0)
-                       return (-1);
-       return (0);
+                       return -1;
+       return 0;
 }
 
 void imsg_clear(struct imsgbuf *ibuf)
index ddcc59fa8f5920d0e832a400c24128c90c46639a..98d2e155e38af38dceabd690aa673c550fdd63bb 100644 (file)
@@ -431,7 +431,7 @@ void *_rb_insert(const struct rb_type *t, struct rbt_tree *rbt, void *elm)
 
        rbe_insert_color(t, rbt, rbe);
 
-       return (NULL);
+       return NULL;
 }
 
 /* Finds the node with the same key as elm */
@@ -453,7 +453,7 @@ void *_rb_find(const struct rb_type *t, const struct rbt_tree *rbt,
                        return (node);
        }
 
-       return (NULL);
+       return NULL;
 }
 
 /* Finds the first node greater than or equal to the search key */
index 45e4f86229538b632a98f32bb5612b96fdcabb77..20a58eacdc2eebf250c0741ad5f281f16e11b8d4 100644 (file)
@@ -125,11 +125,11 @@ _ensurespace(struct typetable *types)
 
        if (types->nextarg >= types->tablesize) {
                if (__grow_type_table(types))
-                       return (-1);
+                       return -1;
        }
        if (types->nextarg > types->tablemax)
                types->tablemax = types->nextarg;
-       return (0);
+       return 0;
 }
 
 /*
@@ -141,9 +141,9 @@ addtype(struct typetable *types, enum typeid type)
 {
 
        if (_ensurespace(types))
-               return (-1);
+               return -1;
        types->table[types->nextarg++] = type;
-       return (0);
+       return 0;
 }
 
 static inline int
@@ -151,7 +151,7 @@ addsarg(struct typetable *types, int flags)
 {
 
        if (_ensurespace(types))
-               return (-1);
+               return -1;
        if (flags & LONGDBL)
                types->table[types->nextarg++] = T_INT64T;
        else if (flags & INTMAXT)
@@ -166,7 +166,7 @@ addsarg(struct typetable *types, int flags)
                types->table[types->nextarg++] = T_LONG;
        else
                types->table[types->nextarg++] = T_INT;
-       return (0);
+       return 0;
 }
 
 static inline int
@@ -174,7 +174,7 @@ adduarg(struct typetable *types, int flags)
 {
 
        if (_ensurespace(types))
-               return (-1);
+               return -1;
        if (flags & LONGDBL)
                types->table[types->nextarg++] = T_UINT64T;
        else if (flags & INTMAXT)
@@ -189,7 +189,7 @@ adduarg(struct typetable *types, int flags)
                types->table[types->nextarg++] = T_U_LONG;
        else
                types->table[types->nextarg++] = T_U_INT;
-       return (0);
+       return 0;
 }
 
 /*
@@ -211,14 +211,14 @@ addaster(struct typetable *types, char **fmtp)
                u_int hold = types->nextarg;
                types->nextarg = n2;
                if (addtype(types, T_INT))
-                       return (-1);
+                       return -1;
                types->nextarg = hold;
                *fmtp = ++cp;
        } else {
                if (addtype(types, T_INT))
-                       return (-1);
+                       return -1;
        }
-       return (0);
+       return 0;
 }
 
 #ifdef WCHAR_SUPPORT
@@ -238,14 +238,14 @@ addwaster(struct typetable *types, wchar_t **fmtp)
                u_int hold = types->nextarg;
                types->nextarg = n2;
                if (addtype(types, T_INT))
-                       return (-1);
+                       return -1;
                types->nextarg = hold;
                *fmtp = ++cp;
        } else {
                if (addtype(types, T_INT))
-                       return (-1);
+                       return -1;
        }
-       return (0);
+       return 0;
 }
 #endif /* WCHAR_SUPPORT */
 
@@ -652,19 +652,19 @@ __grow_type_table(struct typetable *types)
 
        /* Detect overflow */
        if (types->nextarg > MAX_POSARG)
-               return (-1);
+               return -1;
 
        newsize = oldsize * 2;
        if (newsize < types->nextarg + 1)
                newsize = types->nextarg + 1;
        if (oldsize == STATIC_ARG_TBL_SIZE) {
                if ((newtable = malloc(newsize * sizeof(enum typeid))) == NULL)
-                       return (-1);
+                       return -1;
                bcopy(oldtable, newtable, oldsize * sizeof(enum typeid));
        } else {
                newtable = realloc(oldtable, newsize * sizeof(enum typeid));
                if (newtable == NULL)
-                       return (-1);
+                       return -1;
        }
        for (n = oldsize; n < newsize; n++)
                newtable[n] = T_UNUSED;
@@ -672,7 +672,7 @@ __grow_type_table(struct typetable *types)
        types->table = newtable;
        types->tablesize = newsize;
 
-       return (0);
+       return 0;
 }
 
 /*
index 07df6dd8fe17591066f7887f43986f0f300b3ba9..6ffccb3811eae3ffa9500f9a684cef6a05868ffe 100644 (file)
@@ -94,7 +94,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
                mbs = initial;
                nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs);
                if (nbytes == (size_t)-1)
-                       return (NULL);
+                       return NULL;
        } else {
                /*
                 * Optimisation: if the output precision is small enough,
@@ -117,7 +117,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
                }
        }
        if ((convbuf = malloc(nbytes + 1)) == NULL)
-               return (NULL);
+               return NULL;
 
        /* Fill the output buffer. */
        p = wcsarg;
@@ -125,7 +125,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
        if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
            nbytes, &mbs)) == (size_t)-1) {
                free(convbuf);
-               return (NULL);
+               return NULL;
        }
        convbuf[nbytes] = '\0';
        return (convbuf);
index a2ce9a0e2f3fda49e69e7c20ca16776f54da31c0..54f027deebc33800874162dad0b91a85aceeffa7 100644 (file)
@@ -92,36 +92,36 @@ static int _ptm_lib_decode_header(csv_t *csv, int *msglen, int *version,
        rec = csv_record_iter(csv);
        if (rec == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        hdr = csv_field_iter(rec, &fld);
        if (hdr == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        *msglen = atoi(hdr);
        hdr = csv_field_iter_next(&fld);
        if (hdr == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        *version = atoi(hdr);
        hdr = csv_field_iter_next(&fld);
        if (hdr == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        *type = atoi(hdr);
        hdr = csv_field_iter_next(&fld);
        if (hdr == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        *cmd_id = atoi(hdr);
        hdr = csv_field_iter_next(&fld);
        if (hdr == NULL) {
                DLOG("malformed CSV\n");
-               return (-1);
+               return -1;
        }
        /* remove leading spaces */
        for (i = j = 0; i < csv_field_len(fld); i++) {
@@ -132,7 +132,7 @@ static int _ptm_lib_decode_header(csv_t *csv, int *msglen, int *version,
        }
        client_name[j] = '\0';
 
-       return (0);
+       return 0;
 }
 
 int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
@@ -364,7 +364,7 @@ int ptm_lib_process_msg(ptm_lib_handle_t *hdl, int fd, char *inbuf, int inlen,
 
        if (!csv) {
                DLOG("Cannot allocate csv for hdr\n");
-               return (-1);
+               return -1;
        }
 
        rc = _ptm_lib_decode_header(csv, &msglen, &ver, &type, &cmd_id,
@@ -390,14 +390,14 @@ int ptm_lib_process_msg(ptm_lib_handle_t *hdl, int fd, char *inbuf, int inlen,
                /* we only support the get-status cmd */
                if (strcmp(inbuf, PTMLIB_CMD_GET_STATUS)) {
                        DLOG("unsupported legacy cmd %s\n", inbuf);
-                       return (-1);
+                       return -1;
                }
                /* internally create a csv-style cmd */
                ptm_lib_init_msg(hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL,
                                 (void *)&p_ctxt);
                if (!p_ctxt) {
                        DLOG("couldnt allocate context\n");
-                       return (-1);
+                       return -1;
                }
                ptm_lib_append_msg(hdl, p_ctxt, "cmd", PTMLIB_CMD_GET_STATUS);
 
index e46323028ddc3afe72d2047559a581dcd57b9a48..a604c5921cd2b5ff454351a0fed75678d4fc0d96 100644 (file)
@@ -1157,7 +1157,7 @@ const char *route_map_get_match_arg(struct route_map_index *index,
                if (rule->cmd == cmd && rule->rule_str != NULL)
                        return (rule->rule_str);
 
-       return (NULL);
+       return NULL;
 }
 
 static route_map_event_t get_route_map_delete_event(route_map_event_t type)
index 3886fc678e33850801b987a08874ca5e2bea5319..7e8cd9d8f7a63e374c184ae41d110c224a9b4d3c 100644 (file)
@@ -395,7 +395,7 @@ struct rb_entry *typed_rb_find(struct rbt_tree *rbt, const struct rb_entry *key,
                        return tmp;
        }
 
-       return (NULL);
+       return NULL;
 }
 
 struct rb_entry *typed_rb_find_gteq(struct rbt_tree *rbt,
index 484e5adae674a3ab044629e0b346d0dad7640fa5..e4c4d4ad9c578529d38734ed4e1b35c5acaece3b 100644 (file)
@@ -157,7 +157,7 @@ static int ospf6_area_stub_set(struct ospf6 *ospf6, struct ospf6_area *area)
                ospf6_area_stub_update(area);
        }
 
-       return (1);
+       return 1;
 }
 
 static void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area)
index 0fde997a207b9692feb2f9db6dace2e0fc39ed66..61879b2cbb4b95bad8b519b892bc1332d64155fe 100644 (file)
@@ -172,13 +172,13 @@ int ospf6_router_is_stub_router(struct ospf6_lsa *lsa)
                                      + sizeof(struct ospf6_lsa_header));
 
                if (!OSPF6_OPT_ISSET(rtr_lsa->options, OSPF6_OPT_R)) {
-                       return (OSPF6_IS_STUB_ROUTER);
+                       return OSPF6_IS_STUB_ROUTER;
                } else if (!OSPF6_OPT_ISSET(rtr_lsa->options, OSPF6_OPT_V6)) {
-                       return (OSPF6_IS_STUB_ROUTER_V6);
+                       return OSPF6_IS_STUB_ROUTER_V6;
                }
        }
 
-       return (OSPF6_NOT_STUB_ROUTER);
+       return OSPF6_NOT_STUB_ROUTER;
 }
 
 int ospf6_router_lsa_originate(struct thread *thread)
@@ -596,7 +596,7 @@ static char *ospf6_link_lsa_get_prefix_str(struct ospf6_lsa *lsa, char *buf,
 
                prefixnum = ntohl(link_lsa->prefix_num);
                if (pos > prefixnum)
-                       return (NULL);
+                       return NULL;
 
                start = (char *)link_lsa + sizeof(struct ospf6_link_lsa);
                end = (char *)lsa->header + ntohs(lsa->header->length);
@@ -606,7 +606,7 @@ static char *ospf6_link_lsa_get_prefix_str(struct ospf6_lsa *lsa, char *buf,
                        prefix = (struct ospf6_prefix *)current;
                        if (prefix->prefix_length == 0
                            || current + OSPF6_PREFIX_SIZE(prefix) > end) {
-                               return (NULL);
+                               return NULL;
                        }
 
                        if (cnt < pos) {
@@ -623,7 +623,7 @@ static char *ospf6_link_lsa_get_prefix_str(struct ospf6_lsa *lsa, char *buf,
                        }
                } while (current <= end);
        }
-       return (NULL);
+       return NULL;
 }
 
 static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
@@ -797,7 +797,7 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa,
 
                prefixnum = ntohs(intra_prefix_lsa->prefix_num);
                if (pos > prefixnum)
-                       return (NULL);
+                       return NULL;
 
                start = (char *)intra_prefix_lsa
                        + sizeof(struct ospf6_intra_prefix_lsa);
index 28b15769d7608d0e74344eea20e60382451d1630..723746c4719f11fa8ce5f0277f2380142afac89c 100644 (file)
@@ -336,7 +336,7 @@ int ospf6_route_get_first_nh_index(struct ospf6_route *route)
                        return nh->ifindex;
        }
 
-       return (-1);
+       return -1;
 }
 
 int ospf6_nexthop_cmp(struct ospf6_nexthop *a, struct ospf6_nexthop *b)
index 9cde64bc38b50d4f1dbf1b165a94926f46ee499d..4d6ebb40eb04bc1f5ae6cc0e8c3a32f943f357ff 100644 (file)
@@ -235,5 +235,5 @@ int main(int argc, char **argv)
        frr_run(master);
 
        /* Not reached. */
-       return (0);
+       return 0;
 }
index ca41afaea6a8e711542b0a304e741ab1f06a17dd..73e94deefccdd69e3c672b5a86e9a757433f6c31 100644 (file)
@@ -180,5 +180,5 @@ int main(int argc, char **argv)
        frr_run(master);
 
        /* Not reached. */
-       return (0);
+       return 0;
 }
diff --git a/scripts/coccinelle/replace_bgp_flag_functions.cocci b/scripts/coccinelle/replace_bgp_flag_functions.cocci
new file mode 100644 (file)
index 0000000..3064fc0
--- /dev/null
@@ -0,0 +1,14 @@
+@@
+expression e1, e2;
+@@
+
+(
+- bgp_flag_check(e1, e2)
++ CHECK_FLAG(e1->flags, e2)
+|
+- bgp_flag_set(e1, e2)
++ SET_FLAG(e1->flags, e2)
+|
+- bgp_flag_unset(e1, e2)
++ UNSET_FLAG(e1->flags, e2)
+)
diff --git a/scripts/coccinelle/return_without_parenthesis.cocci b/scripts/coccinelle/return_without_parenthesis.cocci
new file mode 100644 (file)
index 0000000..7097e87
--- /dev/null
@@ -0,0 +1,9 @@
+// Do not apply only for ldpd daemon since it uses the BSD coding style,
+// where parentheses on return is expected.
+
+@@
+constant c;
+@@
+
+- return (c);
++ return c;
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py
new file mode 100644 (file)
index 0000000..d447548
--- /dev/null
@@ -0,0 +1,9 @@
+from lutil import luCommand
+rtrs = ['ce1', 'ce2', 'ce3', 'r1', 'r2', 'r3', 'r4']
+for rtr in rtrs:
+    ret = luCommand(rtr, 'vtysh -c "show bgp neigh"', 'Notification received .([A-Za-z0-9/ ]*)', 'none', 'collect neighbor stats')
+    found = luLast()
+    if ret != False and found != None:
+        val = found.group(1)
+        ret = luCommand(rtr, 'vtysh -c "show bgp neigh"', 'Notification received', 'fail', 'Notify RXed! {}'.format(val))
+#done
index 2dad5e7687a06daae1f960968ed5189202f5abd2..7e36398298c5bb788c035f0e46d684ea98a66062 100755 (executable)
@@ -47,6 +47,15 @@ def test_adjacencies():
     #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True)'
     ltemplateTest('scripts/adjacencies.py', False, CliOnFail, CheckFunc)
 
+def test_notification_check():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
+    ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc)
+
 def SKIP_test_add_routes():
     CliOnFail = None
     # For debugging, uncomment the next line
@@ -75,6 +84,15 @@ def test_check_linux_mpls():
     #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
     ltemplateTest('scripts/check_linux_mpls.py', False, CliOnFail, CheckFunc)
 
+def test_notification_check():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
+    ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc)
+
 def test_check_scale_up():
     CliOnFail = None
     # For debugging, uncomment the next line
@@ -84,6 +102,15 @@ def test_check_scale_up():
     #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
     ltemplateTest('scripts/scale_up.py', False, CliOnFail, CheckFunc)
 
+def test_notification_check():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
+    ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc)
+
 def test_check_scale_down():
     CliOnFail = None
     # For debugging, uncomment the next line
@@ -93,6 +120,15 @@ def test_check_scale_down():
     #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
     ltemplateTest('scripts/scale_down.py', False, CliOnFail, CheckFunc)
 
+def test_notification_check():
+    CliOnFail = None
+    # For debugging, uncomment the next line
+    #CliOnFail = 'tgen.mininet_cli'
+    CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')'
+    #uncomment next line to start cli *before* script is run
+    #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')'
+    ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc)
+
 def SKIP_test_cleanup_all():
     CliOnFail = None
     # For debugging, uncomment the next line
index f02f4c4e2184e2c41358a1f1fbef50f081ba9c35..c0d11fd5e011a60a4d86c9dca8ef16c2ef51a554 100755 (executable)
@@ -185,7 +185,7 @@ def test_mpls_interfaces():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify MPLS Interfaces
     print("\n\n** Verifying MPLS Interfaces")
     print("******************************************\n")
     failures = 0
@@ -238,7 +238,7 @@ def test_mpls_ldp_neighbor_establish():
     if (fatal_error != ""):
         pytest.skip(fatal_error)
 
-    # Wait for OSPF6 to converge  (All Neighbors in either Full or TwoWay State)
+    # Wait for MPLS LDP neighbors to establish.
     print("\n\n** Verify MPLS LDP neighbors to establish")
     print("******************************************\n")
     timeout = 90
@@ -302,12 +302,12 @@ def test_mpls_ldp_discovery():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify MPLS LDP discovery
     print("\n\n** Verifying MPLS LDP discovery")
     print("******************************************\n")
     failures = 0
     for i in range(1, 5):
-        refTableFile = '%s/r%s/show_mpls_ldp_discovery.ref'
+        refTableFile = '%s/r%s/show_mpls_ldp_discovery.ref' % (thisDir, i)
         if os.path.isfile(refTableFile):
             # Actual output from router
             actual = net['r%s' % i].cmd('vtysh -c "show mpls ldp discovery" 2> /dev/null').rstrip()
@@ -356,12 +356,12 @@ def test_mpls_ldp_neighbor():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify MPLS LDP neighbor
     print("\n\n** Verifying MPLS LDP neighbor")
     print("******************************************\n")
     failures = 0
     for i in range(1, 5):
-        refTableFile = '%s/r%s/show_mpls_ldp_neighbor.ref'
+        refTableFile = '%s/r%s/show_mpls_ldp_neighbor.ref' % (thisDir, i)
         if os.path.isfile(refTableFile):
             # Read expected result from file
             expected = open(refTableFile).read().rstrip()
@@ -415,12 +415,12 @@ def test_mpls_ldp_binding():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify MPLS LDP binding
     print("\n\n** Verifying MPLS LDP binding")
     print("******************************************\n")
     failures = 0
     for i in range(1, 5):
-        refTableFile = '%s/r%s/show_mpls_ldp_binding.ref'
+        refTableFile = '%s/r%s/show_mpls_ldp_binding.ref' % (thisDir, i)
         if os.path.isfile(refTableFile):
             # Read expected result from file
             expected = open(refTableFile).read().rstrip()
@@ -484,12 +484,12 @@ def test_zebra_ipv4_routingTable():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify Zebra IPv4 Routing Table
     print("\n\n** Verifying Zebra IPv4 Routing Table")
     print("******************************************\n")
     failures = 0
     for i in range(1, 5):
-        refTableFile = '%s/r%s/show_ipv4_route.ref'
+        refTableFile = '%s/r%s/show_ipv4_route.ref' % (thisDir, i)
         if os.path.isfile(refTableFile):
             # Read expected result from file
             expected = open(refTableFile).read().rstrip()
@@ -547,13 +547,13 @@ def test_mpls_table():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify MPLS table
     print("\n\n** Verifying MPLS table")
     print("******************************************\n")
     failures = 0
 
     for i in range(1, 5):
-        refTableFile = '%s/r%s/show_mpls_table.ref'
+        refTableFile = '%s/r%s/show_mpls_table.ref' % (thisDir, i)
         if os.path.isfile(refTableFile):
             # Read expected result from file
             expected = open(refTableFile).read()
@@ -562,7 +562,7 @@ def test_mpls_table():
 
             # Actual output from router
             actual = net['r%s' % i].cmd('vtysh -c "show mpls table" 2> /dev/null')
+
             # Fix inconsistent Label numbers at beginning of line
             actual = re.sub(r"(\s+)[0-9]+(\s+LDP)", r"\1XX\2", actual)
             # Fix inconsistent Label numbers at end of line
@@ -617,7 +617,7 @@ def test_linux_mpls_routes():
 
     thisDir = os.path.dirname(os.path.realpath(__file__))
 
-    # Verify OSPFv3 Routing Table
+    # Verify Linux Kernel MPLS routes
     print("\n\n** Verifying Linux Kernel MPLS routes")
     print("******************************************\n")
     failures = 0
index 3a46835d1afe1f549054f6eb3cfdf142b767a51a..225524c67e0a227347406a6ecfca02e961fdddf1 100644 (file)
@@ -704,7 +704,7 @@ int vtysh_mark_file(const char *filename)
        if (confp == NULL) {
                fprintf(stderr, "%% Can't open config file %s due to '%s'.\n",
                        filename, safe_strerror(errno));
-               return (CMD_ERR_NO_FILE);
+               return CMD_ERR_NO_FILE;
        }
 
        vty = vty_new();
@@ -885,7 +885,7 @@ int vtysh_mark_file(const char *filename)
        if (confp != stdin)
                fclose(confp);
 
-       return (0);
+       return 0;
 }
 
 /* Configration make from file. */
index 27f4b0834d00ab4c73e79ab1cc99e0980efd5f33..9b1f0208e0e7005121cc5750570d77b5b1431ff5 100644 (file)
@@ -520,7 +520,7 @@ int vtysh_read_config(const char *config_default_dir)
                fprintf(stderr,
                        "%% Can't open configuration file %s due to '%s'.\n",
                        config_default_dir, safe_strerror(errno));
-               return (CMD_ERR_NO_FILE);
+               return CMD_ERR_NO_FILE;
        }
 
        ret = vtysh_read_file(confp);
index 0ba1b9d9c8c70b23461ee5c4a36ffd52ea84a0e1..59512742572d2e2b72e67091a4b6bf55ddd838dd 100644 (file)
@@ -470,7 +470,7 @@ int main(int argc, char **argv, char **env)
                if (!inputfile) {
                        fprintf(stderr,
                                "-f option MUST be specified with -m option\n");
-                       return (1);
+                       return 1;
                }
                return (vtysh_mark_file(inputfile));
        }
index 6aa52bcb61d8f4d8e86804975c790401a2bc3076..b891fb121fe4699f4ae53697da7347150518c53f 100644 (file)
@@ -717,10 +717,10 @@ int zebra_import_table(afi_t afi, vrf_id_t vrf_id, uint32_t table_id,
 
        if (!is_zebra_valid_kernel_table(table_id)
            || (table_id == RT_TABLE_MAIN))
-               return (-1);
+               return -1;
 
        if (afi >= AFI_MAX)
-               return (-1);
+               return -1;
 
        table = zebra_vrf_get_table_with_table_id(afi, SAFI_UNICAST, vrf_id,
                                                  table_id);
index fcd476dc2c35a26e75be8b32842ee5f253515e75..5e18414985916d3d8a6e8549fe916289e8f1ef17 100644 (file)
@@ -302,7 +302,7 @@ static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
                }
        }
 
-       return (0);
+       return 0;
 }
 
 enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx)
index d7bbe779bdb15462b198f0f51a0a8b02b086794a..681b4d1ab8af69c2b7b01b39772b8dd492b83174 100644 (file)
@@ -190,7 +190,7 @@ static int zebra_ptm_flush_messages(struct thread *thread)
                ptm_cb.t_timer = NULL;
                thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
                                 ptm_cb.reconnect_time, &ptm_cb.t_timer);
-               return (-1);
+               return -1;
        case BUFFER_PENDING:
                ptm_cb.t_write = NULL;
                thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL,
@@ -200,7 +200,7 @@ static int zebra_ptm_flush_messages(struct thread *thread)
                break;
        }
 
-       return (0);
+       return 0;
 }
 
 static int zebra_ptm_send_message(char *data, int size)
@@ -661,7 +661,7 @@ int zebra_ptm_sock_read(struct thread *thread)
                thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
                                 ptm_cb.reconnect_time,
                                 &ptm_cb.t_timer);
-               return (-1);
+               return -1;
        }
 
        ptm_cb.t_read = NULL;
index 641fc8799cd66a0af59c5c9e74fc5de19b4d9d0b..2963d83828e72a7e92ac4bacaa4df4b4ad91d440 100644 (file)
@@ -1779,7 +1779,7 @@ static int zebra_route_map_update_timer(struct thread *thread)
         * 1) VRF Aware <sigh>
         * 2) Route-map aware
         */
-       return (0);
+       return 0;
 }
 
 static void zebra_route_map_set_delay_timer(uint32_t value)