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);
}
}
/* 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);
}
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;
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);
* 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);
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);
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,
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)) {
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)) {
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(
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(
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);
}
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);
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++;
frr_run(bm->master);
/* Not reached. */
- return (0);
+ return 0;
}
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);
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);
* 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");
&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);
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
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;
}
/* 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);
&& 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) {
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
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;
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;
* 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;
}
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);
/* 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;
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)
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;
}
/* 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) {
&& 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;
&& 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;
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);
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);
#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)) {
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);
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)) {
}
}
}
- 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,
/* 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];
/* 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
}
}
- 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,
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;
}
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);
} 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);
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);
} 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));
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)
THREAD_TIMER_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp);
- return (0);
+ return 0;
}
/*
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);
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;
}
"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;
"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;
"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;
"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;
{
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);
}
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)) {
"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);
}
}
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;
}
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;
}
"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;
}
"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;
}
"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;
}
"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;
}
{
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);
{
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);
"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;
}
"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;
}
"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;
"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;
"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;
"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;
"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;
"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;
{
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);
"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;
"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;
}
"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;
}
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);
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);
"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;
}
"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;
}
"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;
}
"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;
}
"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);
}
"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);
}
{
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);
}
{
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);
}
"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;
"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;
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);
{
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
} 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
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
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);
}
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);
} 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);
}
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);
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. */
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. */
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 ");
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. */
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");
}
/* 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 ");
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");
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 {
}
}
- 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 ");
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);
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)
{
/* 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);
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);
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) {
};
#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)))
&& 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 {
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);
__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);
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
csv = malloc(sizeof(csv_t));
if (csv == NULL) {
log_error("CSV Malloc failed\n");
- return (NULL);
+ return NULL;
}
}
memset(csv, 0, sizeof(csv_t));
{
*fld = TAILQ_NEXT(*fld, next_field);
if ((*fld) == NULL) {
- return (NULL);
+ return NULL;
}
return ((*fld)->field);
}
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;
str = (char *)malloc(csv->buflen);
if (!str) {
log_error("field str malloc failed\n");
- return (NULL);
+ return NULL;
}
}
if (!buf)
free(str);
va_end(list);
- return (NULL);
+ return NULL;
}
csv_init_record(rec);
rec->record = str;
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),
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);
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;
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;
/* 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)
if (buf->wpos + len > buf->size)
if (ibuf_realloc(buf, len) == -1)
- return (NULL);
+ return NULL;
b = buf->buf + buf->wpos;
buf->wpos += len;
{
/* only allowed to seek in already written parts */
if (pos + len > buf->wpos)
- return (NULL);
+ return NULL;
return (buf->buf + pos);
}
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)
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;
}
static void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
int ret, fds[256];
if (n > (unsigned int)array_size(fds))
- return (1);
+ return 1;
ret = 0;
for (i = 0; i < n; i++) {
msg.msg_controllen = sizeof(cmsgbuf.buf);
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
- return (-1);
+ return -1;
again:
#ifdef __OpenBSD__
#endif
errno = EAGAIN;
free(ifd);
- return (-1);
+ return -1;
}
n = recvmsg(ibuf->fd, &msg, 0);
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);
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,
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 */
datalen += IMSG_HEADER_SIZE;
if (datalen > MAX_IMSGSIZE) {
errno = ERANGE;
- return (NULL);
+ return NULL;
}
hdr.type = type;
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);
}
if (datalen)
if (ibuf_add(msg, data, datalen) == -1) {
ibuf_free(msg);
- return (-1);
+ return -1;
}
return (datalen);
}
struct imsg_fd *ifd;
if ((ifd = TAILQ_POP_FIRST(&ibuf->fds, entry)) == NULL)
- return (-1);
+ return -1;
fd = ifd->fd;
free(ifd);
{
while (ibuf->w.queued)
if (msgbuf_write(&ibuf->w) <= 0)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
void imsg_clear(struct imsgbuf *ibuf)
rbe_insert_color(t, rbt, rbe);
- return (NULL);
+ return NULL;
}
/* Finds the node with the same key as elm */
return (node);
}
- return (NULL);
+ return NULL;
}
/* Finds the first node greater than or equal to the search key */
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;
}
/*
{
if (_ensurespace(types))
- return (-1);
+ return -1;
types->table[types->nextarg++] = type;
- return (0);
+ return 0;
}
static inline int
{
if (_ensurespace(types))
- return (-1);
+ return -1;
if (flags & LONGDBL)
types->table[types->nextarg++] = T_INT64T;
else if (flags & INTMAXT)
types->table[types->nextarg++] = T_LONG;
else
types->table[types->nextarg++] = T_INT;
- return (0);
+ return 0;
}
static inline int
{
if (_ensurespace(types))
- return (-1);
+ return -1;
if (flags & LONGDBL)
types->table[types->nextarg++] = T_UINT64T;
else if (flags & INTMAXT)
types->table[types->nextarg++] = T_U_LONG;
else
types->table[types->nextarg++] = T_U_INT;
- return (0);
+ return 0;
}
/*
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
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 */
/* 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;
types->table = newtable;
types->tablesize = newsize;
- return (0);
+ return 0;
}
/*
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,
}
}
if ((convbuf = malloc(nbytes + 1)) == NULL)
- return (NULL);
+ return NULL;
/* Fill the output buffer. */
p = wcsarg;
if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
nbytes, &mbs)) == (size_t)-1) {
free(convbuf);
- return (NULL);
+ return NULL;
}
convbuf[nbytes] = '\0';
return (convbuf);
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++) {
}
client_name[j] = '\0';
- return (0);
+ return 0;
}
int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
if (!csv) {
DLOG("Cannot allocate csv for hdr\n");
- return (-1);
+ return -1;
}
rc = _ptm_lib_decode_header(csv, &msglen, &ver, &type, &cmd_id,
/* 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);
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)
return tmp;
}
- return (NULL);
+ return NULL;
}
struct rb_entry *typed_rb_find_gteq(struct rbt_tree *rbt,
ospf6_area_stub_update(area);
}
- return (1);
+ return 1;
}
static void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area)
+ 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)
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);
prefix = (struct ospf6_prefix *)current;
if (prefix->prefix_length == 0
|| current + OSPF6_PREFIX_SIZE(prefix) > end) {
- return (NULL);
+ return NULL;
}
if (cnt < pos) {
}
} while (current <= end);
}
- return (NULL);
+ return NULL;
}
static int ospf6_link_lsa_show(struct vty *vty, 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);
return nh->ifindex;
}
- return (-1);
+ return -1;
}
int ospf6_nexthop_cmp(struct ospf6_nexthop *a, struct ospf6_nexthop *b)
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
--- /dev/null
+@@
+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)
+)
--- /dev/null
+// 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;
--- /dev/null
+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
#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
#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
#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
#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
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
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
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()
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()
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()
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()
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()
# 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
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
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();
if (confp != stdin)
fclose(confp);
- return (0);
+ return 0;
}
/* Configration make from file. */
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);
if (!inputfile) {
fprintf(stderr,
"-f option MUST be specified with -m option\n");
- return (1);
+ return 1;
}
return (vtysh_mark_file(inputfile));
}
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);
}
}
- return (0);
+ return 0;
}
enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx)
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,
break;
}
- return (0);
+ return 0;
}
static int zebra_ptm_send_message(char *data, int size)
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;
* 1) VRF Aware <sigh>
* 2) Route-map aware
*/
- return (0);
+ return 0;
}
static void zebra_route_map_set_delay_timer(uint32_t value)