Page MenuHomeFreeBSD

netinet: do route lookup when asked to join multicast group on ifindex 0
ClosedPublic

Authored by glebius on Oct 5 2025, 9:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 6, 5:10 AM
Unknown Object (File)
Tue, Nov 4, 8:11 AM
Unknown Object (File)
Tue, Nov 4, 5:54 AM
Unknown Object (File)
Mon, Nov 3, 7:03 AM
Unknown Object (File)
Sun, Nov 2, 11:33 PM
Unknown Object (File)
Sun, Nov 2, 1:37 PM
Unknown Object (File)
Sun, Nov 2, 1:30 PM
Unknown Object (File)
Sun, Nov 2, 1:29 PM

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

  • Rebase the test after the flakyness fix.
This revision was not accepted when it landed; it landed in state Needs Review.Wed, Oct 15, 6:55 PM
This revision was automatically updated to reflect the committed changes.