netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Mathieu Xhonneux <m.xhonneux@gmail.com>
Cc: netdev@vger.kernel.org, dsahern@gmail.com, dlebrun@google.com
Subject: Re: [PATCH iproute2] ip: add support for seg6local End.BPF action
Date: Mon, 16 Jul 2018 07:48:48 -0700	[thread overview]
Message-ID: <20180716074848.07fc6bca@xeon-e3> (raw)
In-Reply-To: <20180716144741.20478-1-m.xhonneux@gmail.com>

On Mon, 16 Jul 2018 14:47:41 +0000
Mathieu Xhonneux <m.xhonneux@gmail.com> wrote:

> This patch adds support for the End.BPF action of the seg6local
> lightweight tunnel. Functions from the BPF lightweight tunnel are
> re-used in this patch. Example:
> 
> $ ip -6 route add fc00::18 encap seg6local action End.BPF obj my_bpf.o
> sec my_func dev eth0
> 
> $ ip -6 route show fc00::18
> fc00::18  encap seg6local action End.BPF my_bpf.o:[my_func] dev eth0
> metric 1024 pref medium
> 
> Signed-off-by: Mathieu Xhonneux <m.xhonneux@gmail.com>

> ---
>  ip/iproute_lwtunnel.c | 122 +++++++++++++++++++++++++++++---------------------
>  lib/bpf.c             |   5 +++
>  2 files changed, 77 insertions(+), 50 deletions(-)
> 
> diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
> index 46a212c8..71c3d8a4 100644
> --- a/ip/iproute_lwtunnel.c
> +++ b/ip/iproute_lwtunnel.c
> @@ -177,6 +177,7 @@ static const char *seg6_action_names[SEG6_LOCAL_ACTION_MAX + 1] = {
>  	[SEG6_LOCAL_ACTION_END_S]		= "End.S",
>  	[SEG6_LOCAL_ACTION_END_AS]		= "End.AS",
>  	[SEG6_LOCAL_ACTION_END_AM]		= "End.AM",
> +	[SEG6_LOCAL_ACTION_END_BPF]		= "End.BPF",
>  };
>  
>  static const char *format_action_type(int action)
> @@ -250,6 +251,15 @@ static void print_encap_seg6local(FILE *fp, struct rtattr *encap)
>  		print_string(PRINT_ANY, "oif",
>  			     "oif %s ", ll_index_to_name(oif));
>  	}
> +
> +	if (tb[SEG6_LOCAL_BPF]) {
> +		struct rtattr *tb_bpf[LWT_BPF_PROG_MAX+1];
> +
> +		parse_rtattr_nested(tb_bpf, LWT_BPF_PROG_MAX, tb[SEG6_LOCAL_BPF]);
> +
> +		if (tb_bpf[LWT_BPF_PROG_NAME])
> +			fprintf(fp, "%s ", rta_getattr_str(tb_bpf[LWT_BPF_PROG_NAME]));
> +	}
>  }

Please use print_string to support JSON output.

      parent reply	other threads:[~2018-07-16 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 14:47 [PATCH iproute2] ip: add support for seg6local End.BPF action Mathieu Xhonneux
2018-07-16 12:51 ` Mathieu Xhonneux
2018-07-16 14:48 ` Stephen Hemminger [this message]

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=20180716074848.07fc6bca@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dlebrun@google.com \
    --cc=dsahern@gmail.com \
    --cc=m.xhonneux@gmail.com \
    --cc=netdev@vger.kernel.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).