Skip to content

Commit

Permalink
bgp: apply frrbot patch
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Younsi <[email protected]>
  • Loading branch information
mxyns committed May 7, 2024
1 parent deac186 commit 51ed840
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 253 deletions.
450 changes: 224 additions & 226 deletions bgpd/bgp_bmp.c

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions bgpd/bgp_bmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ struct bmp_bpi_lock {
.dest = (target_dest), \
.bgp = (target_bgp), \
}; \
\
\
struct bmp_bpi_lock *(head) = NULL, *(prev) = NULL, *(lookup) = NULL; \
\
\
(head) = bmp_lbpi_h_find(&bmp_lbpi, &_dummy_lbpi); \
\
\
for ((lookup) = (head); (lookup); \
(lookup) = ((prev) = (lookup))->next) { \
if ((condition)) \
Expand Down
5 changes: 3 additions & 2 deletions bgpd/bgp_conditional_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) {
advmap_attr = *pi->attr;

bool selected = bgp_check_selected(
pi, peer, addpath_capable, afi, safi);
bool selected = bgp_check_selected(pi, peer,
addpath_capable, afi,
safi);

if (selected) {
bgp_adj_out_updated(
Expand Down
5 changes: 3 additions & 2 deletions bgpd/bgp_mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,9 @@ void bgp_mpath_diff_insert(struct bgp_mpath_diff_head *diff,
return;
}

struct bgp_path_info_mpath_diff *item = XCALLOC(
MTYPE_BGP_MPATH_DIFF, sizeof(struct bgp_path_info_mpath_diff));
struct bgp_path_info_mpath_diff *item =
XCALLOC(MTYPE_BGP_MPATH_DIFF,
sizeof(struct bgp_path_info_mpath_diff));
item->path = bpi;
item->update = update;

Expand Down
28 changes: 14 additions & 14 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ DEFINE_HOOK(bgp_process,
(bgp, afi, safi, bn, addpath_id, peer, post));

DEFINE_HOOK(bgp_process_main_one,
(struct bgp *bgp, afi_t afi, safi_t safi, struct bgp_dest *dest),
(struct bgp * bgp, afi_t afi, safi_t safi, struct bgp_dest *dest),
(bgp, afi, safi, dest));

/** Test if path is suppressed. */
Expand Down Expand Up @@ -2159,8 +2159,8 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
: pi->attr;

/* special conditions for bmp rib-out pre-policy check */
bool ignore_policy =
CHECK_FLAG(special_cond, BGP_ANNCHK_SPECIAL_IGNORE_OUT_POLICY);
bool ignore_policy = CHECK_FLAG(special_cond,
BGP_ANNCHK_SPECIAL_IGNORE_OUT_POLICY);
bool ignore_path_status =
CHECK_FLAG(special_cond, BGP_ANNCHK_SPECIAL_IGNORE_PATH_STATUS);

Expand Down Expand Up @@ -2838,8 +2838,7 @@ static void bgp_route_select_timer_expire(struct event *thread)
void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
struct bgp_maxpaths_cfg *mpath_cfg,
struct bgp_path_info_pair *result, afi_t afi,
safi_t safi,
struct bgp_mpath_diff_head *mpath_diff_list)
safi_t safi, struct bgp_mpath_diff_head *mpath_diff_list)
{
struct bgp_path_info *new_select, *look_thru;
struct bgp_path_info *old_select, *worse, *first;
Expand Down Expand Up @@ -3018,7 +3017,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,

if (old_select != first &&
CHECK_FLAG(first->flags, BGP_PATH_REMOVED)) {
bgp_mpath_diff_insert(mpath_diff_list, first, false);
bgp_mpath_diff_insert(mpath_diff_list, first,
false);
dest = bgp_path_info_reap_unsorted(dest, first);
assert(dest);
} else {
Expand Down Expand Up @@ -3725,11 +3725,10 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
frr_each (bgp_mpath_diff, &mpath_diff, diff) {
if (diff->path) {
if (debug)
zlog_debug(
"[%s] bpi: %p, dest=%pBD peer=%pBP, rx_id=%" PRIu32,
diff->update ? "+" : "-", diff->path,
diff->path->net, diff->path->peer,
diff->path->addpath_rx_id);
zlog_debug("[%s] bpi: %p, dest=%pBD peer=%pBP, rx_id=%" PRIu32,
diff->update ? "+" : "-", diff->path,
diff->path->net, diff->path->peer,
diff->path->addpath_rx_id);

hook_call(bgp_route_update, bgp, afi, safi, dest,
diff->path, diff->update ? diff->path : NULL);
Expand Down Expand Up @@ -3922,7 +3921,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
continue;

if (mpath->peer)
mpath->peer->stat_loc_rib_count[afi][safi] += diff->update ? 1 : -1;
mpath->peer->stat_loc_rib_count[afi][safi] +=
diff->update ? 1 : -1;

hook_call(bgp_process_main_one_end, bgp, mpath);
}
Expand Down Expand Up @@ -5539,8 +5539,8 @@ void bgp_withdraw(struct peer *peer, const struct prefix *p,
* and
* if there was no entry, we don't need to do anything more.
*/
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)
&& peer != bgp->peer_self) {
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG) &&
peer != bgp->peer_self) {
if (!bgp_adj_in_unset(&dest, afi, safi, peer, addpath_id)) {
assert(dest);
peer->stat_pfx_dup_withdraw++;
Expand Down
6 changes: 3 additions & 3 deletions bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ struct bgp_path_info {
#define BGP_PATH_MPLSVPN_LABEL_NH (1 << 17)
#define BGP_PATH_MPLSVPN_NH_LABEL_BIND (1 << 18)
#define BGP_PATH_UNSORTED (1 << 19)
#define BGP_PATH_BMP_LOCKED (1 << 20)
#define BGP_PATH_BMP_ADJIN_CHG (1 << 21)
#define BGP_PATH_BMP_LOCKED (1 << 20)
#define BGP_PATH_BMP_ADJIN_CHG (1 << 21)

/* BGP route type. This can be static, RIP, OSPF, BGP etc. */
uint8_t type;
Expand Down Expand Up @@ -878,7 +878,7 @@ extern void subgroup_process_announce_selected(struct update_subgroup *subgrp,
uint32_t addpath_tx_id);

/* used by bmp to ignore certain conditions in rib-out pre-policy check */
#define BGP_ANNCHK_SPECIAL_IGNORE_OUT_POLICY (1 << 0)
#define BGP_ANNCHK_SPECIAL_IGNORE_OUT_POLICY (1 << 0)
#define BGP_ANNCHK_SPECIAL_IGNORE_PATH_STATUS (1 << 1)
#define BGP_ANNCHK_SPECIAL_PREPOLICY \
(BGP_ANNCHK_SPECIAL_IGNORE_OUT_POLICY | \
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ DEFINE_QOBJ_TYPE(bgp_master);
DEFINE_QOBJ_TYPE(bgp);
DEFINE_QOBJ_TYPE(peer);
DEFINE_HOOK(bgp_inst_delete, (struct bgp *bgp), (bgp));
DEFINE_HOOK(bgp_instance_state, (struct bgp *bgp), (bgp));
DEFINE_HOOK(bgp_instance_state, (struct bgp * bgp), (bgp));

/* BGP process wide configuration. */
static struct bgp_master bgp_master;
Expand Down
6 changes: 4 additions & 2 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1669,8 +1669,10 @@ struct peer {
uint32_t stat_pfx_nh_invalid;
uint32_t stat_pfx_dup_withdraw;
uint32_t stat_upd_7606; /* RFC7606: treat-as-withdraw */
uint32_t stat_adj_in_count[AFI_MAX][SAFI_MAX]; /* RFC7854 : Number of routes in Adj-RIB-In */
uint32_t stat_loc_rib_count[AFI_MAX][SAFI_MAX]; /* RFC7854 : Number of routes in Loc-RIB */
uint32_t stat_adj_in_count[AFI_MAX]
[SAFI_MAX]; /* RFC7854 : Number of routes in Adj-RIB-In */
uint32_t stat_loc_rib_count[AFI_MAX]
[SAFI_MAX]; /* RFC7854 : Number of routes in Loc-RIB */
/* no need for stat_adj_out_count here, it is in struct update_subgroup */

/* BGP state count */
Expand Down
1 change: 1 addition & 0 deletions tests/topotests/lib/bmp_collector/bgp/update/nlri.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def detect_addpath_prefix_ipv46(data, max_bit_length):
# we don't know if it's add-path so let's say no
return False


class NlriIPv6Unicast:
@staticmethod
def parse(data):
Expand Down

0 comments on commit 51ed840

Please sign in to comment.