Hi all,
2011/11/5 馬克泡 <[email protected]>:
> Hi all,
>
>>>> Your question should be directed to whoever maintains
>>>> /usr/share/udhcpc/default.script file on your machine / distribution.
>>>> It is not coming from busybox.
>>>
>>> Oh. Sorry, I though the script comes with busybox.
>>> It's sorry to waste your time but it helped!
>>> I'll both report to ubuntu and report to openwrt.
>>
>> Can you post the default.script file from the machine where it happens?
About the embedded system running OpenWrt I've send a patch.
The following is essential part of the patch.
--- a/package/base-files-network/files/usr/share/udhcpc/default.script
+++ b/package/base-files-network/files/usr/share/udhcpc/default.script
@@ -48,6 +48,11 @@ setup_interface () {
change_state network "$ifc" ipaddr "$ip"
change_state network "$ifc" broadcast "${broadcast:-+}"
change_state network "$ifc" netmask "${subnet:-255.255.255.0}"
+
+ [ -n "router" ] && [ "${subnet-255.255.255.0}" =
"255.255.255.255" ] && {
+ echo "udhcpc: setting direct route of $interface"
+ route add -net $router netmask
${subnet:-255.255.255.0} dev $interface
+ }
The origin implementation is of setting up default gw and the ip of
interface is...
/usr/share/udhcpc/default.script
setup_interface () {
local old_ip
local old_broadcast
local old_subnet
local old_router
local old_dns
local user_dns
local user_router
local user_metric
[ -n "$ifc" ] && {
old_ip="$(uci_get_state network "$ifc" ipaddr)"
old_broadcast="$(uci_get_state network "$ifc" broadcast)"
old_subnet="$(uci_get_state network "$ifc" netmask)"
}
[ "$ip" != "$old_ip" ] \
|| [ "${broadcast:-+}" != "$old_broadcast" ] \
|| [ "${subnet:-255.255.255.0}" != "$old_subnet" ] && {
# print the debug mesage
echo "udhcpc: ifconfig $interface $ip netmask
${subnet:-255.255.255.0} broadcast ${broadcast:-+}"
ifconfig $interface $ip netmask
${subnet:-255.255.255.0} broadcast ${broadcast:-+}
[snip]
# Default Route
[ -n "$ifc" ] && {
change_state network "$ifc" lease_gateway "$router"
old_router="$(uci_get_state network "$ifc" gateway)"
user_router="$(uci_get network "$ifc" gateway)"
user_metric="$(uci_get network "$ifc" metric)"
[ -n "$user_router" ] && router="$user_router"
}
[ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router"
!= "255.255.255.255" ] && [ "$router" != "$old_router" ] && {
echo "udhcpc: setting default routers: $router"
local valid_gw=""
for i in $router ; do
route add default gw $i ${user_metric:+metric
$user_metric} dev $interface
--
Best regards,
Macpaul Lin
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox