iproute: problem parsing /etc/iproute2/rt_tables / tabs vs. spaces

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Feb 12 09:35:59 UTC 2016


On 12 February 2016 at 07:12, Bastian Bittorf <bittorf at bluebottle.com> wrote:
> OpenWrt switched to busybox's 'iproute2' applet:
>
> An user recognized that using spaces in
> /etc/iproute2/rt_tables will not work anymore
> (but used to work earlier):
>
> echo "50 test" >/etc/iproute2/rt_tables
> ip route show table test
>
> -> error

what error exactly?
What compiler are you using, what arch, what flags? which libc?
Does it go away if you enable CONFIG_DEBUG_PESSIMIZE, i.e. build
without optimizations?

The code in question accepts both space as well as tab as separator:

static void rtnl_tab_initialize(const char *file, const char **tab)
{
    char *token[2];
    char fullname[sizeof(CONFDIR"/rt_dsfield") + 8];
    parser_t *parser;

    sprintf(fullname, CONFDIR"/rt_%s", file);
    parser = config_open2(fullname, fopen_for_read);
    while (config_read(parser, token, 2, 2, "# \t", PARSE_NORMAL)) {

and that works fine for me also for space as record separator in rt_tables.

>
> TAB="   "
> echo "51${TAB}test1" >/etc/iproute2/rt_tables
>
> -> OK
>
> maybe this was introduced with
> 926d801fa51717b3af3faf33f9d686e92a20ecfd ?

no, shouldn't be.


More information about the busybox mailing list