]> git.ipfire.org Git - thirdparty/iproute2.git/commit
iplink: Add JSON support to MPLS stats formatter
authorPetr Machata <petrm@nvidia.com>
Mon, 9 May 2022 13:59:57 +0000 (15:59 +0200)
committerDavid Ahern <dsahern@kernel.org>
Thu, 12 May 2022 17:08:13 +0000 (11:08 -0600)
commit2ed73b9a80d8291359d477caafab5defca113c58
tree34e759d3300a7baa7ff0a9b7004c99cca9c9e035
parent5ed8fd9d514422771d283607fac523d8baef1179
iplink: Add JSON support to MPLS stats formatter

MPLS stats currently do not support dumping in JSON format. Recognize when
JSON is requested and dump in an obvious manner:

 # ip -n ns0-2G8Ozd9z -j stats show dev veth01 group afstats | jq
 [
   {
     "ifindex": 3,
     "ifname": "veth01",
     "group": "afstats",
     "subgroup": "mpls",
     "mpls_stats": {
       "rx": {
         "bytes": 0,
         "packets": 0,
         "errors": 0,
         "dropped": 0,
         "noroute": 0
       },
       "tx": {
         "bytes": 216,
         "packets": 2,
         "errors": 0,
         "dropped": 0
       }
     }
   }
 ]

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/iplink.c