Page MenuHomeFreeBSD

divert: declare PF_DIVERT domain and stop abusing PF_INET
ClosedPublic

Authored by glebius on Aug 28 2022, 7:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 18, 3:18 AM
Unknown Object (File)
Sat, May 18, 2:54 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, 6:36 AM
Unknown Object (File)
May 8 2024, 2:57 AM
Unknown Object (File)
Apr 25 2024, 6:16 PM
Unknown Object (File)
Apr 25 2024, 6:16 PM

Details

Summary

The divert(4) is not a protocol of IPv4. It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back. It can divert and re-inject IPv4 and IPv6 packets today,
but potentially it is not limited to these two protocols. The
IPPROTO_DIVERT does not belong to known IP protocols, it
doesn't even fit into u_char. I guess, the implementation of
divert(4) was done the way it is done basically because it was
easier to do it this way, back when protocols for sockets were
intertwined with IP protocols and domains were statically
compiled in.

Moving divert(4) out of inetsw accomplished two important things:

  1. IPDIVERT is getting much closer to be not dependent on INET. This will be finalized in following changes.
  2. Now divert socket no longer aliases with raw IPv4 socket. Domain/proto selection code won't need a hack for SOCK_RAW and multiple entries in inetsw implementing different flavors of raw socket can merge into one without requirement of raw IPv4 being the last member of dom_protosw.

Diff Detail

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