Merge "Do not send DNS queries against hostnames"
This commit is contained in:
commit
31ca41e05b
@ -309,4 +309,9 @@ class NotifyEndpoint(base.BaseEndpoint):
|
||||
:return: response
|
||||
"""
|
||||
send = dns_query.tcp if CONF['service:mdns'].all_tcp else dns_query.udp
|
||||
return send(dns_message, host, port=port, timeout=timeout)
|
||||
return send(
|
||||
dns_message,
|
||||
socket.gethostbyname(host),
|
||||
port=port,
|
||||
timeout=timeout
|
||||
)
|
||||
|
@ -266,9 +266,9 @@ class MdnsNotifyTest(base.BaseTestCase):
|
||||
@mock.patch.object(notify.dns_query, 'tcp')
|
||||
@mock.patch.object(notify.dns_query, 'udp')
|
||||
def test_send_dns_message(self, *mocks):
|
||||
out = self.notify._send_dns_message('msg', 'host', 123, 1)
|
||||
out = self.notify._send_dns_message('msg', '192.0.2.1', 1234, 1)
|
||||
|
||||
assert not notify.dns_query.tcp.called
|
||||
notify.dns_query.udp.assert_called_with('msg', 'host', port=123,
|
||||
notify.dns_query.udp.assert_called_with('msg', '192.0.2.1', port=1234,
|
||||
timeout=1)
|
||||
assert isinstance(out, Mock)
|
||||
|
Loading…
Reference in New Issue
Block a user