From b760b426641ff5af6f9259e6e21acd101e8f6e3d Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Thu, 10 Mar 2016 16:56:10 +0100 Subject: [PATCH] Do not emit raw binary data after unconfirmed open When the OPEN message generated by the player is rejected, the original code emitted raw binary data in the resulting exception. Change that so it emits the hexlified version of the raw binary data. The fix was done by removing the duplicated code that generates the two error messages (one for the log file, the other for the exception), taking the correct code only. Change-Id: If1ac202ba0d3c8720c8c442da1d533143dcddb7c Signed-off-by: Jozef Behran --- tools/fastbgp/play.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/fastbgp/play.py b/tools/fastbgp/play.py index f63155fcf2..2342224a3c 100755 --- a/tools/fastbgp/play.py +++ b/tools/fastbgp/play.py @@ -1645,10 +1645,12 @@ def job(arguments): # Using exact keepalive length to not to see possible updates. msg_in = bgp_socket.recv(19) if msg_in != generator.keepalive_message(): - logger.error("Open not confirmed by keepalive, instead got " + - binascii.hexlify(msg_in)) - raise MessageError("Open not confirmed by keepalive, instead got", - msg_in) + error_msg = ( + "Open not confirmed by keepalive, instead got " + + binascii.hexlify(msg_in) + ) + logger.error(error_msg) + raise MessageError(error_msg) timer.reset_peer_hold_time() # Send the keepalive to indicate the connection is accepted. timer.snapshot() # Remember this time. -- 2.36.6