diff --git a/os_ken/lib/rpc.py b/os_ken/lib/rpc.py index 5381ef99..5ff2d531 100644 --- a/os_ken/lib/rpc.py +++ b/os_ken/lib/rpc.py @@ -39,7 +39,12 @@ class MessageEncoder(object): def __init__(self): super(MessageEncoder, self).__init__() - self._packer = msgpack.Packer(use_bin_type=True) + # NOTE(ralonsoh): msgpack>=1.0.0 + self._packer = msgpack.Packer() + # The strict_map_key=False option is required to use int keys in + # maps; it is disabled by default to prevent hash collision denial + # of service attacks (hashdos) in scenarios where an attacker can + # control the keys to be hashed. self._unpacker = msgpack.Unpacker(strict_map_key=False) self._next_msgid = 0 diff --git a/os_ken/services/protocols/bgp/net_ctrl.py b/os_ken/services/protocols/bgp/net_ctrl.py index eb516c18..418486ca 100644 --- a/os_ken/services/protocols/bgp/net_ctrl.py +++ b/os_ken/services/protocols/bgp/net_ctrl.py @@ -101,8 +101,13 @@ class RpcSession(Activity): def __init__(self, sock, outgoing_msg_sink_iter): self.peer_name = str(sock.getpeername()) super(RpcSession, self).__init__(self.NAME_FMT % self.peer_name) - self._packer = msgpack.Packer(encoding='utf-8', use_bin_type=True) - self._unpacker = msgpack.Unpacker(encoding='utf-8') + # NOTE(ralonsoh): msgpack>=1.0.0 + self._packer = msgpack.Packer() + # The strict_map_key=False option is required to use int keys in + # maps; it is disabled by default to prevent hash collision denial + # of service attacks (hashdos) in scenarios where an attacker can + # control the keys to be hashed. + self._unpacker = msgpack.Unpacker(strict_map_key=False) self._next_msgid = 0 self._socket = sock self._outgoing_msg_sink_iter = outgoing_msg_sink_iter