Bug 261978 - security/dsniff: Fails to build on 12.2-STABLE with GCC 10 and LLVM 10: pcaputil.h:14:9: error: conflicting types for 'pcap_init' | dnsspoof.c:311:37: error: too many arguments to function call
Summary: security/dsniff: Fails to build on 12.2-STABLE with GCC 10 and LLVM 10: pcapu...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Sofian Brabez
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-02-15 23:50 UTC by dewayne
Modified: 2022-02-16 21:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (sbz)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dewayne 2022-02-15 23:50:13 UTC
Compilation attempt on 12.2-STABLE FreeBSD 12.2-STABLE #1 r369922M

Using GCC10
In file included from ./dnsspoof.c:28:
./pcaputil.h:14:9: error: conflicting types for 'pcap_init'
   14 | pcap_t *pcap_init(char *intf, char *filter, int snaplen);
      |         ^~~~~~~~~
In file included from /usr/local/include/pcap.h:43,
                 from ./dnsspoof.c:26:
/usr/local/include/pcap/pcap.h:386:14: note: previous declaration of 'pcap_init' was here
  386 | PCAP_API int pcap_init(unsigned int, char *);
      |              ^~~~~~~~~
./dnsspoof.c: In function 'main':
./dnsspoof.c:299:2: warning: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use the first device [-Wdeprecated-declarations]
  299 |  if (dev == NULL && (dev = pcap_lookupdev(buf)) == NULL)
      |  ^~
In file included from /usr/local/include/pcap.h:43,
                 from ./dnsspoof.c:26:
/usr/local/include/pcap/pcap.h:394:16: note: declared here
  394 | PCAP_API char *pcap_lookupdev(char *)
      |                ^~~~~~~~~~~~~~
*** Error code 1


clang10
/usr/local/include/pcap/funcattrs.h:291:53: note: expanded from macro 'PCAP_DEPRECATED'
  #define PCAP_DEPRECATED(func, msg)    __attribute__((deprecated(msg)))
                                                       ^
./dnsspoof.c:311:37: error: too many arguments to function call, expected 2, have 3
        if ((pcap_pd = pcap_init(dev, buf, 128)) == NULL)
                       ~~~~~~~~~           ^~~
/usr/local/include/pcap/pcap.h:386:1: note: 'pcap_init' declared here
PCAP_API int    pcap_init(unsigned int, char *);
^
/usr/local/include/pcap/funcattrs.h:147:31: note: expanded from macro 'PCAP_API'
#define PCAP_API        PCAP_API_DEF extern
                                     ^
3 warnings and 2 errors generated.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-16 00:05:16 UTC
Thank you for your report. Could you include additional information, including:

