Hi, I've noticed that the route was not correctly set. Where all "route" commands set this route with the destination netmask (Genmask) to 0.0.0.0, toolbox's route was setting the netmask as 255.255.255.255 which made the network unreachable.
Applying the attached patch, I have a working route, and now all the traffic is correctly redirected through my network interface. Is this patch crazy? Why it was written setting the netmask as if it were for a specific host instead of a network? If it's ok, I'll send it to gerrit to be included. Kind regards, On Wed, May 6, 2009 at 5:45 PM, Daniel Baeyens <dbaey...@warp.es> wrote: > Hi, > > I'm trying to set up a default gateway through a network interface. > I've set up my device (netcfg <my_dev> up && ifconfig <my_dev> <ip>), > and then I have tried to: > > route add default dev <my_dev> > > If i launch "dumpstate", I can see the routes table, and indeed this > route is show, but if I try to make ping or a network connection, I > get a "Network is unreachable" error. > > Am I doing something wrong? How could I do this? > > Thank you! > Kind regards, > -- > Daniel Baeyens > Warp Networks S.L. - http://www.warp.es > -- Daniel Baeyens Warp Networks S.L. - http://www.warp.es --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
diff --git a/toolbox/route.c b/toolbox/route.c index adf5c69..6eff4b0 100644 --- a/toolbox/route.c +++ b/toolbox/route.c @@ -66,7 +66,7 @@ int route_main(int argc, char *argv[]) rt.rt_dst.sa_family = AF_INET; if(!strcmp(argv[0], "dev")) { EXPECT_NEXT(argc, argv); - rt.rt_flags = RTF_UP | RTF_HOST; + rt.rt_flags = RTF_UP; rt.rt_dev = argv[0]; if (ioctl(s, SIOCADDRT, &rt) < 0) die("SIOCADDRT"); }else if(!strcmp(argv[0], "gw")) {