netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian Pössinger" <christian@poessinger.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: iproute2 ERSPAN version 2 JSON output shows valueless key
Date: Tue, 6 Apr 2021 08:07:28 +0000	[thread overview]
Message-ID: <3ac544c09842410fb863b332917a03ad@poessinger.com> (raw)

Dear Maintainers,

I am new to the reporting process for iproute2 thus please bear with me.

I am playing around with ERSPAN version 2 and noticed a valueless key on the
JSON output for iproute2. When creating an ERSPAN interface using the following
command:

$ ip link add dev myerspan type erspan seq key 30 local 192.168.1.4 \
  remote 192.168.1.1 erspan_ver 2 erspan_dir ingres
   
The interface is created - as expected - and also the information can be read
back in "human readable" format by:


$ ip -d link show myerspan
211: myerspan@NONE: <BROADCAST,MULTICAST> mtu 1460 qdisc noop state DOWN mode DEFAULT
    group default qlen 1000
    link/ether b6:e5:28:78:fa:54 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 0
    erspan remote 192.168.1.1 local 192.168.1.4 ttl inherit ikey 0.0.0.30 okey
	0.0.0.30 iseq oseq erspan_ver 2 erspan_dir ingress erspan_hwid 0 addrgenmode
	none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535


This proper lists the key/value pair of "erspan_dir ingress".

When now switching to JSON output mode, the "erspan_dir" key won't have a
value. Output has been stripped to only contain the relevant keys in this structure:

$ ip -d -j link show myerspan
[{... "erspan_ver":2,"erspan_dir":"erspan_hwid":"0" ... }]

Both erspan_ver and erspan_hwid are populated with the proper values, but 
erspan_dir is a valueless key which will break most JSON parses (e.g. the one
from Python)

I have tested this with the following iproute2 versions:

iproute2-5.11.0
iproute2-5.9.0

If you can point me to the location which could be responsible for this issue,
I am happy to submit a fix to the net tree.

Thanks in advance,
Christian Poessinger

             reply	other threads:[~2021-04-06  8:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  8:07 Christian Pössinger [this message]
2021-04-06 16:28 ` [PATCH iproute2] erspan: fix JSON output Stephen Hemminger
2021-04-06 16:40   ` William Tu
2021-04-09 10:49   ` [PATCH] erspan/erspan6: " Christian Poessinger
2021-04-12 16:35     ` William Tu

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=3ac544c09842410fb863b332917a03ad@poessinger.com \
    --to=christian@poessinger.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).