summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-04-11 16:23:57 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-04-11 16:23:57 +0000
commit12c96a64a4b7ab75cb0e4a7dfde8960c4391b2a8 (patch)
tree821458424798193ed98a8884d5448a895920bff8 /networking
parent0d058361e722757af84fefdf1b1b8eac7ba53fc0 (diff)
downloadbusybox-w32-12c96a64a4b7ab75cb0e4a7dfde8960c4391b2a8.tar.gz
busybox-w32-12c96a64a4b7ab75cb0e4a7dfde8960c4391b2a8.tar.bz2
busybox-w32-12c96a64a4b7ab75cb0e4a7dfde8960c4391b2a8.zip
- set the scope properly. Thanks to Jean Wolter, who wrote:
busybox ip and the original ip utility behave differently when setting the following route (verified with ip route show using the original ip utility): ip route add 10.0.0.138 dev eth0 Result for busybox ip: # ip route add 10.0.0.138 dev eth0 # /usr/local/bin/ip route show 10.0.0.138 dev eth0 Result for ip: # /usr/local/bin/ip route add 10.0.0.138 dev eth0 # /usr/local/bin/ip route show 10.0.0.138 dev eth0 scope link A following "ip route add default via 10.0.0.138" fails for busybox ip, since the kernel can not find a route to 10.0.0.138 (it replies with Network is unreachable). The reasons seems to be that the original ip utility explicitly sets the scope after parsing all parameters. This is missing in busybox, the attached patch fixes this. I took this from the original iproute sources and removed some variables, which are not needed for busybox.
Diffstat (limited to 'networking')
-rw-r--r--networking/libiproute/iproute.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index bb0bfaed1..a19586c91 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -434,6 +434,18 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
434 } 434 }
435 addattr_l(&req.n, sizeof(req), RTA_METRICS, RTA_DATA(mxrta), RTA_PAYLOAD(mxrta)); 435 addattr_l(&req.n, sizeof(req), RTA_METRICS, RTA_DATA(mxrta), RTA_PAYLOAD(mxrta));
436 } 436 }
437 if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT)
438 req.r.rtm_scope = RT_SCOPE_HOST;
439 else if (req.r.rtm_type == RTN_BROADCAST ||
440 req.r.rtm_type == RTN_MULTICAST ||
441 req.r.rtm_type == RTN_ANYCAST)
442 req.r.rtm_scope = RT_SCOPE_LINK;
443 else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) {
444 if (cmd == RTM_DELROUTE)
445 req.r.rtm_scope = RT_SCOPE_NOWHERE;
446 else if (!gw_ok)
447 req.r.rtm_scope = RT_SCOPE_LINK;
448 }
437 449
438 if (req.r.rtm_family == AF_UNSPEC) { 450 if (req.r.rtm_family == AF_UNSPEC) {
439 req.r.rtm_family = AF_INET; 451 req.r.rtm_family = AF_INET;