From 3b56a646b20fedb893863ff969dd8e47dc5d21c8 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 11 Jan 2023 15:53:31 +0200 Subject: [PATCH 1/2] bgpd: Warn an operator, that the peer MUST be created before configuring rest For now, if the order was mixed, most of the commands are just silently ignored. Let the operator notice that. Signed-off-by: Donatas Abraitis --- bgpd/bgp_vty.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8ea9c1996b..78816b0e04 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -819,6 +819,9 @@ struct peer *peer_and_group_lookup_vty(struct vty *vty, const char *peer_str) if (peer) { if (peer_dynamic_neighbor(peer)) { + zlog_warn( + "%pBP: Operation not allowed on a dynamic neighbor", + peer); vty_out(vty, "%% Operation not allowed on a dynamic neighbor\n"); return NULL; @@ -830,6 +833,8 @@ struct peer *peer_and_group_lookup_vty(struct vty *vty, const char *peer_str) if (group) return group->conf; + zlog_warn("Specify remote-as or peer-group commands first before: %s", + vty->buf); vty_out(vty, "%% Specify remote-as or peer-group commands first\n"); return NULL; From 0edec0dd29d7e8e1fd0176161b84ed32032af922 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 11 Jan 2023 15:58:10 +0200 Subject: [PATCH 2/2] bgpd: Don't warning twice for neighbor_bfd_check_controlplane_failure When the peer is not defined first. Signed-off-by: Donatas Abraitis --- bgpd/bgp_bfd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index d66b916b95..11b074af2e 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -521,10 +521,8 @@ DEFUN (neighbor_bfd_check_controlplane_failure, else idx_peer = 1; peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) { - vty_out(vty, "%% Specify remote-as or peer-group commands first\n"); + if (!peer) return CMD_WARNING_CONFIG_FAILED; - } if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) bgp_group_configure_bfd(peer);