Bug 261242

Summary: security/nmap: Fails to build on 13-STABLE: net/bpf.h:364:8: error: redefinition of 'bpf_insn'
Product: Ports & Packages Reporter: Volodymyr Kostyrko <arcade>
Component: Individual Port(s)Assignee: Cy Schubert <cy>
Status: Closed FIXED    
Severity: Affects Some People CC: chris, cy, eugen
Priority: --- Flags: koobs: merge-quarterly+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
nmap must use pcap provided by base none

Description Volodymyr Kostyrko 2022-01-16 11:58:34 UTC
In file included from ./gencode.c:80:                                                                                                                                                                               
In file included from /usr/include/net/if_pflog.h:34:                                                                                                                                                               /usr/include/net/bpf.h:71:8: error: redefinition of 'bpf_program'                                                                                                                                                   
struct bpf_program {                                                                                                                                                                                                       ^                                                                                                                                                                                                            
./pcap/bpf.h:104:8: note: previous definition is here
struct bpf_program {                                                                                                                                                                                                       ^                                                                                                  
In file included from ./gencode.c:80:
In file included from /usr/include/net/if_pflog.h:34:                                     
/usr/include/net/bpf.h:364:8: error: redefinition of 'bpf_insn'                
struct bpf_insn {                    
       ^                                                                                                  
./pcap/bpf.h:234:8: note: previous definition is here
struct bpf_insn {
       ^
2 errors generated.
gmake[3]: *** [Makefile:484: gencode.o] Error 1
gmake[3]: Leaving directory '/tmp/ports/usr/ports/security/nmap/work/nmap-7.91/libpcap'
gmake[2]: *** [Makefile:141: build-pcap] Error 2
gmake[2]: *** Waiting for unfinished jobs....

Probably some changes from 14 made they way to 13-STABLE and that change wasn't picked up by port yet.
Comment 1 Cy Schubert freebsd_committer freebsd_triage 2022-01-16 18:13:57 UTC
Created attachment 231052 [details]
nmap must use pcap provided by base

nmap must use pcap provided by base. Its own pcap will result in this error. The atteched patch will force this.
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-01-16 18:17:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7a374db8e5ba3916d4e97e799e0e90c47ba1e62b

commit 7a374db8e5ba3916d4e97e799e0e90c47ba1e62b
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-01-16 18:14:32 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-01-16 18:17:06 +0000

    security/nmap: PCAP option conflicts with pcap in 13-STABLE base

    PCAP option also conflicts with pcap in 14-CURRENT base. Mark the option
    BROKEN. This is the same fix as b1dcaf64da857d32153590fed40804f460da9bb9
    for 14-CURRENT.

    PR:             261242
    MFH:            2022Q1

 security/nmap/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-01-16 18:20:37 UTC
A commit in branch 2022Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=779c6cbc6160d90e72d61c1b1e02cccb308d81c7

commit 779c6cbc6160d90e72d61c1b1e02cccb308d81c7
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-01-16 18:14:32 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-01-16 18:19:34 +0000

    security/nmap: PCAP option conflicts with pcap in 13-STABLE base

    PCAP option also conflicts with pcap in 13-STABLE base. Mark the option
    BROKEN. This is the same fix as b1dcaf64da857d32153590fed40804f460da9bb9
    for 14-CURRENT.

    PR:             261242

    (cherry picked from commit 7a374db8e5ba3916d4e97e799e0e90c47ba1e62b)

 security/nmap/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 4 Cy Schubert freebsd_committer freebsd_triage 2022-01-17 16:33:36 UTC
Fixed.
Comment 5 Eugene Grosbein freebsd_committer freebsd_triage 2022-04-29 17:48:55 UTC
I just used 13.1-STABLE of 19 April 2022 to build nmap with PCAP options turned on and BROKEN_FreeBSD_13 commented out. And it builds without a problem. And runs.

# ldd `which nmap`
/usr/local/bin/nmap:
        libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x200000)
        libibverbs.so.1 => /lib/libibverbs.so.1 (0x200000)
        libssl.so.111 => /usr/lib/libssl.so.111 (0x200000)
        libcrypto.so.111 => /lib/libcrypto.so.111 (0x200000)
        libz.so.6 => /lib/libz.so.6 (0x200000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x200000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x200000)
        libm.so.5 => /lib/libm.so.5 (0x200000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x200000)
        libc.so.7 => /lib/libc.so.7 (0x200000)
        libthr.so.3 => /lib/libthr.so.3 (0x800432000)
[preloaded]
        [vdso] (0x7ffffffff6a0)
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2022-04-29 18:01:04 UTC
Builds fine on 14-CURRENT too now. Looks like whatever was conflicting is resolved now.
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-04-29 18:08:14 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4a1604404d176e424d3c30f9856e75ca5e010ecb

commit 4a1604404d176e424d3c30f9856e75ca5e010ecb
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-04-29 18:03:01 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-04-29 18:07:27 +0000

    security/nmap: Revert 7a374db8e5ba3916d4e97e799e0e90c47ba1e62b

    Revert "security/nmap: PCAP option conflicts with pcap in 13-STABLE base".
    security/nmap builds fine with PCAP enabled now.

    This reverts commit 7a374db8e5ba3916d4e97e799e0e90c47ba1e62b.

    PR:             261242
    Reported by:    eugen
    MFH             2022Q2

 security/nmap/Makefile | 1 -
 1 file changed, 1 deletion(-)