Netdev List
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Victor Nogueira <victor@mojatatu.com>,
	stephen@networkplumber.org, netdev@vger.kernel.org
Cc: kernel@mojatatu.com
Subject: Re: [PATCH iproute2-next] m_mirred: Allow mirred to block
Date: Tue, 23 Jan 2024 11:17:53 -0700	[thread overview]
Message-ID: <158eaf99-1018-4ef6-bfdf-5f86464aae83@kernel.org> (raw)
In-Reply-To: <20240123161115.69729-1-victor@mojatatu.com>

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;
>  


  parent reply	other threads:[~2024-01-23 18:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 16:11 [PATCH iproute2-next] m_mirred: Allow mirred to block Victor Nogueira
2024-01-23 17:18 ` Stephen Hemminger
2024-01-23 17:32   ` Victor Nogueira
2024-01-23 18:17 ` David Ahern [this message]
2024-01-23 21:41   ` Victor Nogueira

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=158eaf99-1018-4ef6-bfdf-5f86464aae83@kernel.org \
    --to=dsahern@kernel.org \
    --cc=kernel@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=victor@mojatatu.com \
    /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