netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 v2 0/3] iptnl/tunnel: Open JSON section, kill code duplication and print iptnl mode
@ 2018-01-02 21:27 Serhey Popovych
  2018-01-02 21:27 ` [PATCH iproute2 v2 1/3] link_iptnl: Kill code duplication Serhey Popovych
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Serhey Popovych @ 2018-01-02 21:27 UTC (permalink / raw)
  To: netdev

In this series I present following improvements and fixes:

  1) Add missing open_json_context() to link_iptnl.c
     for "encap" options.

  2) Get rid of code duplication when parsing tunnel mode
     parameters in link_iptnl.c.

  3) Add code to link_iptnl.c to print tunnel mode to be
     inline with ip6tnl.

See individual patch description message for details.

This is v2. Fixed proto value for ipip tunnel mode:
"proto ipip" vs "proto ip4ip4" previously.

Thanks,
Serhii

Serhey Popovych (3):
  link_iptnl: Kill code duplication
  link_iptnl: Print tunnel mode
  link_iptnl: Open "encap" JSON object

 ip/link_iptnl.c |   45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH iproute2 2/3] link_iptnl: Print tunnel mode
@ 2018-01-02 19:54 Stephen Hemminger
  2018-01-02 21:02 ` [PATCH iproute2 v2 " Serhey Popovych
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2018-01-02 19:54 UTC (permalink / raw)
  To: Serhey Popovych; +Cc: netdev

On Tue,  2 Jan 2018 17:29:18 +0200
Serhey Popovych <serhe.popovych@gmail.com> wrote:

> Tunnel mode does not appear in parameters print for iptnl
> supported tunnels like ipip and sit, while printed for
> ip6tnl.
> 
> Print tunnel mode with "proto" field for JSON and without
> any name when printing to cli to follow ip6tnl behaviour.
> 
> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> ---
>  ip/link_iptnl.c |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c
> index d4d935b..afd1696 100644
> --- a/ip/link_iptnl.c
> +++ b/ip/link_iptnl.c
> @@ -372,6 +372,23 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
>  	if (tb[IFLA_IPTUN_COLLECT_METADATA])
>  		print_bool(PRINT_ANY, "external", "external ", true);
>  
> +	if (tb[IFLA_IPTUN_PROTO]) {
> +		switch (rta_getattr_u8(tb[IFLA_IPTUN_PROTO])) {
> +		case IPPROTO_IPIP:
> +			print_string(PRINT_ANY, "proto", "%s ", "ip4ip4");
> +			break;
> +		case IPPROTO_IPV6:
> +			print_string(PRINT_ANY, "proto", "%s ", "ip6ip");
> +			break;
> +		case IPPROTO_MPLS:
> +			print_string(PRINT_ANY, "proto", "%s ", "mplsip");
> +			break;
> +		case 0:
> +			print_string(PRINT_ANY, "proto", "%s ", "any");
> +			break;
> +		}
> +	}
> +
>  	if (tb[IFLA_IPTUN_REMOTE]) {
>  		unsigned int addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]);
>  

In iproute2 utilities the output format must match the input format.
I don't see "proto ip4ip4" as a valid option.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-06  0:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 21:27 [PATCH iproute2 v2 0/3] iptnl/tunnel: Open JSON section, kill code duplication and print iptnl mode Serhey Popovych
2018-01-02 21:27 ` [PATCH iproute2 v2 1/3] link_iptnl: Kill code duplication Serhey Popovych
2018-01-02 21:27 ` [PATCH iproute2 v2 2/3] link_iptnl: Print tunnel mode Serhey Popovych
2018-01-06  0:36   ` Stephen Hemminger
2018-01-02 21:27 ` [PATCH iproute2 v2 3/3] link_iptnl: Open "encap" JSON object Serhey Popovych
  -- strict thread matches above, loose matches on Subject: below --
2018-01-02 19:54 [PATCH iproute2 2/3] link_iptnl: Print tunnel mode Stephen Hemminger
2018-01-02 21:02 ` [PATCH iproute2 v2 " Serhey Popovych
2018-01-02 21:13   ` Stephen Hemminger
2018-01-02 21:29     ` Serhey Popovych

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).