summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-03 15:13:12 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-05-03 15:13:12 +0200
commitae9b0e11f6d19460ed633265cf275a1d3b747e88 (patch)
tree130e3cc633c5f9e21df7c0343f9a2b1a46cdd925 /bgpd/bgp_vty.c
parentzebra: Fix leaked memory in label manager code (diff)
downloadfrr-ae9b0e11f6d19460ed633265cf275a1d3b747e88.tar.xz
frr-ae9b0e11f6d19460ed633265cf275a1d3b747e88.zip
bgpd: Fix crashes with '[no] neighbor ... shutdown ..' command
This fixes two crashes: 1) When we enter a 'neighbor shutdown..' command for a peer group or interface based peer we were not properly looking up the peer. 2) When we we enter 'no neighbor shutdown..' command for a peer group or interface based peer we were not properly lookup up the peer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_vty.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 6197b6107..db7e62639 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -3372,6 +3372,9 @@ peer_flag_modify_vty (struct vty *vty, const char *ip_str,
return CMD_WARNING;
}
+ if (!set && flag == PEER_FLAG_SHUTDOWN)
+ peer_tx_shutdown_message_unset (peer);
+
if (set)
ret = peer_flag_set (peer, flag);
else
@@ -3430,9 +3433,11 @@ DEFUN (neighbor_shutdown_msg,
if (argc >= 5)
{
- struct peer *peer = peer_lookup_vty (vty, argv[idx_peer]->arg);
+ struct peer *peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg);
char *message;
+ if (!peer)
+ return CMD_WARNING;
message = argv_concat (argv, argc, 4);
peer_tx_shutdown_message_set (peer, message);
XFREE (MTYPE_TMP, message);
@@ -3460,9 +3465,6 @@ DEFUN (no_neighbor_shutdown_msg,
{
int idx_peer = 2;
- struct peer *peer = peer_lookup_vty (vty, argv[idx_peer]->arg);
- peer_tx_shutdown_message_unset (peer);
-
return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_SHUTDOWN);
}