[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158eaf99-1018-4ef6-bfdf-5f86464aae83@kernel.org>
Date: Tue, 23 Jan 2024 11:17:53 -0700
From: David Ahern <dsahern@...nel.org>
To: Victor Nogueira <victor@...atatu.com>, stephen@...workplumber.org,
netdev@...r.kernel.org
Cc: kernel@...atatu.com
Subject: Re: [PATCH iproute2-next] m_mirred: Allow mirred to block
On 1/23/24 9:11 AM, Victor Nogueira wrote:
> ---
> tc/m_mirred.c | 60 +++++++++++++++++++++++++++++++++++++++++----------
missing the man page update
> 1 file changed, 49 insertions(+), 11 deletions(-)
>
> diff --git a/tc/m_mirred.c b/tc/m_mirred.c
> index e5653e67f..db847b1a3 100644
> --- a/tc/m_mirred.c
> +++ b/tc/m_mirred.c
> @@ -162,15 +167,38 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
> TCA_INGRESS_REDIR;
> p.action = TC_ACT_STOLEN;
> ok++;
> - } else if ((redir || mirror) &&
> - matches(*argv, "dev") == 0) {
> - NEXT_ARG();
> - if (strlen(d))
> - duparg("dev", *argv);
> -
> - strncpy(d, *argv, sizeof(d)-1);
> - argc--;
> - argv++;
> + } else if ((redir || mirror)) {
> + if (matches(*argv, "blockid") == 0) {
Not accepting any more uses of matches.
> + if (strlen(d)) {
> + fprintf(stderr,
> + "Mustn't specify blockid and dev simultaneously\n");
> + return -1;
> + }
> + NEXT_ARG();
> + if (get_u32(&blockid, *argv, 0) ||
> + !blockid) {
> + fprintf(stderr,
> + "invalid block ID index value %s",
> + *argv);
> + return -1;
> + }
> + argc--;
> + argv++;
> + }
> + if (argc && matches(*argv, "dev") == 0) {
This one is legacy, but I really would like to see it as 'dev' (versus
just 'd' or 'de'). Such a change is risky from a backwards
compatibility, so I guess we are stuck with it.
> + if (blockid) {
> + fprintf(stderr,
> + "Mustn't specify blockid and dev simultaneously\n");
> + return -1;
> + }
> + NEXT_ARG();
> + if (strlen(d))
> + duparg("dev", *argv);
> +
> + strncpy(d, *argv, sizeof(d)-1);
> + argc--;
> + argv++;
> + }
>
> break;
>
Powered by blists - more mailing lists