frawau / aiozeroconf

An asyncio/pure python implementation of multicast DNS service discovery
GNU Lesser General Public License v2.1
24 stars 6 forks source link

multi interface support #4

Closed RouquinBlanc closed 6 years ago

RouquinBlanc commented 6 years ago

As discussed in previous pull request, the way interfaces were handled was prone to getting answers on only one interface.

This PR propose the following:

I will have to make more tests with multiple interfaces scenarios, please wait a bit before integrating and/or test on your side!

Thx!

RouquinBlanc commented 6 years ago

OK I made some extra checks on Mac OS Mojave, High Sierra, and Ubuntu 14.04 and 18.04.

Please let me know of any issues on your side and/or comments on the changes performed!

-Jonathan

frawau commented 6 years ago

Thank again for the PR. Merci beaucoup.

It looks like it's working alright.

I have 3 smallish issues (That for all intent and purpose we probably can ignore)

First, my docker0 interface services only show up when I select to have both IPv4 and IPv6. Weird My virbr0 interface only shows up when I specify it. Lastly, it I do python3 -m aiozeroconf -p ipv6 -i virbr0 -d I get ERROR:aiozeroconf.aiozeroconf:initializing comm af 10 on interfaces ['virbr0']: No interface for IPv4

I think it should be IPv6 in the error message (exp. since socket.AF_INET6 == 10) and I think this error occurs outside aiozeroconf.

Thanks again. I will merge shortly. I will do a few more tests this WE before I release a new version.

RouquinBlanc commented 6 years ago

Indeed there is a typo in the setup_inet6 function, bien vu!

As for the 3 inconsistencies you mention, this is quite weird but at the same time, many errors are silently ignored... If I was to rework even more this part of the code, I would start by reworking error handling and logging.

BTW, for the sake of discussion, did you ever consider merging your code and the one in the original Zeroconf project (or at least having a dependency on it)? There are so many commons parts, it would be worth reusing some of the code especially in the DNS handling. At the same time, the original project would benefit from your handling of IPv6 (and async processing)!