| Summary: | ip: RTNETLINK answers: Invalid argument | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Neil MacLeod <busybox> |
| Component: | Networking | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | busybox-cvs, busybox |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: |
OpenVPN working log
OpenVPN not working log |
||
|
Description
Neil MacLeod
2016-08-06 03:59:07 UTC
Created attachment 6586 [details]
OpenVPN not working log
The problem seems to be this part of the change: https://github.com/mirror/busybox/commit/ce4bc1ed048233e89ee4cb95830bf6f01d523d1e#diff-17b20e94edc19bc0556a07b3f860041eR365 + if (RT_SCOPE_UNIVERSE != 0) + req.r.rtm_scope = RT_SCOPE_UNIVERSE; On Linux, RT_SCOPE_UNIVERSE is 0 so req.r.rtm_scope is never assigned a usable value unless it comes from the command line (ie. "scope 0"). If req.r.rtm_scope is not assigned a value then a default value of 255 (RT_SCOPE_NOWHERE) is used. Remove the "if" condition so that req.r.rtm_scope is set unconditionally and the problems reported in this bug are resolved. If the "scope 0" argument is added on the command line then there is also no problem, however third party programs such as OpenVPN don't supply the scope argument so they fail with Busybox 1.25.0. Presumably the default scope should be "scope 0" but that's not working after this change, and "scope #" is now mandatory which is a major break in terms of compatibility. diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index e674e9a..8d83b1f 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -364,7 +364,7 @@ IF_FEATURE_IP_RULE(ARG_table,)
if (cmd != RTM_DELROUTE) {
if (RTPROT_BOOT != 0)
req.r.rtm_protocol = RTPROT_BOOT;
- if (RT_SCOPE_UNIVERSE != 0)
+ if (RT_SCOPE_UNIVERSE != 0 || req.r.rtm_scope == RT_SCOPE_NOWHERE)
req.r.rtm_scope = RT_SCOPE_UNIVERSE;
if (RTN_UNICAST != 0)
req.r.rtm_type = RTN_UNICAST;
also works fine.
Alternatively the problem might here: https://github.com/mirror/busybox/commit/ce4bc1ed048233e89ee4cb95830bf6f01d523d1e#diff-17b20e94edc19bc0556a07b3f860041eR484 Using the example "route add" commands, in the "if (!scope_ok) {" block req.r.rtm_type is RTN_UNICAST while req.r.rtm_scope is RT_SCOPE_NOWHERE, which means the code falls through to https://github.com/mirror/busybox/commit/ce4bc1ed048233e89ee4cb95830bf6f01d523d1e#diff-17b20e94edc19bc0556a07b3f860041eR497 which fails as "(!(ok & gw_ok))" is not true, so req.r.rtm_scope remains set to RT_SCOPE_NOWHERE. The following patch works for me, I've but no idea if this is what is needed for others. diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index e674e9a..42f8bda 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -498,6 +498,8 @@ IF_FEATURE_IP_RULE(ARG_table,) req.r.rtm_scope = RT_SCOPE_NOWHERE; else if (!(ok & gw_ok)) req.r.rtm_scope = RT_SCOPE_LINK; + else + req.r.rtm_scope = RT_SCOPE_UNIVERSE; } } Fixed in git. |