From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: [PATCH iproute2/master 08/11] {f,m}_bpf: don't allow specifying multiple bpf programs Date: Thu, 23 Nov 2017 18:12:05 -0800 Message-ID: <20171124021208.13419-9-jakub.kicinski@netronome.com> References: <20171124021208.13419-1-jakub.kicinski@netronome.com> Cc: oss-drivers@netronome.com, daniel@iogearbox.net, Jakub Kicinski To: netdev@vger.kernel.org Return-path: Received: from mail-pl0-f65.google.com ([209.85.160.65]:43837 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbdKXCMZ (ORCPT ); Thu, 23 Nov 2017 21:12:25 -0500 Received: by mail-pl0-f65.google.com with SMTP id h3so3559643pln.10 for ; Thu, 23 Nov 2017 18:12:25 -0800 (PST) In-Reply-To: <20171124021208.13419-1-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Both BPF filter and action will allow users to specify run multiple times, and only the last one will be considered by the kernel. Explicitly refuse such command lines. Signed-off-by: Jakub Kicinski Reviewed-by: Quentin Monnet Acked-by: Daniel Borkmann --- tc/f_bpf.c | 3 +++ tc/m_bpf.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tc/f_bpf.c b/tc/f_bpf.c index 21ba759c4b01..f598784e8b08 100644 --- a/tc/f_bpf.c +++ b/tc/f_bpf.c @@ -101,6 +101,9 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle, while (argc > 0) { if (matches(*argv, "run") == 0) { NEXT_ARG(); + + if (seen_run) + duparg("run", *argv); opt_bpf: seen_run = true; cfg.type = bpf_type; diff --git a/tc/m_bpf.c b/tc/m_bpf.c index e275afd01fb3..1c1f71cdb83f 100644 --- a/tc/m_bpf.c +++ b/tc/m_bpf.c @@ -96,6 +96,9 @@ static int bpf_parse_opt(struct action_util *a, int *ptr_argc, char ***ptr_argv, while (argc > 0) { if (matches(*argv, "run") == 0) { NEXT_ARG(); + + if (seen_run) + duparg("run", *argv); opt_bpf: seen_run = true; cfg.type = bpf_type; -- 2.14.1