Bug 263972 - net-mgmt/p0f: Fix build on 13.1 and current
Summary: net-mgmt/p0f: Fix build on 13.1 and current
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-14 13:48 UTC by Jung-uk Kim
Modified: 2022-05-14 17:49 UTC (History)
0 users

See Also:
pi: maintainer-feedback+


Attachments
Fix build on recent FreeBSD (860 bytes, patch)
2022-05-14 13:48 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jung-uk Kim freebsd_committer freebsd_triage 2022-05-14 13:48:06 UTC
Created attachment 233910 [details]
Fix build on recent FreeBSD

It seems recent header change broke the build.

-----------
[*] Compiling p0f... FAIL

Well, something went horribly wrong, sorry. Here's the output from GCC:

p0f.c:488:26: warning: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use the first device [-Wdeprecated-declarations]
        use_iface = (u8*)pcap_lookupdev(pcap_err);
                         ^
/usr/local/include/pcap/pcap.h:395:1: note: 'pcap_lookupdev' has been explicitly marked deprecated here
PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device");
^
/usr/local/include/pcap/funcattrs.h:293:53: note: expanded from macro 'PCAP_DEPRECATED'
  #define PCAP_DEPRECATED(func, msg)    __attribute__((deprecated(msg)))
                                                       ^
1 warning generated.
process.c:112:37: warning: implicit declaration of function 'offsetof' is invalid in C99 [-Wimplicit-function-declaration]
    case DLT_PFLOG:      link_off = PFLOG_HDRLEN; return;
                                    ^
/usr/include/net/if_pflog.h:64:35: note: expanded from macro 'PFLOG_HDRLEN'
#define PFLOG_HDRLEN            PFLOG_ALIGN(offsetof(struct pfloghdr, pad2))
                                            ^
process.c:112:37: error: expected expression
/usr/include/net/if_pflog.h:64:44: note: expanded from macro 'PFLOG_HDRLEN'
#define PFLOG_HDRLEN            PFLOG_ALIGN(offsetof(struct pfloghdr, pad2))
                                                     ^
process.c:112:37: error: use of undeclared identifier 'pad2'
/usr/include/net/if_pflog.h:64:61: note: expanded from macro 'PFLOG_HDRLEN'
#define PFLOG_HDRLEN            PFLOG_ALIGN(offsetof(struct pfloghdr, pad2))
                                                                      ^
1 warning and 2 errors generated.

Sorry! You may want to ping <lcamtuf@coredump.cx> about this.
*** [all] Error code 1
-----------

I think 4daa31c10867b133bdc2a424e1e60d280384dc56 was the culprit.

https://cgit.freebsd.org/src/commit/?id=4daa31c10867b133bdc2a424e1e60d280384dc56

Anyway, the attached patch fix the problem for me.
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-05-14 17:15:35 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9f338283eff141a14454541d5f2ca29609798d15

commit 9f338283eff141a14454541d5f2ca29609798d15
Author:     Jung-uk Kim <jkim@FreeBSD.org>
AuthorDate: 2022-05-14 17:14:14 +0000
Commit:     Kurt Jaeger <pi@FreeBSD.org>
CommitDate: 2022-05-14 17:14:14 +0000

    net-mgmt/p0f: Fix build on 13.1 and current

    PR:             263972

 net-mgmt/p0f/files/patch-process.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
Comment 2 Kurt Jaeger freebsd_committer freebsd_triage 2022-05-14 17:33:27 UTC
Thanks!