Deprecated API of libpcap (pcap_lookupdev) used
xambroz opened this issue · comments
Expected behavior
Compilation without warnings
Current behavior
Compilation generates warning (in Fedora error) about using deprecated API
Steps to reproduce
export 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
- CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
export CXXFLAGS
FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
export FFLAGS
FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
export FCFLAGS
LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
export LDFLAGS
/usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DLOCALSTATEDIR:PATH=/var -DOPENVASSD_RULES:PATH=/etc/openvas/openvassd.rules
GVM versions
gvm-libs: 11.0.0
openvas-scanner: 7.0.0
Environment
Operating system:
Fedora 30
Logfiles
cd /home/mambroz/rpmbuild/BUILD/openvas-7.0.0/misc && /usr/lib64/ccache/cc -DOPENVAS_DATA_DIR=\"/usr/share/openvas\" -DOPENVAS_STATE_DIR=\"/var/lib/openvas\" -DOPENVAS_SYSCONF_DIR=\"/etc/openvas\" -Dopenvas_misc_shared_EXPORTS -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gvm -I/usr/include/p11-kit-1 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_FILE_OFFSET_BITS=64 -DLARGEFILE_SOURCE=1 -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -Wall -Wextra -fPIC -g -Werror -fPIC -o CMakeFiles/openvas_misc_shared.dir/plugutils.c.o -c /home/mambroz/rpmbuild/BUILD/openvas-7.0.0/misc/plugutils.c
/home/mambroz/rpmbuild/BUILD/openvas-7.0.0/misc/bpf_share.c: In function 'bpf_open_live':
/home/mambroz/rpmbuild/BUILD/openvas-7.0.0/misc/bpf_share.c:70:5: error: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use the first device [-Werror=deprecated-declarations]
70 | iface = pcap_lookupdev (errbuf);
| ^~~~~
In file included from /usr/include/pcap.h:43,
from /home/mambroz/rpmbuild/BUILD/openvas-7.0.0/misc/bpf_share.c:27:
/usr/include/pcap/pcap.h:326:16: note: declared here
326 | PCAP_API char *pcap_lookupdev(char *)
| ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Hi @xambroz,
Thanks for report this.
Apparently, you are using a version of libpcap-dev >= 1.9.0, which deprecates pcap_lookupdev function.
As our reference system at this moment is Debian 9 (Stretch), which has libpcap-dev v1.8.1, and it is the same for Debian 10 (Buster), we do not consider this as critical, but this will be improved in future.
This was already discussed and you can find a work around in https://community.greenbone.net.
Regards.