[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190319152410.4fec3fb0@shemminger-XPS-13-9360>
Date: Tue, 19 Mar 2019 15:24:10 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Matteo Croce <mcroce@...hat.com>
Cc: netdev@...r.kernel.org, Phil Sutter <phil@....cc>,
Andrea Claudi <aclaudi@...hat.com>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH iproute2 1/2] ip route: print route type in JSON output
On Mon, 18 Mar 2019 18:19:29 +0100
Matteo Croce <mcroce@...hat.com> wrote:
> ip route generates an invalid JSON if the route type has to be printed,
> eg. when detailed mode is active, or the type is different that unicast:
>
> $ ip -d -j -p route show
> [ {"unicast",
> "dst": "192.168.122.0/24",
> "dev": "virbr0",
> "protocol": "kernel",
> "scope": "link",
> "prefsrc": "192.168.122.1",
> "flags": [ "linkdown" ]
> } ]
>
> $ ip -j -p route show
> [ {"unreachable",
> "dst": "192.168.23.0/24",
> "flags": [ ]
> },{"prohibit",
> "dst": "192.168.24.0/24",
> "flags": [ ]
> },{"blackhole",
> "dst": "192.168.25.0/24",
> "flags": [ ]
> } ]
>
> Fix it by printing the route type as the "type" attribute:
>
> $ ip -d -j -p route show
> [ {
> "type": "unicast",
> "dst": "default",
> "gateway": "192.168.85.1",
> "dev": "wlp3s0",
> "protocol": "dhcp",
> "scope": "global",
> "metric": 600,
> "flags": [ ]
> },{
> "type": "unreachable",
> "dst": "192.168.23.0/24",
> "protocol": "boot",
> "scope": "global",
> "flags": [ ]
> },{
> "type": "prohibit",
> "dst": "192.168.24.0/24",
> "protocol": "boot",
> "scope": "global",
> "flags": [ ]
> },{
> "type": "blackhole",
> "dst": "192.168.25.0/24",
> "protocol": "boot",
> "scope": "global",
> "flags": [ ]
> } ]
>
> Fixes: 663c3cb23103 ("iproute: implement JSON and color output")
> Acked-by: Phil Sutter <phil@....cc>
> Reviewed-and-tested-by: Andrea Claudi <aclaudi@...hat.com>
> Signed-off-by: Matteo Croce <mcroce@...hat.com>
Applied both of these just before tagging 5.0
Powered by blists - more mailing lists