HomeFreeBSD

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

Description

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

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.

Differential revision: https://reviews.freebsd.org/D36382

Details

Provenance
glebiusAuthored on Aug 30 2022, 10:09 PM
Differential Revision
D36382: divert(4): maintain own cb database and stop using inpcb KPI
Parents
rG2b1c72171e3e: divert(4): provide statistics
Branches
Unknown
Tags
Unknown