]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip vrf: Improve bpf error messages
authorDavid Ahern <dsa@cumulusnetworks.com>
Fri, 6 Jan 2017 00:22:23 +0000 (16:22 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 9 Jan 2017 20:13:09 +0000 (12:13 -0800)
Next up a non-root user gets various bpf related error messages:

$ ip vrf exec mgmt bash
Failed to load BPF prog: 'Operation not permitted'
Kernel compiled with CGROUP_BPF enabled?

Catch the EPERM error and do not show the kernel config option.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
ip/ipvrf.c

index dc8364a43a57d51d6d9a6f88fb8c65964f50e98d..8bd99d6251f26b3cbdb0b33fb64301dc9b4b7ac6 100644 (file)
@@ -181,7 +181,11 @@ static int vrf_configure_cgroup(const char *path, int ifindex)
        if (prog_fd < 0) {
                fprintf(stderr, "Failed to load BPF prog: '%s'\n",
                        strerror(errno));
-               fprintf(stderr, "Kernel compiled with CGROUP_BPF enabled?\n");
+
+               if (errno != EPERM) {
+                       fprintf(stderr,
+                               "Kernel compiled with CGROUP_BPF enabled?\n");
+               }
                goto out;
        }