]> git.ipfire.org Git - thirdparty/iproute2.git/commit
iproute_lwtunnel: fix JSON output
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Apr 2023 19:42:48 +0000 (12:42 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Apr 2023 19:42:48 +0000 (12:42 -0700)
commit0f32ef97babcbe77140a69218917937e6a50fb6c
treea2275d08a6883b8fb61ccdfff5da85513d3c01e4
parentf5db8310e9391b8768f9452f8e6ed34065f1af5e
iproute_lwtunnel: fix JSON output

The same tag "dst" was being used for both the route destination
and the encap destination. This made it hard for JSON parsers.
Change to put the per-encap information under a nested JSON
object (similar to ip link type info).

Original output
[ {
        "dst": "192.168.11.0/24",
        "encap": "ip6",
        "id": 0,
        "src": "::",
        "dst": "fd00::c0a8:2dd",
        "hoplimit": 0,
        "tc": 0,
        "protocol": "5",
        "scope": "link",
        "flags": [ ]
    } ]

Revised output
[ {
        "dst": "192.168.11.0/24",
        "encap": {
            "encap_type": "ip6",
            "id": 0,
            "src": "::",
            "dst": "fd00::c0a8:2dd",
            "hoplimit": 0,
            "tc": 0
        },
        "protocol": "5",
        "scope": "link",
        "flags": [ ]
    } ]

Reported-by: Lars Ekman <uablrek@gmail.com>
Fixes: 663c3cb23103 ("iproute: implement JSON and color output")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/iproute_lwtunnel.c