Skip to content

Commit

Permalink
Merge branch 'FRRouting:master' into nht-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
enkechen-panw authored Oct 14, 2024
2 parents 6305c05 + d1433ee commit 784909f
Show file tree
Hide file tree
Showing 150 changed files with 5,884 additions and 2,227 deletions.
52 changes: 32 additions & 20 deletions bfdd/bfdd_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,12 @@ void bfd_cli_show_minimum_ttl(struct vty *vty, const struct lyd_node *dnode,

DEFPY_YANG(
bfd_peer_mult, bfd_peer_mult_cmd,
"detect-multiplier (2-255)$multiplier",
"[no] detect-multiplier ![(1-255)$multiplier]",
NO_STR
"Configure peer detection multiplier\n"
"Configure peer detection multiplier value\n")
{
nb_cli_enqueue_change(vty, "./detection-multiplier", NB_OP_MODIFY,
nb_cli_enqueue_change(vty, "./detection-multiplier", no ? NB_OP_DESTROY : NB_OP_MODIFY,
multiplier_str);
return nb_cli_apply_changes(vty, NULL);
}
Expand All @@ -356,14 +357,15 @@ void bfd_cli_show_mult(struct vty *vty, const struct lyd_node *dnode,

DEFPY_YANG(
bfd_peer_rx, bfd_peer_rx_cmd,
"receive-interval (10-60000)$interval",
"[no] receive-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer receive interval\n"
"Configure peer receive interval value in milliseconds\n")
{
char value[32];

snprintf(value, sizeof(value), "%ld", interval * 1000);
nb_cli_enqueue_change(vty, "./required-receive-interval", NB_OP_MODIFY,
nb_cli_enqueue_change(vty, "./required-receive-interval", no ? NB_OP_DESTROY : NB_OP_MODIFY,
value);

return nb_cli_apply_changes(vty, NULL);
Expand All @@ -379,15 +381,16 @@ void bfd_cli_show_rx(struct vty *vty, const struct lyd_node *dnode,

DEFPY_YANG(
bfd_peer_tx, bfd_peer_tx_cmd,
"transmit-interval (10-60000)$interval",
"[no] transmit-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer transmit interval\n"
"Configure peer transmit interval value in milliseconds\n")
{
char value[32];

snprintf(value, sizeof(value), "%ld", interval * 1000);
nb_cli_enqueue_change(vty, "./desired-transmission-interval",
NB_OP_MODIFY, value);
no ? NB_OP_DESTROY : NB_OP_MODIFY, value);

return nb_cli_apply_changes(vty, NULL);
}
Expand Down Expand Up @@ -436,7 +439,8 @@ void bfd_cli_show_echo(struct vty *vty, const struct lyd_node *dnode,

DEFPY_YANG(
bfd_peer_echo_interval, bfd_peer_echo_interval_cmd,
"echo-interval (10-60000)$interval",
"[no] echo-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer echo intervals\n"
"Configure peer echo rx/tx intervals value in milliseconds\n")
{
Expand All @@ -449,16 +453,17 @@ DEFPY_YANG(

snprintf(value, sizeof(value), "%ld", interval * 1000);
nb_cli_enqueue_change(vty, "./desired-echo-transmission-interval",
NB_OP_MODIFY, value);
no ? NB_OP_DESTROY : NB_OP_MODIFY, value);
nb_cli_enqueue_change(vty, "./required-echo-receive-interval",
NB_OP_MODIFY, value);
no ? NB_OP_DESTROY : NB_OP_MODIFY, value);

return nb_cli_apply_changes(vty, NULL);
}

DEFPY_YANG(
bfd_peer_echo_transmit_interval, bfd_peer_echo_transmit_interval_cmd,
"echo transmit-interval (10-60000)$interval",
"[no] echo transmit-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer echo intervals\n"
"Configure desired transmit interval\n"
"Configure interval value in milliseconds\n")
Expand All @@ -472,7 +477,7 @@ DEFPY_YANG(

snprintf(value, sizeof(value), "%ld", interval * 1000);
nb_cli_enqueue_change(vty, "./desired-echo-transmission-interval",
NB_OP_MODIFY, value);
no ? NB_OP_DESTROY : NB_OP_MODIFY, value);

return nb_cli_apply_changes(vty, NULL);
}
Expand All @@ -487,7 +492,8 @@ void bfd_cli_show_desired_echo_transmission_interval(

DEFPY_YANG(
bfd_peer_echo_receive_interval, bfd_peer_echo_receive_interval_cmd,
"echo receive-interval <disabled$disabled|(10-60000)$interval>",
"[no] echo receive-interval ![<disabled$disabled|(10-4294967)$interval>]",
NO_STR
"Configure peer echo intervals\n"
"Configure required receive interval\n"
"Disable echo packets receive\n"
Expand All @@ -504,9 +510,9 @@ DEFPY_YANG(
snprintf(value, sizeof(value), "0");
else
snprintf(value, sizeof(value), "%ld", interval * 1000);

nb_cli_enqueue_change(vty, "./required-echo-receive-interval",
NB_OP_MODIFY, value);
no ? NB_OP_DESTROY : NB_OP_MODIFY, value);

return nb_cli_apply_changes(vty, NULL);
}
Expand Down Expand Up @@ -571,17 +577,20 @@ void bfd_cli_show_profile(struct vty *vty, const struct lyd_node *dnode,
}

ALIAS_YANG(bfd_peer_mult, bfd_profile_mult_cmd,
"detect-multiplier (2-255)$multiplier",
"[no] detect-multiplier ![(1-255)$multiplier]",
NO_STR
"Configure peer detection multiplier\n"
"Configure peer detection multiplier value\n")

ALIAS_YANG(bfd_peer_tx, bfd_profile_tx_cmd,
"transmit-interval (10-60000)$interval",
"[no] transmit-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer transmit interval\n"
"Configure peer transmit interval value in milliseconds\n")

ALIAS_YANG(bfd_peer_rx, bfd_profile_rx_cmd,
"receive-interval (10-60000)$interval",
"[no] receive-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer receive interval\n"
"Configure peer receive interval value in milliseconds\n")

Expand Down Expand Up @@ -612,20 +621,23 @@ ALIAS_YANG(bfd_peer_echo, bfd_profile_echo_cmd,
"Configure echo mode\n")

ALIAS_YANG(bfd_peer_echo_interval, bfd_profile_echo_interval_cmd,
"echo-interval (10-60000)$interval",
"[no] echo-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer echo interval\n"
"Configure peer echo interval value in milliseconds\n")

ALIAS_YANG(
bfd_peer_echo_transmit_interval, bfd_profile_echo_transmit_interval_cmd,
"echo transmit-interval (10-60000)$interval",
"[no] echo transmit-interval ![(10-4294967)$interval]",
NO_STR
"Configure peer echo intervals\n"
"Configure desired transmit interval\n"
"Configure interval value in milliseconds\n")

ALIAS_YANG(
bfd_peer_echo_receive_interval, bfd_profile_echo_receive_interval_cmd,
"echo receive-interval <disabled$disabled|(10-60000)$interval>",
"[no] echo receive-interval ![<disabled$disabled|(10-4294967)$interval>]",
NO_STR
"Configure peer echo intervals\n"
"Configure required receive interval\n"
"Disable echo packets receive\n"
Expand Down
6 changes: 2 additions & 4 deletions bgpd/bgp_addpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,7 @@ void bgp_addpath_type_changed(struct bgp *bgp)
}
}

int bgp_addpath_capability_action(enum bgp_addpath_strat addpath_type,
uint8_t paths)
int bgp_addpath_capability_action(enum bgp_addpath_strat addpath_type, uint16_t paths)
{
int action = CAPABILITY_ACTION_UNSET;

Expand Down Expand Up @@ -392,8 +391,7 @@ int bgp_addpath_capability_action(enum bgp_addpath_strat addpath_type,
* change take effect.
*/
void bgp_addpath_set_peer_type(struct peer *peer, afi_t afi, safi_t safi,
enum bgp_addpath_strat addpath_type,
uint8_t paths)
enum bgp_addpath_strat addpath_type, uint16_t paths)
{
struct bgp *bgp = peer->bgp;
enum bgp_addpath_strat old_type;
Expand Down
6 changes: 2 additions & 4 deletions bgpd/bgp_addpath.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,11 @@ bool bgp_addpath_tx_path(enum bgp_addpath_strat strat,
* Change the type of addpath used for a peer.
*/
void bgp_addpath_set_peer_type(struct peer *peer, afi_t afi, safi_t safi,
enum bgp_addpath_strat addpath_type,
uint8_t paths);
enum bgp_addpath_strat addpath_type, uint16_t paths);

void bgp_addpath_update_ids(struct bgp *bgp, struct bgp_dest *dest, afi_t afi,
safi_t safi);

void bgp_addpath_type_changed(struct bgp *bgp);
extern int bgp_addpath_capability_action(enum bgp_addpath_strat addpath_type,
uint8_t paths);
extern int bgp_addpath_capability_action(enum bgp_addpath_strat addpath_type, uint16_t paths);
#endif
24 changes: 13 additions & 11 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ static void bmp_monitor(struct bmp *bmp, struct peer *peer, uint8_t flags,

static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr)
{
uint8_t bpi_num_labels;
uint8_t bpi_num_labels, adjin_num_labels;
afi_t afi;
safi_t safi;

Expand Down Expand Up @@ -1241,11 +1241,12 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr)
bpi_num_labels ? bpi->extra->labels->label : NULL,
bpi_num_labels);

if (adjin)
/* TODO: set label here when adjin supports labels */
bmp_monitor(bmp, adjin->peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE,
bn_p, prd, adjin->attr, afi, safi, adjin->uptime,
NULL, 0);
if (adjin) {
adjin_num_labels = adjin->labels ? adjin->labels->num_labels : 0;
bmp_monitor(bmp, adjin->peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, bn_p, prd,
adjin->attr, afi, safi, adjin->uptime,
adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels);
}

if (bn)
bgp_dest_unlock_node(bn);
Expand Down Expand Up @@ -1382,7 +1383,7 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr)
struct peer *peer;
struct bgp_dest *bn = NULL;
bool written = false;
uint8_t bpi_num_labels;
uint8_t bpi_num_labels, adjin_num_labels;

bqe = bmp_pull(bmp);
if (!bqe)
Expand Down Expand Up @@ -1453,10 +1454,11 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr)
if (adjin->peer == peer)
break;
}
/* TODO: set label here when adjin supports labels */
bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE,
&bqe->p, prd, adjin ? adjin->attr : NULL, afi, safi,
adjin ? adjin->uptime : monotime(NULL), NULL, 0);
adjin_num_labels = adjin && adjin->labels ? adjin->labels->num_labels : 0;
bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, &bqe->p, prd,
adjin ? adjin->attr : NULL, afi, safi,
adjin ? adjin->uptime : monotime(NULL),
adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels);
written = true;
}

