ip route add bug in 1.25.0
Timo Teras
timo.teras at iki.fi
Fri Aug 5 16:14:16 UTC 2016
On Fri, 05 Aug 2016 16:29:30 +0100
Ron Yorston <rmy at pobox.com> wrote:
> Ron Yorston wrote:
> >Natanael Copa wrote:
> >>$ sudo busybox ip route add 192.168.0.0/24 via 10.98.106.9 dev wlan0
> >>ip: RTNETLINK answers: Invalid argument
> >
> >Reverting ce4bc1ed (iproute: support "scope". Closes 8561) seems to
> >make the problem go away.
>
> Specifically, this change causes the problem:
>
> - req.r.rtm_scope = RT_SCOPE_UNIVERSE;
> + if (RT_SCOPE_UNIVERSE != 0)
> + req.r.rtm_scope = RT_SCOPE_UNIVERSE;
>
> RT_SCOPE_UNIVERSE is zero, so req.r.rtm_scope isn't being initialised.
>
> There are a number of similar constructs in this code, where the value
> of an enum is tested against zero. I've no idea why.
Sounds like it's assuming the structure was previously initialized
to all zeroes, and it's intended as a micro optimization to avoid
writing zeroes again if the constant is zero.
Should probably just delete all those. Properly optimizing compiler
would handle that automatically.
More information about the busybox
mailing list