[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230414082103.1b7c0d82@hermes.local>
Date: Fri, 14 Apr 2023 08:21:03 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Lars Ekman <uablrek@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: iproute2 bug in json output for encap
On Fri, 14 Apr 2023 10:29:15 +0200
Lars Ekman <uablrek@...il.com> wrote:
> The destination is lost in json printout and replaced by the encap
> destination. The destination can even be ipv6 for an ipv4 route.
>
> Example:
>
> vm-002 ~ # ip route add 10.0.0.0/24 proto 5 dev ip6tnl6 encap ip6 dst
> fd00::192.168.2.221
> vm-002 ~ # ip route show proto 5
> 10.0.0.0/24 encap ip6 id 0 src :: dst fd00::c0a8:2dd hoplimit 0 tc 0
> dev ip6tnl6 scope link
> vm-002 ~ # ip -j route show proto 5 | jq
> [
> {
> "dst": "fd00::c0a8:2dd",
> "encap": "ip6",
> "id": 0,
> "src": "::",
> "hoplimit": 0,
> "tc": 0,
> "dev": "ip6tnl6",
> "scope": "link",
> "flags": []
> }
> ]
>
Both JSON and regular output show the same address which is coming from
the kernel. I.e not a JSON problem. Also, you don't need to use jq
ip has -p flag to pretty print.
I can not reproduce this with current kernel and iproute2.
# ip route add 192.168.11.0/24 proto 5 dev dummy0 encap ip6 dst fd00::192.168.2.221
# ip route show proto 5
192.168.11.0/24 encap ip6 id 0 src :: dst fd00::c0a8:2dd hoplimit 0 tc 0 dev dummy0 scope link
# ip -j -p route show proto 5
[ {
"dst": "192.168.11.0/24",
"encap": "ip6",
"id": 0,
"src": "::",
"dst": "fd00::c0a8:2dd",
"hoplimit": 0,
"tc": 0,
"dev": "dummy0",
"scope": "link",
"flags": [ ]
} ]
# ip -V
ip utility, iproute2-6.1.0, libbpf 1.1.0
# uname -r
6.1.0-7-amd64
Powered by blists - more mailing lists