HAP-python icon indicating copy to clipboard operation
HAP-python copied to clipboard

use of `socket.inet_aton` prevents ipv6 initialization

Open craigcabrey opened this issue 3 years ago • 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: https://github.com/ikalchev/HAP-python/blob/4b1890c2b0defcde02e8594bd2ba3f5305151ae2/pyhap/accessory_driver.py#L142

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

craigcabrey avatar Jun 23 '22 06:06 craigcabrey