Updates to Github #github


HBlink@DVSwitch.groups.io Integration <HBlink@...>
 

[hblink3:master] New Comment on Issue #11 IPv6 Support
By randybuildsthings:

For later reference:

config.py assumes that IP addresses are IPv4 and uses socket.gethostbyname() in order to resolve hostnames to IP addresses (but which only resolves to IPv4 addresses). IPv6 addresses put into the config file end up causing an error message:

Traceback (most recent call last): File "bridge.py", line 747, in <module> CONFIG = config.build_config(cli_args.CONFIG_FILE) File "/opt/hblink3/config.py", line 274, in build_config 'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')), socket.gaierror: [Errno -9] Address family for hostname not supported

The likeliest approach is to use socket.getaddrinfo() which will resolve to a list of IP addresses (and ports, which are also required as part of the method) that meet the criteria given in the method call. Trouble is that using getaddrinfo() is not even close to a drop-in replacement for gethostbyname(), so there is some work to do here.

It's also worth noting that this is a lot of duplicated code. I'd like to start factoring this out into private methods or at least function calls that provide one place to make fixes, so that we're not doing find/replace all day long when discovering problems like this.


[hblink3:master] New Comment on Issue #11 IPv6 Support
By randybuildsthings:

For later reference:

config.py assumes that IP addresses are IPv4 and uses socket.gethostbyname() in order to resolve hostnames to IP addresses (but which only resolves to IPv4 addresses). IPv6 addresses put into the config file end up causing an error message:

Traceback (most recent call last):
  File "bridge.py", line 747, in <module>
    CONFIG = config.build_config(cli_args.CONFIG_FILE)
  File "/opt/hblink3/config.py", line 274, in build_config
    'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')),
socket.gaierror: [Errno -9] Address family for hostname not supported

The likeliest approach is to use socket.getaddrinfo() which will resolve to a list of IP addresses (and ports, which are also required as part of the method) that meet the criteria given in the method call. Trouble is that using getaddrinfo() is not even close to a drop-in replacement for gethostbyname(), so there is some work to do here.

It's also worth noting that this is a lot of duplicated code. I'd like to start factoring this out into private methods or at least function calls that provide one place to make fixes, so that we're not doing find/replace all day long when discovering problems like this.

Join HBlink@DVSwitch.groups.io to automatically receive all group messages.