Page MenuHomeFreeBSD

divert(4): maintain own cb database and stop using inpcb KPI
ClosedPublic

Authored by glebius on Aug 28 2022, 7:09 AM.
Tags
None
Referenced Files
F102661125: D36382.diff
Fri, Nov 15, 12:18 PM
Unknown Object (File)
Oct 6 2024, 12:20 PM
Unknown Object (File)
Oct 6 2024, 12:20 PM
Unknown Object (File)
Sep 18 2024, 4:09 AM
Unknown Object (File)
Sep 17 2024, 9:27 PM
Unknown Object (File)
Sep 16 2024, 6:44 PM
Unknown Object (File)
Sep 16 2024, 9:15 AM
Unknown Object (File)
Sep 14 2024, 6:02 AM
Subscribers

Details

Summary

Here go cons of using inpcb for divert:

  • divert(4) uses only 16 bits (local port) out of struct inpcb, which is 424 bytes today.
  • The inpcb KPI isn't able to provide hashing for divert(4), thus it uses global inpcb list for lookups.
  • divert(4) uses INET-specific part of the KPI, making INET a requirement for IPDIVERT.

Maintain our own very simple hash lookup database instead. It
has mutex protection for write and epoch protection for lookups.
Since now so->so_pcb no longer points to struct inpcb, don't
initialize protosw methods to methods that belong to PF_INET.
Also, drop support for setting options on a divert socket. My
review of software in base and ports confirms that this has no
use and unlikely worked before.

Diff Detail

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