Skip to content

Commit

Permalink
Merge branch 'FRRouting:master' into snmp-topotest-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwinter-osr authored Jan 25, 2024
2 parents a29ee2d + 9b9abe1 commit f23924f
Show file tree
Hide file tree
Showing 44 changed files with 568 additions and 476 deletions.
22 changes: 11 additions & 11 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2720,7 +2720,7 @@ int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
return BGP_GR_SUCCESS;
}

int bgp_gr_update_all(struct bgp *bgp, int global_gr_cmd)
int bgp_gr_update_all(struct bgp *bgp, enum global_gr_command global_gr_cmd)
{
enum global_mode global_new_state = GLOBAL_INVALID;
enum global_mode global_old_state = GLOBAL_INVALID;
Expand Down Expand Up @@ -2874,7 +2874,8 @@ enum peer_mode bgp_peer_gr_mode_get(struct peer *peer)
return peer->peer_gr_present_state;
}

int bgp_neighbor_graceful_restart(struct peer *peer, int peer_gr_cmd)
int bgp_neighbor_graceful_restart(struct peer *peer,
enum peer_gr_command peer_gr_cmd)
{
enum peer_mode peer_new_state = PEER_INVALID;
enum peer_mode peer_old_state = PEER_INVALID;
Expand Down Expand Up @@ -2933,16 +2934,16 @@ int bgp_neighbor_graceful_restart(struct peer *peer, int peer_gr_cmd)
return result;
}

