Skip to content

Fix UDP multicast interface on MacOS #1940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2025

Conversation

Dennis-Johnson
Copy link
Contributor

@Dennis-Johnson Dennis-Johnson commented May 18, 2025

Hi,

This fixes #1760 to allow usage of the UDP Multicast backend on MacOS.

The ioctl check before timestamping in recv was only partially fixed for Windows on main, but MacOS still doesn't support this ioctl.

The second change is adding the SO_REUSEPORT option.

@Dennis-Johnson Dennis-Johnson changed the title Add sock option SO_REUSEPORT to allow udp multicast on macos Fix UDP multicast interface on MacOS May 18, 2025
@Dennis-Johnson
Copy link
Contributor Author

Also, the example provided in your docs fails with DEFAULT_GROUP_IPv6 on MacOS. These changes work with DEFAULT_GROUP_IPv4 though.

line 320, in _create_socket
    raise can.CanInitializationError(
can.exceptions.CanInitializationError: could not create or configure socket

@@ -21,6 +22,8 @@
ioctl_supported = False
pass

# All ioctls aren't supported on MacOS.
is_macos = platform.system() == "Darwin"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like having two flags ioctl_supported and is_macos for the same purpose. Maybe we could import ioctl on Linux only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Changed the flag to a single is_linux instead of the previous two.

Copy link
Collaborator

@zariiii9003 zariiii9003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@zariiii9003 zariiii9003 merged commit 958fc64 into hardbyte:main Jun 13, 2025
30 checks passed
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.

Issues with UdpMulticastBus and MacOS
2 participants