Add capabilities check for feature dhcp-discover in the same way we already have it for arp-scan

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2023-05-20 14:40:27 +02:00
parent 2fa2d86f3f
commit 04a7633a32
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
1 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,8 @@
#include "log.h"
// read_FTLconf()
#include "config.h"
// check_capability()
#include "capabilities.h"
#include <sys/time.h>
// SIOCGIFHWADDR
@ -691,6 +693,14 @@ static void *dhcp_discover_iface(void *args)
int run_dhcp_discover(void)
{
// Check if we are capable of binding to port 67 (DHCP)
// DHCP uses normal UDP datagrams, so we cdon't need CAP_NET_RAW
if(!check_capability(CAP_NET_BIND_SERVICE))
{
puts("Error: Insufficient permissions or capabilities (needs CAP_NET_BIND_SERVICE). Try running as root (sudo)");
return EXIT_FAILURE;
}
// Disable terminal output during config config file parsing
log_ctrl(false, false);
// Process pihole-FTL.conf to get gravity.db