Skip to content

Conversation

@bdraco
Copy link
Member

@bdraco bdraco commented May 28, 2021

  • Setting IP_MULTICAST_TTL and IP_MULTICAST_LOOP does not work under
    MacOS when the bind address is ""

- Setting IP_MULTICAST_TTL and IP_MULTICAST_LOOP does not work under
  MacOS when the bind address is ""
@codecov-commenter
Copy link

codecov-commenter commented May 28, 2021

Codecov Report

Merging #392 (de64624) into master (33a3a6a) will decrease coverage by 0.02%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #392      +/-   ##
==========================================
- Coverage   92.21%   92.19%   -0.03%     
==========================================
  Files           4        4              
  Lines        2941     2945       +4     
  Branches      375      376       +1     
==========================================
+ Hits         2712     2715       +3     
- Misses        154      156       +2     
+ Partials       75       74       -1     
Impacted Files Coverage Δ
zeroconf/__init__.py 89.26% <50.00%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33a3a6a...de64624. Read the comment docs.

@bdraco
Copy link
Member Author

bdraco commented May 28, 2021

Next PR will enable IPv6 in the CI

@bdraco bdraco merged commit d67d5f4 into python-zeroconf:master May 28, 2021
@bdraco bdraco deleted the macv6 branch May 28, 2021 15:27
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared lister/responder sockets, with IPv4 only sockets
now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 10, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 14, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

This change rejects InterfaceChoice.Default IPv6 only or IPv6/IPv4
dual-stack configurations.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Since we allow shared listener/responder sockets, with IPv4 only
sockets now, the macOS error address in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 14, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

Removing the InterfaceChoice.Default config when IPv6 is enabled would
be a major breaking change. Instead, inform the user with an error log
message and a DeprecationWarning that this is not a working
configuration.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Also don't use a shared listener/responder sockets for dual-stack mode.
Using a shared socket for IPv4 and IPv6 is especially problematic on
macOS, where the kernel does not support this and even rejects socket
options for IPv4 multicast in this case.

With a separate IPv4 socket, this actually fixes the IPv4 multicast
query sending when using the default interface. The sending will only
fail on the IPv6 socket, so IPv4 requests will make it through.

With that, the macOS error addressed in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 14, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

Removing the InterfaceChoice.Default config when IPv6 is enabled would
be a major breaking change. Instead, inform the user with an error log
message and a DeprecationWarning that this is not a working
configuration.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Also don't use a shared listener/responder sockets for dual-stack mode.
Using a shared socket for IPv4 and IPv6 is especially problematic on
macOS, where the kernel does not support this and even rejects socket
options for IPv4 multicast in this case.

With a separate IPv4 socket, this actually fixes the IPv4 multicast
query sending when using the default interface. The sending will only
fail on the IPv6 socket, so IPv4 requests will make it through.

With that, the macOS error addressed in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 14, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

Removing the InterfaceChoice.Default config when IPv6 is enabled would
be a major breaking change. Instead, inform the user with an error log
message and a DeprecationWarning that this is not a working
configuration.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Also don't use a shared listener/responder sockets for dual-stack mode.
Using a shared socket for IPv4 and IPv6 is especially problematic on
macOS, where the kernel does not support this and even rejects socket
options for IPv4 multicast in this case.

With a separate IPv4 socket, this actually fixes the IPv4 multicast
query sending when using the default interface. The sending will only
fail on the IPv6 socket, so IPv4 requests will make it through.

With that, the macOS error addressed in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
agners added a commit that referenced this pull request Apr 14, 2025
For IPv6, a shared listener/responder socket is not really possible
when sending to link-local IPv6 multicast addresses (ff02::/16):
The kernel needs to know which interface to use for routing.

On IPv4, this is historically a bit different, the kernel just uses
what it deems the primary/best route interface based on the routing
table. But for IPv6, a message is rejected by Linux with OSError no 99
"Cannot assign requested address" and OSError no 65 "No route to host"
on macOS.

Removing the InterfaceChoice.Default config when IPv6 is enabled would
be a major breaking change. Instead, inform the user with an error log
message and a DeprecationWarning that this is not a working
configuration.

As a further cleanup, move the socket options for sending multicast
packets out of the common socket creation code. For listen only sockets
those settings are not needed.

Also don't use a shared listener/responder sockets for dual-stack mode.
Using a shared socket for IPv4 and IPv6 is especially problematic on
macOS, where the kernel does not support this and even rejects socket
options for IPv4 multicast in this case.

With a separate IPv4 socket, this actually fixes the IPv4 multicast
query sending when using the default interface. The sending will only
fail on the IPv6 socket, so IPv4 requests will make it through.

With that, the macOS error addressed in #392 is not a problem anymore.
Actually, we would like to get an exception in case we get into
this combination, so remove the explicit exception handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants