lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 28 Jul 2019 09:15:28 -0700 From: Stephen Hemminger <stephen@...workplumber.org> To: Michael Ziegler <ich@...haelziegler.name> Cc: netdev@...r.kernel.org Subject: Re: ip route JSON format is unparseable for "unreachable" routes On Sun, 28 Jul 2019 13:09:55 +0200 Michael Ziegler <ich@...haelziegler.name> wrote: > Hi, > > I created a couple "unreachable" routes on one of my systems, like such: > > > ip route add unreachable 10.0.0.0/8 metric 255 > > ip route add unreachable 192.168.0.0/16 metric 255 > > Unfortunately this results in unparseable JSON output from "ip": > > > # ip -j route show | jq . > > parse error: Objects must consist of key:value pairs at line 1, column 84 > > The offending JSON objects are these: > > > {"unreachable","dst":"10.0.0.0/8","metric":255,"flags":[]} > > {"unreachable","dst":"192.168.0.0/16","metric":255,"flags":[]} > "unreachable" cannot appear on its own here, it needs to be some kind of > field. > > The manpage says to report here, thus I do :) I've searched the > archives, but I wasn't able to find any existing bug reports about this. > I'm running version > > > ip utility, iproute2-ss190107 > > on Debian Buster. > > Regards, > Michael. Already fixed upstream by: commit 073661773872709518d35d4d093f3a715281f21d Author: Matteo Croce <mcroce@...hat.com> Date: Mon Mar 18 18:19:29 2019 +0100 ip route: print route type in JSON output 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> Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
Powered by blists - more mailing lists