dhcp: Require CAP_NET_BIND_SERVICE and CAP_NET_RAW to open/bind sockets

This commit is contained in:
Tobias Brunner
2013-06-25 17:16:32 +02:00
parent 1dd61bf13d
commit 6f15f5e632
2 changed files with 14 additions and 0 deletions
+11
View File
@@ -107,6 +107,17 @@ plugin_t *dhcp_plugin_create()
{
private_dhcp_plugin_t *this;
if (!lib->caps->keep(lib->caps, CAP_NET_BIND_SERVICE))
{ /* required to bind DHCP socket (port 68) */
DBG1(DBG_NET, "dhcp plugin requires CAP_NET_BIND_SERVICE capability");
return NULL;
}
else if (!lib->caps->keep(lib->caps, CAP_NET_RAW))
{ /* required to open DHCP receive socket (AF_PACKET) */
DBG1(DBG_NET, "dhcp plugin requires CAP_NET_RAW capability");
return NULL;
}
INIT(this,
.public = {
.plugin = {
+3
View File
@@ -38,6 +38,9 @@ typedef struct capabilities_t capabilities_t;
#ifndef CAP_NET_ADMIN
# define CAP_NET_ADMIN 12
#endif
#ifndef CAP_NET_RAW
# define CAP_NET_RAW 13
#endif
/**
* POSIX capability dropping abstraction layer.