All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: stephen@networkplumber.org, netdev@vger.kernel.org
Subject: Re: [iproute2 PATCH v2 1/1] tc simple action update and breakage
Date: Tue, 24 May 2016 00:39:19 +0200	[thread overview]
Message-ID: <57438697.8030801@iogearbox.net> (raw)
In-Reply-To: <1462719726-7598-1-git-send-email-jhs@emojatatu.com>

On 05/08/2016 05:02 PM, Jamal Hadi Salim wrote:
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> Brings it closer to more serious actions (adding branching
> and allowing for late binding)
>
> Unfortunately this breaks old syntax of the simple action.
> But because simple is a pedagogical example unlikely to be used
> in production environments (i.e its role is to serve as an example
> on how to write actions), then this is ok.
>
> New syntax for simple has new keyword "sdata". Example usage is:
>
> sudo tc actions add action simple sdata "foobar" index 1
> or
> tc filter add dev $DEV parent ffff: protocol ip prio 1 u32\
> match ip dst 17.0.0.1/32 flowid 1:10 action simple sdata "foobar"
>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
[...]

>   static void usage(void)
> @@ -99,56 +100,85 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
>   	struct tc_defact sel = {};
>   	int argc = *argc_p;
>   	char **argv = *argv_p;
> -	int ok = 0;
> +	int ok = 0, maybe_bind = 0;
>   	struct rtattr *tail;
>   	char *simpdata = NULL;
>
[...]

>   	if (argc) {
>   		if (matches(*argv, "index") == 0) {
>   			NEXT_ARG();
>   			if (get_u32(&sel.index, *argv, 10)) {
> -				fprintf(stderr, "simple: Illegal \"index\"\n");
> +				fprintf(stderr, "simple: Illegal \"index\"\n",
> +					*argv);
>   				return -1;
>   			}

Btw, this causes:

m_simple.c: In function ‘parse_simple’:
m_simple.c:154:6: warning: too many arguments for format [-Wformat-extra-args]
       *argv);
       ^
m_simple.c:103:14: warning: unused variable ‘maybe_bind’ [-Wunused-variable]
   int ok = 0, maybe_bind = 0;
               ^

  reply	other threads:[~2016-05-23 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08 15:02 [iproute2 PATCH v2 1/1] tc simple action update and breakage Jamal Hadi Salim
2016-05-23 22:39 ` Daniel Borkmann [this message]
2016-05-24  0:59   ` Jamal Hadi Salim

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=57438697.8030801@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=jhs@mojatatu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.