[RFC][UDHCPC][Suggestion] Is there possible to enable option 03 (DHCP_ROUTER) in busybox?

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 3 19:30:34 UTC 2011


On Thu, Nov 3, 2011 at 7:50 PM, 馬克泡 <macpaul at gmail.com> wrote:
> I'm developing a 4G (WiMAX/LTE) router with busybox.
> However, I've found a problem when I'm doing IOT connection with
> device provider and ISP.
> Some of the vendor will send the default gateway to the 4G interface,
> which should also be the WAN interface of the router as option "03".
> The option "03" is DHCP_ROUTER when I looked it up in networking/udhcp/common.h.
> How can I enable it in udhcpc so it can apply the option "03" as
> default gateway?
> Is there any code need to be fixed or complete in dhcpc.c in busybox?

Take a look at an example in busybox/examples/udhcp/simple.script

This part of code in that example uses value of option 3
(which is exposed as environment variable $router):

                if [ -n "$router" ] ; then
                        echo "Deleting routers"
                        while route del default gw 0.0.0.0 dev $interface ; do
                                :
                        done

                        metric=0
                        for i in $router ; do
                                echo "Adding router $i"
                                route add default gw $i dev $interface
metric $((metric++))
                        done
                fi


-- 
vda


More information about the busybox mailing list