Skip to content

Commit

Permalink
Merge pull request #423 from ArnoStiefvater/improve-arp
Browse files Browse the repository at this point in the history
Improve ARP ping
  • Loading branch information
ArnoStiefvater authored Feb 9, 2021
2 parents ec5916e + 887a00e commit 207a005
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 169 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add separators for a new (ip address) field in ERRMSG and DEADHOST messages. [#376](https://github.com/greenbone/gvm-libs/pull/376)
- Continuously send dead hosts to ospd-openvas to enable a smooth progess bar if only ICMP is chosen as alive test. [#389](https://github.com/greenbone/gvm-libs/pull/389)
- Retry if response via tls1.3 is still not received. [#394](https://github.com/greenbone/gvm-libs/pull/394)
- Replace current implementation of alive test arp ping with version using libnet. [#423](https://github.com/greenbone/gvm-libs/pull/423)

### Removed
- Remove handling of severity class from auth [#402](https://github.com/greenbone/gvm-libs/pull/402)
Expand Down
4 changes: 3 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Specific development libraries:
* libssh >= 0.6.0 (util)
* libhiredis >= 0.10.1 (util)
* libxml2 >= 2.0 (util)
* libnet1 >= 1.1.2.1 (boreas)
* libpcap
* libgcrypt

Expand All @@ -48,7 +49,8 @@ Install prerequisites on Debian GNU/Linux 'Buster' 10:
libssh-gcrypt-dev \
libhiredis-dev \
libxml2-dev \
libpcap-dev
libpcap-dev \
libnet1-dev


Prerequisites for Optional Features
Expand Down
51 changes: 39 additions & 12 deletions boreas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ endif (NOT PKG_CONFIG_FOUND)

## Dependency checks

message (STATUS "Looking for libnet...")
find_library (NET net)
message (STATUS "Looking for net... ${NET}")
if (NOT NET)
message (SEND_ERROR "The net library is required.")
endif (NOT NET)
message (STATUS "Looking for libnet-config...")
find_program (LIBNET_CONFIG libnet-config)

if (LIBNET_CONFIG)
message (STATUS "Looking for libnet-config... ${LIBNET_CONFIG}")
execute_process (COMMAND libnet-config --libs
OUTPUT_VARIABLE LIBNET_LDFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND libnet-config --cflags
OUTPUT_VARIABLE LIBNET_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
else (LIBNET_CONFIG)
message (STATUS "libnet-config not found, using defaults...")
set (LIBNET_LDFLAGS "-L/usr/lib -lnet")
set (LIBNET_CFLAGS "-I/usr/include")
endif (LIBNET_CONFIG)

message (STATUS "Looking for pcap...")
find_library (PCAP pcap)
message (STATUS "Looking for pcap... ${PCAP}")
Expand Down Expand Up @@ -54,9 +77,9 @@ pkg_check_modules (GLIB REQUIRED glib-2.0>=2.42)

include_directories (${GLIB_INCLUDE_DIRS})

set (FILES alivedetection.c boreas_error.c boreas_io.c cli.c ping.c sniffer.c util.c)
set (FILES alivedetection.c arp.c boreas_error.c boreas_io.c cli.c ping.c sniffer.c util.c)

set (HEADERS alivedetection.h boreas_error.h boreas_io.h cli.h ping.h sniffer.h util.h)
set (HEADERS alivedetection.h arp.h boreas_error.h boreas_io.h cli.h ping.h sniffer.h util.h)

if (BUILD_STATIC)
set (LIBGVM_BOREAS_NAME gvm_boreas_static)
Expand All @@ -75,7 +98,11 @@ if (BUILD_SHARED)
set_target_properties (gvm_boreas_shared PROPERTIES VERSION "${CPACK_PACKAGE_VERSION}")
set_target_properties (gvm_boreas_shared PROPERTIES PUBLIC_HEADER "${HEADERS}")

target_link_libraries (gvm_boreas_shared LINK_PRIVATE ${GLIB_LDFLAGS} ${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (gvm_boreas_shared LINK_PRIVATE
${GLIB_LDFLAGS}
${LIBNET_LDFLAGS}
${LINKER_HARDENING_FLAGS}
${CMAKE_THREAD_LIBS_INIT})
endif (BUILD_SHARED)

set (LIBGVM_BOREAS_NAME
Expand All @@ -86,14 +113,14 @@ set (LIBGVM_BOREAS_NAME

add_executable (alivedetection-test
EXCLUDE_FROM_ALL
alivedetection_tests.c boreas_error.c boreas_io.c ping.c
alivedetection_tests.c arp.c boreas_error.c boreas_io.c ping.c
sniffer.c util.c)
add_test (alivedetection-test alivedetection-test)
target_include_directories (alivedetection-test PRIVATE ${CGREEN_INCLUDE_DIRS})
target_link_libraries (alivedetection-test gvm_base_shared gvm_util_shared
${CGREEN_LIBRARIES}
${GLIB_LDFLAGS}
${PCAP_LDFLAGS}
${PCAP_LDFLAGS} ${LIBNET_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})

add_executable (boreas_error-test
Expand All @@ -108,34 +135,34 @@ target_link_libraries (boreas_error-test

add_executable (boreas_io-test
EXCLUDE_FROM_ALL
boreas_io_tests.c boreas_error.c alivedetection.c ping.c
arp.c boreas_io_tests.c boreas_error.c alivedetection.c ping.c
sniffer.c util.c)
add_test (boreas_io-test boreas_io-test)
target_include_directories (boreas_io-test PRIVATE ${CGREEN_INCLUDE_DIRS})
target_link_libraries (boreas_io-test gvm_base_shared gvm_util_shared
${PCAP_LDFLAGS}
${PCAP_LDFLAGS} ${LIBNET_LDFLAGS}
${CGREEN_LIBRARIES}
${GLIB_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})

add_executable (cli-test
EXCLUDE_FROM_ALL
cli_tests.c boreas_error.c boreas_io.c util.c)
arp.c cli_tests.c boreas_error.c boreas_io.c util.c)
add_test (cli-test cli-test)
target_include_directories (cli-test PRIVATE ${CGREEN_INCLUDE_DIRS})
target_link_libraries (cli-test gvm_base_shared gvm_util_shared
${CGREEN_LIBRARIES}
${GLIB_LDFLAGS}
${GLIB_LDFLAGS} ${PCAP_LDFLAGS} ${LIBNET_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})

add_executable (ping-test
EXCLUDE_FROM_ALL
ping_tests.c util.c boreas_error.c)
ping_tests.c arp.c util.c boreas_error.c)
add_test (ping-test ping-test)
target_include_directories (ping-test PRIVATE ${CGREEN_INCLUDE_DIRS})
target_link_libraries (ping-test gvm_base_shared
${CGREEN_LIBRARIES}
${GLIB_LDFLAGS}
${GLIB_LDFLAGS} ${PCAP_LDFLAGS} ${LIBNET_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})

add_executable (sniffer-test
Expand All @@ -144,7 +171,7 @@ add_executable (sniffer-test
add_test (sniffer-test sniffer-test)
target_include_directories (sniffer-test PRIVATE ${CGREEN_INCLUDE_DIRS})
target_link_libraries (sniffer-test gvm_base_shared gvm_util_shared
${PCAP_LDFLAGS}
${PCAP_LDFLAGS} ${LIBNET_LDFLAGS}
${CGREEN_LIBRARIES}
${GLIB_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})
Expand Down
Loading

0 comments on commit 207a005

Please sign in to comment.