Expand Down
32 changes: 16 additions & 16 deletions bgpd/bgp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,16 @@ DEFINE_HOOK(bgp_hook_vrf_update, (struct vrf *vrf, bool enabled),
(vrf, enabled));

/* bgpd options, we use GNU getopt library. */
static const struct option longopts[] = {
{ "bgp_port", required_argument, NULL, 'p' },
{ "listenon", required_argument, NULL, 'l' },
{ "no_kernel", no_argument, NULL, 'n' },
{ "skip_runas", no_argument, NULL, 'S' },
{ "ecmp", required_argument, NULL, 'e' },
{ "int_num", required_argument, NULL, 'I' },
{ "no_zebra", no_argument, NULL, 'Z' },
{ "socket_size", required_argument, NULL, 's' },
{ "v6-with-v4-nexthops", no_argument, NULL, 'v' },
{ 0 }
};
static const struct option longopts[] = { { "bgp_port", required_argument, NULL, 'p' },
{ "listenon", required_argument, NULL, 'l' },
{ "no_kernel", no_argument, NULL, 'n' },
{ "skip_runas", no_argument, NULL, 'S' },
{ "ecmp", required_argument, NULL, 'e' },
{ "int_num", required_argument, NULL, 'I' },
{ "no_zebra", no_argument, NULL, 'Z' },
{ "socket_size", required_argument, NULL, 's' },
{ "v6-with-v4-nexthops", no_argument, NULL, 'x' },
{ 0 } };

