udhcp and busybox
Devin Bayer
devin at freeshell.org
Sun Mar 26 20:58:01 PST 2006
On Mar 26, 2006, at 13:22, Rob Landley wrote:
> On Sunday 26 March 2006 3:22 pm, Devin Bayer wrote:
>>
>> If you do what you suggest and set a gateway when another is already
>> set, you'll bork the whole system.
>
> I do it all the time, actually, and the tools I'm using delete the old
> gateway. I can ifconfig the interface down first to be sure, though.
>
> If somebody runs a dhcp client on eth0 and another one on eth1,
> they'll
> probably need a script. That's not my problem.
Well that's tough to overcome. What if I make it a config option?
Essentially to support multiple network interfaces one needs to do:
while(0 == ioctl(SIOCDELRT)) /* loop */;
before the SIOCADDRT. It would also apply to ifup. Untested, this
should give you a better idea what I need:
Index: ifupdown.c
===================================================================
--- ifupdown.c (revision 14662)
+++ ifupdown.c (working copy)
@@ -382,6 +382,7 @@
#else
result = execute("ifconfig %iface% [[media %media%]] [[hw %
hwaddress%]] [[mtu %mtu%]] up", ifd, exec);
result += execute("ifconfig %iface% add %address%/%netmask
%", ifd, exec);
+ execute("route -A inet6 del ::/0", ifd, exec);
result += execute("[[ route -A inet6 add ::/0 gw %gateway
% ]]", ifd, exec);
#endif
return ((result == 3) ? 3 : 0);
@@ -468,6 +469,7 @@
"[[broadcast %broadcast%]]
[[pointopoint %pointopoint%]] "
"[[media %media%]] [[mtu %mtu%]]
[[hw %hwaddress%]] up",
ifd, exec);
+ execute("route del default", ifd, exec);
result += execute("[[ route add default gw %gateway% %iface
% ]]", ifd, exec);
return ((result == 2) ? 2 : 0);
#endif
--
Devin Bayer
More information about the busybox
mailing list