This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can I switch from DHCP mode to STATIC IP mode during run time to attain IP


In gmane.os.ecos.general, you wrote:

>> Can i change the mode from DHCP/BOOTP to Static mode uring run time.
>> 
>> My requirement is during runtime I want to Configure the
>> interface to a static IP, but at the same time I may need to
>> switch back to DHCP also(vise versa also). Does ecos supports
>> this switching?.

If you're allowed to re-boot when the mode is changed, it's
trivial.

> Looking at the source code is the easiest way to answer this
> question.
>
> Currently there is no clean way to stop the DHCP client. But
> it looks very easy for you to add this functionality. You need
> to extend dhcp_mgt_entry() in dhcp_support.c to allow you to
> break the thread out and exit. Once the thread is dead you can
> then call init_net with a bootp record you create using your
> static IP addresses.

Yup, that should work.  When I did a product that could use
either DHCP or a static address, I started out by doing the
easiest thing: The configuration is only checked at boot-time.
I either start the DHCP client or I configure the network stack
statically.  

This means that when you change the IP address configuration
(either DHCP<->static or change the static address) it doesn't
take effect until the device is restarted. Nobody has ever
complained about the restart requirement.  But, the devices in
question are typically set up once and then just left alone.

-- 
Grant Edwards                   grante             Yow!  Now KEN is having
                                  at               a MENTAL CRISIS beacuse
                               visi.com            his "R.V." PAYMENTS are
                                                   OVER-DUE!!

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]