udhcp and busybox

Rob Landley rob at landley.net
Tue Mar 28 23:28:14 UTC 2006


On Tuesday 28 March 2006 5:38 pm, Devin Bayer wrote:
> Rob Landley wrote:
> > On Monday 27 March 2006 5:04 pm, Devin Bayer wrote:
> >>>Even the common case of a router wouldn't need this, because you only
> >>> run the dhcp _client_ on one interface.
> >>
> >>In the common case of a router, you do need this. If you have a running
> >>system with a gateway and then run udhcpc, it'll create two gateways and
> >>knock your system off all the networks.
> >>
> >>Well, that's all I have to say; I won't argue anymore.
> >
> > It must remove the existing default gateway (if any) when adding a new
> > default gateway, yes.  Since you can only have one default gateway (this
> > would be what "default" means), the route command should do this for a
> > "route add default gw" invocation.
>
> OK, that's good. It works.  FYI, it differs from the net-tools route
> behavior. Just to be clear, you are saying the new udhcpc will use the
> route command?

Quite likely.  Add a dependency and do run_applet_by_name(), or some such.  
(Possibly break out the standalone shell code that does a fallback to the 
command shell, an stick it in libbb or some such.  I want it to work with 
"make standalone", but am not particularly disturbed by it shelling out to 
ifconfig in that case.)

I could also try to glue in the networking/libiproute stuff, but I just looked 
at it and it's really ugly.

> Here is my patch to route.  Before adding a gateway, it deletes all other
> gateways with the same target network. Tested in linux 2.6.11.
>
>    text    data     bss     dec     hex filename
>    2255       0       0    2255     8cf networking/route-orig.o
>    2255       0       0    2255     8cf networking/route-new.o
>    2466       0       0    2466     9a2 networking/route-nodupes.o

Huh, I thought we currently did this.  Adding size for it isn't good.  I need 
to take a closer look at this.  (We're arguing about behavior I haven't 
implemented yet, and so obviously I haven't tested it yet either...)

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list