ikalchev/HAP-python

use of `socket.inet_aton` prevents ipv6 initialization

craigcabrey opened this issue · 0 comments

In the case of an IPv6 only environment, or a dual stack environment where the advertise address is being supplied, we will fail to initialize:

>>> addr = socket.inet_aton('::1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: illegal IP address string passed to inet_aton

this happens here:

addresses=[socket.inet_aton(self.state.address)],

It's a rather niche case, but would be good to replace this usage with socket.inet_pton: https://docs.python.org/3/library/socket.html#socket.inet_pton