Bug 275884

Summary: net/ndproxy: fix build on FreeBSD 14.x kernel
Product: Ports & Packages Reporter: Lorenzo Zolfanelli <dev>
Component: Individual Port(s)Assignee: Olivier Cochard <olivier>
Status: Closed FIXED    
Severity: Affects Many People CC: dev, fbsd.bugzilla, glebius, olivier
Priority: --- Flags: bugzilla: maintainer-feedback? (fbsd.bugzilla)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
proposed port patch none

Description Lorenzo Zolfanelli 2023-12-22 13:32:35 UTC
Created attachment 247197 [details]
proposed port patch

ndproxy is broken since FreeBSD 14, the main reason is a breaking
change in the PFIL interface that has been bumped to PFIL_VERSION 2,
precisely in commit:
https://reviews.freebsd.org/rGcaf32b260ad46b17a4c1a8ce6383e37ac489f023

A PR has been opened upstream https://github.com/AlexandreFenyo/ndproxy/pull/6.

Here, waiting for the solution upstream, we add the PR as patch to
the existing port to enable build on FreeBSD 14.x.

A condition check has been added to not break compilation against
FreeBSD 13.x and previous kernels.

The upstream patch has been tested and implemented successfully on
our production infrastructure.
Comment 1 Gleb Smirnoff freebsd_committer freebsd_triage 2023-12-22 15:42:30 UTC
On 2023-12-22 13:32:35 UTC, dev@zolfa.nl wrote:
> The upstream patch has been tested and implemented successfully on
> our production infrastructure.

The patch looks correct. We need a ports committer to commit it.

I'm sorry for the breakage I caused. I did not expect there already
are out of tree consumers of pfil(9). Next time will take more care
about compatibility.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-12-22 16:08:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=75d90603569e933e8e92d514f361c1f16557941e

commit 75d90603569e933e8e92d514f361c1f16557941e
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2023-12-22 16:03:26 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2023-12-22 16:03:26 +0000

    net/ndproxy: fix build on FreeBSD kernel >= 14

    Adding support for pfil version 2 interface.
    Patch already submitted upstream as pull request:
    https://github.com/AlexandreFenyo/ndproxy/pull/6

    PR:             275884
    Reported by:    Lorenzo Zolfanelli <dev@zolfa.nl>

 net/ndproxy/Makefile                    |  2 --
 net/ndproxy/files/patch-ndproxy.c (new) | 45 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
Comment 3 Olivier Cochard freebsd_committer freebsd_triage 2023-12-22 16:10:02 UTC
Comitted with some fix:

ndproxy.c:57:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   57 | static void register_hook() {
      |                          ^
      |                           void
ndproxy.c:85:28: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   85 | static void unregister_hook() {
      |                            ^
      |                             void
2 errors generated.
*** [ndproxy.o] Error code 1
Comment 4 Lorenzo Zolfanelli 2023-12-22 16:44:04 UTC
Thanks Olivier for the quick reaction.

Just a minor comment, since you fixed the function declaration prototype now the CFLAG that was added in https://reviews.freebsd.org/rP500492 is redundant and we could possibly remove it.
Comment 5 Gleb Smirnoff freebsd_committer freebsd_triage 2023-12-22 16:58:17 UTC
Is it possible to just upstream all the patches accumulated in the port
and switch port to a new version?