netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: netdev@vger.kernel.org, stephen@networkplumber.org
Cc: David Ahern <dsa@cumulusnetworks.com>
Subject: [PATCH iproute2 3/3] ip vrf: Improve bpf error messages
Date: Thu,  5 Jan 2017 16:22:23 -0800	[thread overview]
Message-ID: <1483662143-15242-4-git-send-email-dsa@cumulusnetworks.com> (raw)
In-Reply-To: <1483662143-15242-1-git-send-email-dsa@cumulusnetworks.com>

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ip/ipvrf.c b/ip/ipvrf.c
index dc8364a43a57..8bd99d6251f2 100644
--- a/ip/ipvrf.c
+++ b/ip/ipvrf.c
@@ -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;
 	}
 
-- 
2.1.4

  parent reply	other threads:[~2017-01-06  0:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06  0:22 [PATCH iproute2 0/3] ip vrf: minor error message cleanups David Ahern
2017-01-06  0:22 ` [PATCH iproute2 1/3] ip vrf: Fix run-on error message on mkdir failure David Ahern
2017-01-06  0:22 ` [PATCH iproute2 2/3] ip vrf: Improve cgroup2 error messages David Ahern
2017-01-06  9:45   ` Sergei Shtylyov
2017-01-06 15:05     ` David Ahern
2017-01-06  0:22 ` David Ahern [this message]
2017-01-09 20:15 ` [PATCH iproute2 0/3] ip vrf: minor error message cleanups Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483662143-15242-4-git-send-email-dsa@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).