[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170427164647.3f0e09bf@xeon-e3>
Date: Thu, 27 Apr 2017 16:46:47 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Michal Kubecek <mkubecek@...e.cz>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] routel: fix infinite loop in line parser
On Thu, 27 Apr 2017 11:43:47 +0200 (CEST)
Michal Kubecek <mkubecek@...e.cz> wrote:
> As noticed by one of the few users of routel script, it ends up in an
> infinite loop when they pull out the cable from the NIC used for some
> route. This is caused by its parser expecting the line of "ip route show"
> output consists of "key value" pairs (except for the initial target range),
> together with an old trap of Bourne style shells that "shift 2" does
> nothing if there is only one argument left. Some keywords, e.g. "linkdown",
> are not followed by a value.
>
> Improve the parser to
>
> (1) only set variables for keywords we care about
> (2) recognize (currently) known keywords without value
>
> This is still far from perfect (and certainly not future proof) but to
> fully fix the script, one would probably have to rewrite the logic
> completely (and I'm not sure it's worth the effort).
>
> Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
Appled, but this really needs to be done better.
Either as a simplified output of route command. See ip -br link
Or ip route should have a json output option and use python/perl/xss
to reformat.
Powered by blists - more mailing lists