[Toybox] Problems with route command argument parsing

Rob Landley rob at landley.net
Mon Nov 12 07:30:46 PST 2018



On 11/9/18 8:51 AM, Eduardas Meile wrote:
> Hello.
> 
> Perhaps you already know, but there are some issues with the pending route
> command argument parsing.

I was working to clean it up a while back and realized I need to completely
rewrite it based on the NETLINK_ROUTE api. See:

https://android.googlesource.com/platform/external/toybox/+/48e1f81151f6

So... complete rewrite coming. I just have a demanding dayjob these days that
has nothing to do with toybox.

I also need to figure out if I should convert ifconfig over to the new API,
because while you can assign multiple IPv4 addresses to interfaces via:

ifconfig eth0 1.2.3.4
ifconfig eth0:0 2.3.4.5
ifconfig eth0:1 3.4.5.6

Some people don't like that interface and want the multiple addresses obviously
on _eth0_, so the netlink API added a way to do that. This seems largely
cosmetic, but I'm not sure how it interacts with iptables rules? (And yes,
that's ALSO on my todo list although in the "post-1.0" bucket. According to
strace that's also a giant netlink API under the covers...)

I'd also like to get ipv4 and ipv6 handled by the same codepath if at all
possible...

> It seems this was noted quite some time ago on the mailing list:
> 
> http://lists.landley.net/htdig.cgi/toybox-landley.net/2017-August/009121.html

Yup. And bookmarked.

> This is still not fixed in the latest toybox release 0.7.8 or on the master branch.
> 
> The suggestion provided actually does solve my problem of setting the default
> gateway, but probably this is not the only fix required.
> 
> If one tries setting the interface like in "route add default gw 192.168.1.1 dev
> eth0", this won't get properly parsed either.

Test cases really help development, I'll add that one to the entry.

Almost all I ever personally do with route is "route add default gw 1.2.3.4".
The kernel adds routing entries for most interfaces automatically, so gateway's
usually the missing part for leaf nodes, and even non-backbone routers.

Rob



More information about the Toybox mailing list