]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add CAP_EVENT for the libpcap device
authorLuigi Rizzo <[email protected]>
Thu, 2 Oct 2014 21:34:52 +0000 (21:34 +0000)
committerDenis Ovsienko <[email protected]>
Thu, 9 Feb 2017 12:02:28 +0000 (12:02 +0000)
...so we will be able to use pcap-netmap, which does poll() on the file
descriptor.

tcpdump.c

index 73bf1387659d7533ae62473a8c0934a5e1a4d793..e26fbafdd7013dde2b494cbd815d644eb6ccd570 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1855,7 +1855,12 @@ main(int argc, char **argv)
        if (RFileName == NULL && VFileName == NULL) {
                static const unsigned long cmds[] = { BIOCGSTATS, BIOCROTZBUF };
 
-               cap_rights_init(&rights, CAP_IOCTL, CAP_READ);
+               /*
+                * The various libpcap devices use a combination of
+                * read (bpf), ioctl (bpf, netmap), poll (netmap)
+                * so we add the relevant access rights.
+                */
+               cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_EVENT);
                if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 &&
                    errno != ENOSYS) {
                        error("unable to limit pcap descriptor");