The code to do the route lookup was already there, but was used only for
the legacy IP_ADD_MEMBERSHIP when called without index. Do same lookup
for IP_ADD_MEMBERSHIP with index and what is more important for
MCAST_JOIN_GROUP, if the supplied index is 0. This is a neat feature and
Linux does that, so this should make a few applications easier portable to
FreeBSD.
Details
Details
- Reviewers
- None
- Group Reviewers
network - Commits
- rGbe7bdb1cf0b0: netinet: do route lookup when asked to join multicast group on ifindex 0
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
This patch has been tested in the context of Flutter application development under linuxulator. Flutter's SDK internal library, written in Dart, provides this method to join mcast group, and when optional network interface is omitted, zero interface passed for further syscall, relaying onto sticking to the most suitable interface:
flutter/bin/cache/pkg/sky_engine/lib/io/socket.dart: /// Joins a multicast group. /// /// If an error occur when trying to join the multicast group, an /// exception is thrown. void joinMulticast(InternetAddress group, [NetworkInterface? interface]);
to keep things related, these two patches support the above functionality:
https://reviews.freebsd.org/D52936
https://reviews.freebsd.org/D52937