mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
724ab54aa3
Signed-off-by: DL6ER <dl6er@dl6er.de>
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
/* Pi-hole: A black hole for Internet advertisements
|
|
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
* Network-wide ad blocking via your own hardware.
|
|
*
|
|
* FTL Engine
|
|
* Linux capability check routines
|
|
*
|
|
* This file is copyright under the latest version of the EUPL.
|
|
* Please see LICENSE file for your rights under this license. */
|
|
|
|
#include "FTL.h"
|
|
#include <sys/capability.h>
|
|
|
|
bool check_capabilities()
|
|
{
|
|
if(!cap_get_bound(CAP_NET_ADMIN))
|
|
{
|
|
// Needed for ARP-injection (used when we're the DHCP server)
|
|
logg("**************************************************************");
|
|
logg("WARNING: Required linux capability CAP_NET_ADMIN not available");
|
|
logg("**************************************************************");
|
|
return false;
|
|
}
|
|
if(!cap_get_bound(CAP_NET_RAW))
|
|
{
|
|
// Needed for raw socket access (necessary for ICMP)
|
|
logg("************************************************************");
|
|
logg("WARNING: Required linux capability CAP_NET_RAW not available");
|
|
logg("************************************************************");
|
|
return false;
|
|
}
|
|
if(!cap_get_bound(CAP_NET_BIND_SERVICE))
|
|
{
|
|
// Necessary for dynamic port binding
|
|
logg("*********************************************************************");
|
|
logg("WARNING: Required linux capability CAP_NET_BIND_SERVICE not available");
|
|
logg("*********************************************************************");
|
|
return false;
|
|
}
|
|
|
|
// All okay!
|
|
return true;
|
|
}
|