/* signal definitions */
void sighup(void);
Expand Down Expand Up @@ -424,11 +422,12 @@ int main(int argc, char **argv)
int buffer_size = BGP_SOCKET_SNDBUF_SIZE;
char *address;
struct listnode *node;
bool v6_with_v4_nexthops = false;

addresses->cmp = (int (*)(void *, void *))strcmp;

frr_preinit(&bgpd_di, argc, argv);
frr_opt_add("p:l:SnZe:I:s:" DEPRECATED_OPTIONS, longopts,
frr_opt_add("p:l:SnZe:I:s:x" DEPRECATED_OPTIONS, longopts,
" -p, --bgp_port Set BGP listen port number (0 means do not listen).\n"
" -l, --listenon Listen on specified address (implies -n)\n"
" -n, --no_kernel Do not install route to kernel.\n"
Expand All @@ -437,7 +436,7 @@ int main(int argc, char **argv)
" -e, --ecmp Specify ECMP to use.\n"
" -I, --int_num Set instance number (label-manager)\n"
" -s, --socket_size Set BGP peer socket send buffer size\n"
" , --v6-with-v4-nexthop Allow BGP to form v6 neighbors using v4 nexthops\n");
" -x, --v6-with-v4-nexthop Allow BGP to form v6 neighbors using v4 nexthops\n");

/* Command line argument treatment. */
while (1) {
Expand Down Expand Up @@ -499,8 +498,8 @@ int main(int argc, char **argv)
case 's':
buffer_size = atoi(optarg);
break;
case 'v':
bm->v6_with_v4_nexthops = true;
case 'x':
v6_with_v4_nexthops = true;
break;
default:
frr_help_exit(1);
Expand All @@ -513,6 +512,7 @@ int main(int argc, char **argv)
bgp_master_init(frr_init(), buffer_size, addresses);
bm->startup_time = monotime(NULL);
bm->port = bgp_port;
bm->v6_with_v4_nexthops = v6_with_v4_nexthops;
if (bgp_port == 0)
bgp_option_set(BGP_OPT_NO_LISTEN);
if (no_fib_flag || no_zebra_flag)
Expand Down
Loading

0 comments on commit 784909f

Please sign in to comment.