Do not emit raw binary data after unconfirmed open
[integration/test.git] / tools / fastbgp / play.py
index f63155fcf25975d9a5da8c6527f7e64650bbd8bd..2342224a3ca76b0befbbeed771e5f6017c590583 100755 (executable)
@@ -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.