unsigned int bgp_peer_gr_action(struct peer *peer, int old_peer_state,
int new_peer_state)
unsigned int bgp_peer_gr_action(struct peer *peer, enum peer_mode old_peer_state,
enum peer_mode new_peer_state)
{
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
zlog_debug(
"%s [BGP_GR] Move peer from old_peer_state :%s: to new_peer_state :%s: !!!!",
__func__, print_peer_gr_mode(old_peer_state),
print_peer_gr_mode(new_peer_state));

int bgp_gr_global_mode = GLOBAL_INVALID;
enum global_mode bgp_gr_global_mode = GLOBAL_INVALID;
unsigned int ret = BGP_GR_FAILURE;

if (old_peer_state == new_peer_state) {
Expand Down Expand Up @@ -2974,10 +2975,10 @@ unsigned int bgp_peer_gr_action(struct peer *peer, int old_peer_state,

BGP_PEER_GR_GLOBAL_INHERIT_UNSET(peer);

if (new_peer_state == bgp_gr_global_mode) {
/*This is incremental updates i.e no tear down
*of the existing session
*as the peer is already working in the same mode.
if ((int)new_peer_state == (int)bgp_gr_global_mode) {
/* This is incremental updates i.e no tear down
* of the existing session
* as the peer is already working in the same mode.
*/
ret = BGP_GR_SUCCESS;
} else {
Expand All @@ -3004,8 +3005,7 @@ unsigned int bgp_peer_gr_action(struct peer *peer, int old_peer_state,

BGP_PEER_GR_GLOBAL_INHERIT_SET(peer);

if (old_peer_state == bgp_gr_global_mode) {

if ((int)old_peer_state == (int)bgp_gr_global_mode) {
/* This is incremental updates
*i.e no tear down of the existing session
*as the peer is already working in the same mode.
Expand Down
9 changes: 5 additions & 4 deletions bgpd/bgp_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,11 @@ extern void bgp_adjust_routeadv(struct peer *);
DECLARE_HOOK(peer_backward_transition, (struct peer *peer), (peer));
DECLARE_HOOK(peer_established, (struct peer *peer), (peer));

int bgp_gr_update_all(struct bgp *bgp, int global_gr_cmd);
int bgp_neighbor_graceful_restart(struct peer *peer, int peer_gr_cmd);
unsigned int bgp_peer_gr_action(struct peer *peer,
int old_peer_state, int new_peer_state);
int bgp_gr_update_all(struct bgp *bgp, enum global_gr_command global_gr_cmd);
int bgp_neighbor_graceful_restart(struct peer *peer,
enum peer_gr_command peer_gr_cmd);
unsigned int bgp_peer_gr_action(struct peer *peer, enum peer_mode old_peer_state,
enum peer_mode new_peer_state);
void bgp_peer_move_to_gr_mode(struct peer *peer, int new_state);
unsigned int bgp_peer_gr_helper_enable(struct peer *peer);
unsigned int bgp_peer_gr_enable(struct peer *peer);
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11634,7 +11634,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
total_count);
} else
vty_out(vty,
"\nDisplayed %ld routes and %ld total paths\n",
"\nDisplayed %ld routes and %ld total paths\n",
output_count, total_count);
}
}
Expand Down Expand Up @@ -11685,7 +11685,7 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
total_cum);
else
vty_out(vty,
"\nDisplayed %ld routes and %ld total paths\n",
"\nDisplayed %ld routes and %ld total paths\n",
output_cum, total_cum);
} else {
if (use_json && output_cum == 0 && json_header_depth == 0)
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ static int rpki_create_socket(void *_cache)
else {
ssh_config = cache->tr_config.ssh_config;
host = ssh_config->host;
snprintf(s_port, sizeof(s_port), "%hu", ssh_config->port);
snprintf(s_port, sizeof(s_port), "%u", ssh_config->port);
port = s_port;

hints.ai_flags |= AI_NUMERICHOST;
Expand Down
16 changes: 8 additions & 8 deletions bgpd/bgp_updgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,14 @@ static unsigned int updgrp_hash_key_make(const void *p)
peer, peer->sort, peer->sub_sort,
(intmax_t)CHECK_FLAG(peer->flags, PEER_UPDGRP_FLAGS),
(intmax_t)CHECK_FLAG(flags, PEER_UPDGRP_AF_FLAGS));
zlog_debug(
"%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u, as_path_loop_detection: %d",
peer, (uint32_t)peer->addpath_type[afi][safi],
CHECK_FLAG(peer->cap, PEER_UPDGRP_CAP_FLAGS),
CHECK_FLAG(peer->af_cap[afi][safi],
PEER_UPDGRP_AF_CAP_FLAGS),
peer->v_routeadv, peer->change_local_as,
peer->as_path_loop_detection);
zlog_debug("%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %ju UpdGrpCapAFFlag: %u route_adv: %u change local as: %u, as_path_loop_detection: %d",
peer, (uint32_t)peer->addpath_type[afi][safi],
(intmax_t)CHECK_FLAG(peer->cap,
PEER_UPDGRP_CAP_FLAGS),
CHECK_FLAG(peer->af_cap[afi][safi],
PEER_UPDGRP_AF_CAP_FLAGS),
peer->v_routeadv, peer->change_local_as,
peer->as_path_loop_detection);
zlog_debug(
"%pBP Update Group Hash: max packet size: %u pmax_out: %u Peer Group: %s rmap out: %s",
peer, peer->max_packet_size, peer->pmax_out[afi][safi],
Expand Down
61 changes: 31 additions & 30 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,8 @@ enum peer_gr_command {
NO_PEER_HELPER_CMD
};

typedef unsigned int (*bgp_peer_gr_action_ptr)(struct peer *, int, int);
typedef unsigned int (*bgp_peer_gr_action_ptr)(struct peer *, enum peer_mode,
enum peer_mode);

struct bgp_peer_gr {
enum peer_mode next_state;
Expand Down Expand Up @@ -1299,39 +1300,39 @@ struct peer {
uint8_t afc_recv[AFI_MAX][SAFI_MAX];

/* Capability flags (reset in bgp_stop) */
uint32_t cap;
#define PEER_CAP_REFRESH_ADV (1U << 0) /* refresh advertised */
#define PEER_CAP_REFRESH_RCV (1U << 2) /* refresh rfc received */
#define PEER_CAP_DYNAMIC_ADV (1U << 3) /* dynamic advertised */
#define PEER_CAP_DYNAMIC_RCV (1U << 4) /* dynamic received */
#define PEER_CAP_RESTART_ADV (1U << 5) /* restart advertised */
#define PEER_CAP_RESTART_RCV (1U << 6) /* restart received */
#define PEER_CAP_AS4_ADV (1U << 7) /* as4 advertised */
#define PEER_CAP_AS4_RCV (1U << 8) /* as4 received */
uint64_t cap;
#define PEER_CAP_REFRESH_ADV (1ULL << 0) /* refresh advertised */
#define PEER_CAP_REFRESH_RCV (1ULL << 2) /* refresh rfc received */
#define PEER_CAP_DYNAMIC_ADV (1ULL << 3) /* dynamic advertised */
#define PEER_CAP_DYNAMIC_RCV (1ULL << 4) /* dynamic received */
#define PEER_CAP_RESTART_ADV (1ULL << 5) /* restart advertised */
#define PEER_CAP_RESTART_RCV (1ULL << 6) /* restart received */
#define PEER_CAP_AS4_ADV (1ULL << 7) /* as4 advertised */
#define PEER_CAP_AS4_RCV (1ULL << 8) /* as4 received */
/* sent graceful-restart restart (R) bit */
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV (1U << 9)
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV (1ULL << 9)
/* received graceful-restart restart (R) bit */
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_RCV (1U << 10)
#define PEER_CAP_ADDPATH_ADV (1U << 11) /* addpath advertised */
#define PEER_CAP_ADDPATH_RCV (1U << 12) /* addpath received */
#define PEER_CAP_ENHE_ADV (1U << 13) /* Extended nexthop advertised */
#define PEER_CAP_ENHE_RCV (1U << 14) /* Extended nexthop received */
#define PEER_CAP_HOSTNAME_ADV (1U << 15) /* hostname advertised */
#define PEER_CAP_HOSTNAME_RCV (1U << 16) /* hostname received */
#define PEER_CAP_ENHANCED_RR_ADV (1U << 17) /* enhanced rr advertised */
#define PEER_CAP_ENHANCED_RR_RCV (1U << 18) /* enhanced rr received */
#define PEER_CAP_EXTENDED_MESSAGE_ADV (1U << 19)
#define PEER_CAP_EXTENDED_MESSAGE_RCV (1U << 20)
#define PEER_CAP_LLGR_ADV (1U << 21)
#define PEER_CAP_LLGR_RCV (1U << 22)
#define PEER_CAP_GRACEFUL_RESTART_R_BIT_RCV (1ULL << 10)
#define PEER_CAP_ADDPATH_ADV (1ULL << 11) /* addpath advertised */
#define PEER_CAP_ADDPATH_RCV (1ULL << 12) /* addpath received */
#define PEER_CAP_ENHE_ADV (1ULL << 13) /* Extended nexthop advertised */
#define PEER_CAP_ENHE_RCV (1ULL << 14) /* Extended nexthop received */
#define PEER_CAP_HOSTNAME_ADV (1ULL << 15) /* hostname advertised */
#define PEER_CAP_HOSTNAME_RCV (1ULL << 16) /* hostname received */
#define PEER_CAP_ENHANCED_RR_ADV (1ULL << 17) /* enhanced rr advertised */
#define PEER_CAP_ENHANCED_RR_RCV (1ULL << 18) /* enhanced rr received */
#define PEER_CAP_EXTENDED_MESSAGE_ADV (1ULL << 19)
#define PEER_CAP_EXTENDED_MESSAGE_RCV (1ULL << 20)
#define PEER_CAP_LLGR_ADV (1ULL << 21)
#define PEER_CAP_LLGR_RCV (1ULL << 22)
/* sent graceful-restart notification (N) bit */
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV (1U << 23)
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV (1ULL << 23)
/* received graceful-restart notification (N) bit */
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1U << 24)
#define PEER_CAP_ROLE_ADV (1U << 25) /* role advertised */
#define PEER_CAP_ROLE_RCV (1U << 26) /* role received */
#define PEER_CAP_SOFT_VERSION_ADV (1U << 27)
#define PEER_CAP_SOFT_VERSION_RCV (1U << 28)
#define PEER_CAP_GRACEFUL_RESTART_N_BIT_RCV (1ULL << 24)
#define PEER_CAP_ROLE_ADV (1ULL << 25) /* role advertised */
#define PEER_CAP_ROLE_RCV (1ULL << 26) /* role received */
#define PEER_CAP_SOFT_VERSION_ADV (1ULL << 27)
#define PEER_CAP_SOFT_VERSION_RCV (1ULL << 28)

/* Capability flags (reset in bgp_stop) */
uint32_t af_cap[AFI_MAX][SAFI_MAX];
Expand Down
Loading

0 comments on commit f23924f

Please sign in to comment.