Re: git: cb7009867ae6 - main - socket: Restore handling of IPPROTO_DIVERT

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Tue, 25 Aug 2026 18:56:19 UTC
On Tue, Aug 25, 2026 at 06:17:45PM +0000, Mark Johnston wrote:
M> The branch main has been updated by markj:
M> 
M> URL: https://cgit.FreeBSD.org/src/commit/?id=cb7009867ae6b33aa39cb6cb1453b69073144b44
M> 
M> commit cb7009867ae6b33aa39cb6cb1453b69073144b44
M> Author:     Mark Johnston <markj@FreeBSD.org>
M> AuthorDate: 2026-08-25 18:09:09 +0000
M> Commit:     Mark Johnston <markj@FreeBSD.org>
M> CommitDate: 2026-08-25 18:09:09 +0000
M> 
M>     socket: Restore handling of IPPROTO_DIVERT
M>     
M>     Python scripts which use divert sockets no longer work after commit
M>     e967a2a03677; even if one patches socket() calls, getaddrlen() doesn't
M>     work on divert sockets, needed to use recvfrom().
M>     
M>     Restore compatibility when COMPAT_FREEBSD15 is defined.
M>     
M>     Reviewed by:    kib
M>     Sponsored by:   OPNsense
M>     Sponsored by:   Klara, Inc.
M>     Differential Revision:  https://reviews.freebsd.org/D59018

I'm not happy with this change.  I know that I'm slow on reacting on reviews,
but for this one you didn't give me a week to say anything.

I did a lot of work to discover and upstream all applications in the ports that
use divert(4) to properly use PF_DIVERT.

I worked with python to adopt PF_DIVERT and I also fixed the getaddrlen()
there, too.  See https://github.com/python/cpython/pull/142993

I addressed all python scripts in the tests to properly use PF_DIVERT.

Unfortunately python is very slow with accepting changes and our ports are very
slow with adopting newer python versions.  However, the bugfix can be easily
added to python312 port as a patch.

Now with this change we will have extra check for every socket(2) syscall to
satisfy a very small number of installations, who are ether willing to run
FreeBSD 16 with outdated python either with proper version of python, but are
unwilling to apply a trivial change to their script.  Can you estimate number
of this installations?

And we all know that COMPAT_FREEBSD15 is going to be part of GENERIC for the
time being, thus the argument that it can potentially be compiled out isn't
strong at all.

-- 
Gleb Smirnoff