All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars Ekman <uablrek@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: iproute2 bug in json output for encap
Date: Fri, 14 Apr 2023 18:12:06 +0200	[thread overview]
Message-ID: <cf099564-2b3c-e525-82cd-2d8065ba7fb3@gmail.com> (raw)
In-Reply-To: <20230414082103.1b7c0d82@hermes.local>

Hi,

Thanks for the reply. You are right, it is jq that eats one ot the
double "dst" items.

vm-002 ~ # 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": [ ]
    } ]
vm-002 ~ # ip -j -p route show proto 5 | jq
[
  {
    "dst": "fd00::c0a8:2dd",
    "encap": "ip6",
    "id": 0,
    "src": "::",
    "hoplimit": 0,
    "tc": 0,
    "dev": "dummy0",
    "scope": "link",
    "flags": []
  }
]

Sorry for the fuss.

Best Regards,

Lars Ekman


And btw I did upgrade *before* posting :-)

vm-002 ~ # ip -V
ip utility, iproute2-6.2.0, libbpf 1.1.0
vm-002 ~ # uname -r
6.2.7



On 2023-04-14 17:21, Stephen Hemminger wrote:
> On Fri, 14 Apr 2023 10:29:15 +0200
> Lars Ekman <uablrek@gmail.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
>
>

  reply	other threads:[~2023-04-14 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14  8:29 iproute2 bug in json output for encap Lars Ekman
2023-04-14 15:21 ` Stephen Hemminger
2023-04-14 16:12   ` Lars Ekman [this message]
2023-04-14 16:26     ` Lars Ekman
2023-04-14 16:44       ` Stephen Hemminger
2023-04-14 17:01       ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf099564-2b3c-e525-82cd-2d8065ba7fb3@gmail.com \
    --to=uablrek@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.