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
Unknown Object (File)
May 8 2024, 6:37 AM
Unknown Object (File)
May 8 2024, 6:36 AM
Unknown Object (File)
May 8 2024, 6:36 AM
Unknown Object (File)
May 8 2024, 2:59 AM
Unknown Object (File)
May 2 2024, 3:36 AM
Unknown Object (File)
May 2 2024, 3:27 AM
Unknown Object (File)
May 2 2024, 3:27 AM
Unknown Object (File)
Apr 25 2024, 6:15 PM
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 Not Applicable
Unit
Tests Not Applicable