From 65758d08ac7081194cb04d03f91fe524e3ad1177 Mon Sep 17 00:00:00 2001 From: OCamlPro-Iguernlala Date: Tue, 29 May 2018 16:23:10 +0200 Subject: [PATCH] P2p: add a warning in case of an incoming connection from an untrusted peer --- src/lib_p2p/p2p_pool.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib_p2p/p2p_pool.ml b/src/lib_p2p/p2p_pool.ml index 91929720a..a16a5bd7b 100644 --- a/src/lib_p2p/p2p_pool.ml +++ b/src/lib_p2p/p2p_pool.ml @@ -778,8 +778,14 @@ and authenticate pool ?point_info canceler fd point = match P2p_point_state.get connection_point_info with | Requested _ -> not incoming | Disconnected -> - not pool.config.private_mode - || P2p_point_state.Info.trusted connection_point_info + let unexpected = + pool.config.private_mode + && not (P2p_point_state.Info.trusted connection_point_info) + in + if unexpected then + warn "[private node] incoming connection from untrused \ + peer rejected!"; + not unexpected | Accepted _ | Running _ -> false end in