P2P: Do not accept unauthenticated Advertise msgs

This commit is contained in:
Vincent Bernardoff 2016-11-30 14:49:08 +01:00 committed by Grégoire Henry
parent 5f8b74e96c
commit e1d6df6e99

View File

@ -470,12 +470,9 @@ module Make (P: PARAMS) = struct
buf local_nonce version gid buf local_nonce version gid
public_key message_nonce listening_port public_key message_nonce listening_port
end end
| Ok (Advertise peers) -> | Ok (Advertise _) ->
(* alternatively, one can refuse a connection but reply with debug "(%a) connection rejected (unauthenticated Advertise) from %a:%d"
some peers, so we accept this info *)
debug "(%a) new peers received from %a:%d"
pp_gid my_gid Ipaddr.pp_hum addr port ; pp_gid my_gid Ipaddr.pp_hum addr port ;
let (_:bool) = Lwt_pipe.push_now control_events (Peers peers) in
cancel () cancel ()
| Ok Disconnect -> | Ok Disconnect ->
debug "(%a) connection rejected (closed by peer or timeout) from %a:%d" debug "(%a) connection rejected (closed by peer or timeout) from %a:%d"