X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=0494b4baeb20494f3a00fdb629eb2d738b637077;hb=d782a871aca61ac966ee8d928930719bd0c05023;hp=e23a2bb21b343b3dd37ae3a7f20e7ac77a496de3;hpb=7dcf9ab7675fe91d1bd74998f55031bc3b0480c0;p=collectd.git diff --git a/src/dns.c b/src/dns.c index e23a2bb2..0494b4ba 100644 --- a/src/dns.c +++ b/src/dns.c @@ -34,6 +34,10 @@ #include +#ifdef HAVE_SYS_CAPABILITY_H +# include +#endif + /* * Private data types */ @@ -346,6 +350,20 @@ static int dns_init (void) listen_thread_init = 1; +#if defined(HAVE_SYS_CAPABILITY_H) && defined(CAP_NET_RAW) + if (check_capability (CAP_NET_RAW) != 0) + { + if (getuid () == 0) + WARNING ("dns plugin: Running collectd as root, but the CAP_NET_RAW " + "capability is missing. The plugin's read function will probably " + "fail. Is your init system dropping capabilities?"); + else + WARNING ("dns plugin: collectd doesn't have the CAP_NET_RAW capability. " + "If you don't want to run collectd as root, try running \"setcap " + "cap_net_raw=ep\" on the collectd binary."); + } +#endif + return (0); } /* int dns_init */