- /etc/make.conf contents (as an attachment, if not empty)
- pkg version -v output (as an attachment)
- full build log (as an attachment, compressed if necessary)
Comment 2 dewayne 2022-02-16 00:31:55 UTC
(In reply to Kubilay Kocak from comment #1)
In this rare case, I don't think the requested information is necessary.

Build command is 
make -C /usr/ports/security/dsniff -DMAKE_JOBS_UNSAFE __MAKE_CONF=/dev/null clean package

pkg -v is 1.15.10

Log:
===>  Building for dsniff-2.4.b1_6
cc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -D_BSD_SOURCE -DLIBNET_BSDISH_OS -DHAVE_SOCKADDR_SA_LEN -DDSNIFF_LIBDIR=\"/usr/local/lib/\" -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include  -I/usr/local/include  -c ./arpspoof.c
In file included from ./arpspoof.c:25:
In file included from /usr/local/include/libnet.h:119:
/usr/local/include/./libnet/libnet-headers.h:510:9: warning: 'ETHERTYPE_IPV6' macro redefined
      [-Wmacro-redefined]
#define ETHERTYPE_IPV6          0x86dd  /* IPv6 protocol */
        ^
/usr/include/net/ethernet.h:329:9: note: previous definition is here
#define ETHERTYPE_IPV6          0x86DD  /* IP protocol version 6 */
        ^
./arpspoof.c:61:7: warning: assigning to 'u_int8_t *' (aka 'unsigned char *') from 'char [7]'
      converts between pointers to integer types with different sign [-Wpointer-sign]
                tha = "\xff\xff\xff\xff\xff\xff";
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
./arpspoof.c:188:30: warning: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use
      the first device [-Wdeprecated-declarations]
        if (intf == NULL && (intf = pcap_lookupdev(pcap_ebuf)) == NULL)
                                    ^
/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:291:53: note: expanded from macro 'PCAP_DEPRECATED'
  #define PCAP_DEPRECATED(func, msg)    __attribute__((deprecated(msg)))
                                                       ^
3 warnings generated.
cc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -D_BSD_SOURCE -DLIBNET_BSDISH_OS -DHAVE_SOCKADDR_SA_LEN -DDSNIFF_LIBDIR=\"/usr/local/lib/\" -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include  -I/usr/local/include  -c ./arp.c
./arp.c:76:4: warning: implicitly declaring library function 'memcpy' with type 'void *(void *,
      const void *, unsigned long)' [-Wimplicit-function-declaration]
                        memcpy(ether->ether_addr_octet, LLADDR(sdl),
                        ^
./arp.c:76:4: note: include the header <string.h> or explicitly provide a declaration for
      'memcpy'
1 warning generated.
cc -fstack-protector -o arpspoof arpspoof.o arp.o -lrpcsvc  -L. -lmd -L/usr/local/lib -lpcap -L/usr/local/lib -lnet
cc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -D_BSD_SOURCE -DLIBNET_BSDISH_OS -DHAVE_SOCKADDR_SA_LEN -DDSNIFF_LIBDIR=\"/usr/local/lib/\" -I. -I/usr/local/include -I/usr/local/include -I/usr/local/include  -I/usr/local/include  -c ./dnsspoof.c
In file included from ./dnsspoof.c:28:
./pcaputil.h:14:9: error: conflicting types for 'pcap_init'
pcap_t *pcap_init(char *intf, char *filter, int snaplen);
        ^
/usr/local/include/pcap/pcap.h:386:14: note: previous declaration is here
PCAP_API int    pcap_init(unsigned int, char *);
                ^
./dnsspoof.c:226:10: warning: assigning to 'u_char *' (aka 'unsigned char *') from 'char *'
      converts between pointers to integer types with different sign [-Wpointer-sign]
                if ((q = dns_lookup_ptr(name)) == NULL)
                       ^ ~~~~~~~~~~~~~~~~~~~~
./dnsspoof.c:230:20: warning: passing 'u_char *' (aka 'unsigned char *') to parameter of type
      'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
                anslen = dn_comp(q, p + 12, 256, NULL, NULL);
                                 ^
/usr/include/resolv.h:446:26: note: passing argument to parameter here
int             dn_comp(const char *, u_char *, int, u_char **, u_char **);
                                    ^
./dnsspoof.c:299:28: warning: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use
      the first device [-Wdeprecated-declarations]
        if (dev == NULL && (dev = pcap_lookupdev(buf)) == NULL)
                                  ^
/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:291:53: note: expanded from macro 'PCAP_DEPRECATED'
  #define PCAP_DEPRECATED(func, msg)    __attribute__((deprecated(msg)))
                                                       ^
./dnsspoof.c:311:37: error: too many arguments to function call, expected 2, have 3
        if ((pcap_pd = pcap_init(dev, buf, 128)) == NULL)
                       ~~~~~~~~~           ^~~
/usr/local/include/pcap/pcap.h:386:1: note: 'pcap_init' declared here
PCAP_API int    pcap_init(unsigned int, char *);
^
/usr/local/include/pcap/funcattrs.h:147:31: note: expanded from macro 'PCAP_API'
#define PCAP_API        PCAP_API_DEF extern
                                     ^
3 warnings and 2 errors generated.
*** Error code 1

And 
# cc -v
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-16 21:48:20 UTC
(In reply to dewayne from comment #2)

It's often the case that additional context/details can highlight factors that may be beneficial to isolation. Also, for long bodies of test, please use attachments so issues are easier to follow and details dont get lost in the noise :)