Page MenuHomeFreeBSD

netinet: Use in_ifprimaryaddr() in place of IFP_TO_IA().
AcceptedPublic

Authored by bms on Wed, Feb 18, 10:39 AM.
Tags
None
Referenced Files
F146406012: D55345.id172261.diff
Mon, Mar 2, 10:56 AM
Unknown Object (File)
Sat, Feb 28, 4:16 PM
Unknown Object (File)
Thu, Feb 26, 6:39 AM
Unknown Object (File)
Wed, Feb 25, 4:55 AM
Unknown Object (File)
Sun, Feb 22, 6:55 PM
Unknown Object (File)
Sun, Feb 22, 4:58 PM
Unknown Object (File)
Sun, Feb 22, 4:58 PM
Unknown Object (File)
Sun, Feb 22, 1:27 PM
Subscribers

Details

Reviewers
glebius
imp
bz
pouria
Group Reviewers
network
Summary

IPv4 multicast currently has the big caveat that it depends on the first
assigned IPv4 address on an interface (the so-called "primary address").

in_primaryaddr() only needs to be used by the following:

  • the 0.0.0.0 booting node input workaround in IGMPv1;
  • filtering out the node's own reports in IGMPv2;
  • preserving the source IP where an IGMPv3 report has been looped back;
  • inferring the default upstream IPv4 interface address for the IP_MULTICAST_IF socket option;
  • and inferring the source address during ip_output() for a multicast datagram where an interface has been explicitly specified by that option.

All of these uses mandate the use of IPv4 source address selection, but
FreeBSD does not yet (fully) implement this functionality.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70787
Build 67670: arc lint + arc unit

Event Timeline

bms requested review of this revision.Wed, Feb 18, 10:39 AM
This revision is now accepted and ready to land.Wed, Feb 18, 11:21 AM

LGTM modulo suggestions made in D55344.

Thanks! You may move the complete removal of IFP_TO_IA() to this change. Or maybe even squash them together. Up to you.

This revision now requires review to proceed.Thu, Feb 19, 5:26 PM

I chose in_ifprimaryaddr() because it's less typing and consistent
with in_ifhasaddr(), and moved its body after that function.

I agree the per-ifnet interface address list should be used in preference
to iterating over the global one, it saves a few cycles and might simplify
concurrency control.

I also would far, far rather the CK_STAILQ_FOREACH() macro invocation here
had braces protectively. It is too easy to mess up otherwise if any change
is made to the loop body which would overflow a single line.

After rebasing, I found I had to add the "Differential Revision:" stanza
to each commit message for "git arc" to pick them up; even then, the revisions
had to each be updated manually because I hadn't used a "stack" to begin with.

Compile tested locally with LINT.

bms retitled this revision from netinet: Use in_primaryaddr() in place of IFP_TO_IA(). to netinet: Use in_ifprimaryaddr() in place of IFP_TO_IA()..Thu, Feb 19, 5:35 PM

Implementing source-address selection for IPv4 should be delegated to GenAI or JKH.

In D55345#1266746, @bms wrote:

Implementing source-address selection for IPv4 should be delegated to GenAI or JKH.

I used to have a patch for IPv4 unicast source address selections.
It was doomed to be too expensive so no one ever wanted to commit it.

This revision is now accepted and ready to land.Thu, Feb 19, 9:22 PM