Page MenuHomeFreeBSD

inpcb: declare struct in_conninfo as a single declaration
ClosedPublic

Authored by glebius on Jul 16 2026, 1:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 12, 9:05 AM
Unknown Object (File)
Wed, Sep 9, 10:01 PM
Unknown Object (File)
Tue, Sep 8, 9:51 PM
Unknown Object (File)
Mon, Sep 7, 9:45 PM
Unknown Object (File)
Sun, Sep 6, 10:16 AM
Unknown Object (File)
Sat, Sep 5, 11:39 AM
Unknown Object (File)
Fri, Sep 4, 1:13 PM
Unknown Object (File)
Thu, Sep 3, 11:34 PM
Subscribers

Details

Summary

This removes just one level of #define mess that is needed to reach into
an inpcbs IPv4 address. And makes the declaration easier to read. No
functional change.

Diff Detail

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

Event Timeline

Note: union in_dependaddr can be anonymized after small cleanup of lbgroup code and siftr(4). This removes another level of of defines for both IPv6 and IPv4. This may need universe/exp-run, though.

The idea is that instead of union in_dependaddr ie_dependfaddr, ie_dependladdr; two anonymous unions are used. Identical in their layout, but one has members with f prefix and other with l.

If there is some consensus on this being a good idea, I can run test builds and post the review,

The struct in_endpoints can also be anonymized easily, but that would highly likely affect something outside of FreeBSD. Another level of #define to be removed. Let me know what you think about this and I will dig deeper into this if we all agree.

Alternatively we can leave publicly declared struct in_conninfo as is and just stop using it internally. But this review (D58273) probably should go in. It must be safe.

sys/netinet/in_pcb.h
41–45

BTW, there is nothing providing this guarantee, I believe: the natural alignment of this structure is 4, not 8.

51–52

What does this comment mean?

553

This last sentence is stale.

sys/netinet/in_pcb.h
41–45

AFAIU the comment, it says that the existing members at the beginning of the structure align the IPv6 addresses to 8.

(kgdb) set $inc = (struct in_conninfo *)0
(kgdb) p $inc->inc_ie.ie_dependfaddr
Cannot access memory at address 0x8

And you are right, there is no natural alignment, and inside inpcb the addresses are not aligned:

(kgdb) p/x (uintptr_t)&$inp->inp_inc->inc_ie.ie_dependfaddr & (8-1)
$6 = 0x4

Do you suggest to remove the comment?

51–52

The was pad one? I'd be glad to remove it.

553

Thanks!

sys/netinet/in_pcb.h
41–45

I would at least remove the claim that it is aligned today, maybe add an XXX comment describing your observation.

51–52

Yes, I'm not sure what it's trying to say.

Fixup comments:

  • Remove comment about alignment. inpcb doesn't have IPv6 addresses aligned and the RFC talks about alignment of API structures, specifically sockaddr_in6.
  • Remove old mentioning of old pad
  • Fixup mentioning of a structure that is just deleted
This revision is now accepted and ready to land.Jul 23 2026, 2:30 PM