]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip: fix ip route show json output for multipath nexthops
authorJulien Fortin <julien@cumulusnetworks.com>
Thu, 26 Sep 2019 15:29:34 +0000 (17:29 +0200)
committerDavid Ahern <dsahern@gmail.com>
Tue, 1 Oct 2019 14:59:47 +0000 (07:59 -0700)
commit4ecefff3cf250c1e4499dff14c80ed38bec6d7de
tree36ba8fbf967bdad2f31782df2ccdbe997f7925a4
parent8c2093e5d20cb36b564ce229595b2e76e07cc30b
ip: fix ip route show json output for multipath nexthops

print_rta_multipath doesn't support JSON output:

{
    "dst":"27.0.0.13",
    "protocol":"bgp",
    "metric":20,
    "flags":[],
    "gateway":"169.254.0.1"dev uplink-1 weight 1 ,
    "flags":["onlink"],
    "gateway":"169.254.0.1"dev uplink-2 weight 1 ,
    "flags":["onlink"]
},

since RTA_MULTIPATH has nested objects we should print them
in a json array.

With the path we have the following output:

{
    "flags": [],
    "dst": "36.0.0.13",
    "protocol": "bgp",
    "metric": 20,
    "nexthops": [
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-1"
        },
        {
            "weight": 1,
            "flags": [
                "onlink"
            ],
            "gateway": "169.254.0.1",
            "dev": "uplink-2"
        }
    ]
}

Fixes: 663c3cb23103f4 ("iproute: implement JSON and color output")
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/iproute.c