Page MenuHomeFreeBSD

netinet: Promote IFP_TO_IA() from macro to function in_ifprimaryaddr().
ClosedPublic

Authored by bms on Feb 18 2026, 10:39 AM.
Tags
None
Referenced Files
F164703138: D55344.id182838.diff
Mon, Aug 3, 6:35 AM
Unknown Object (File)
Sun, Aug 2, 5:14 AM
Unknown Object (File)
Sun, Aug 2, 2:31 AM
Unknown Object (File)
Sun, Aug 2, 12:52 AM
Unknown Object (File)
Sat, Aug 1, 7:10 PM
Unknown Object (File)
Sat, Aug 1, 5:39 AM
Unknown Object (File)
Thu, Jul 30, 7:24 AM
Unknown Object (File)
Sun, Jul 26, 5:53 PM
Subscribers

Details

Summary

in_primaryaddr() exists only to support IPv4 multicast usage. Since the
adoption of epoch tracking, ifa_ref() is no longer required in its body.

Add a comment that IFP_TO_IA() is now deprecated. We cannot use
__deprecated1() from <sys/cdefs.h> as it is a macro, and not a function.

Diff Detail

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

Event Timeline

bms requested review of this revision.Feb 18 2026, 10:39 AM
This revision is now accepted and ready to land.Feb 18 2026, 11:16 AM
sys/netinet/in.c
300

Since it operates in the scope of a single interface, let's name it with in_ifnet_ prefix, to match existing in_ifnet_broadcast and separate from other primitives that operator on global scope. Possible names are: in_ifnet_firstaddr, in_ifnet_primaryaddr, in_ifnet_primary.

302–311

Let's iterate over this interface address list instead of global list. Should be better for a host with many interfaces and addresses. This also will make the function not requiring VNET context to be set.

sys/netinet/in_var.h
155–167

Let's just remove it completely. There is no out of tree code that uses it. If there existed any, it would be broken numerous times, most recently with the epoch changes.

sys/netinet/in_var.h
155–167

Let's just remove it completely. There is no out of tree code that uses it. If there existed any, it would be broken numerous times, most recently with the epoch changes.

+1
I think this should be done in D55345.

This revision now requires review to proceed.Feb 19 2026, 5:27 PM
bms retitled this revision from netinet: Promote IFP_TO_IA() from macro to function in_primaryaddr(). to netinet: Promote IFP_TO_IA() from macro to function in_ifprimaryaddr()..Feb 19 2026, 5:35 PM
This comment was removed by bms.
This revision is now accepted and ready to land.Feb 19 2026, 9:20 PM

P.S. I would suggest to retitle to netinet: introduce in_ifprimaryaddr() to lookup first IPv4 address of an ifnet. IMHO, there is not reason to reference a macro that is about to go away.