zeroconf: Don't set host when binding to all interfaces
This commit is contained in:
parent
f3b09e4ef2
commit
5c33115eeb
@ -1,7 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
import socket
|
import socket
|
||||||
import string
|
import string
|
||||||
|
|
||||||
@ -17,13 +16,6 @@ _AVAHI_PROTO_UNSPEC = -1
|
|||||||
_AVAHI_PUBLISHFLAGS_NONE = 0
|
_AVAHI_PUBLISHFLAGS_NONE = 0
|
||||||
|
|
||||||
|
|
||||||
def _filter_loopback_and_meta_addresses(host):
|
|
||||||
# TODO: see if we can find a cleaner way of handling this.
|
|
||||||
if re.search(r'(?<![.\d])(127|0)[.]', host):
|
|
||||||
return ''
|
|
||||||
return host
|
|
||||||
|
|
||||||
|
|
||||||
def _convert_text_to_dbus_bytes(text):
|
def _convert_text_to_dbus_bytes(text):
|
||||||
return [dbus.Byte(ord(c)) for c in text]
|
return [dbus.Byte(ord(c)) for c in text]
|
||||||
|
|
||||||
@ -38,7 +30,10 @@ class Zeroconf(object):
|
|||||||
self.domain = domain or ''
|
self.domain = domain or ''
|
||||||
self.port = port
|
self.port = port
|
||||||
self.text = text or []
|
self.text = text or []
|
||||||
self.host = _filter_loopback_and_meta_addresses(host or '')
|
if host in ('::', '0.0.0.0'):
|
||||||
|
self.host = ''
|
||||||
|
else:
|
||||||
|
self.host = host
|
||||||
|
|
||||||
template = string.Template(name)
|
template = string.Template(name)
|
||||||
self.name = template.safe_substitute(
|
self.name = template.safe_substitute(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user