Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

DHCP renewal in uIP

Posted by DeeAitch on February 25, 2009
Hello

I have now successfully implemented the uIP DHCP application (files dhcpc.c and dhcpc.h) in the uIP package. The router gives an IP address when my MCB2360 development board in attached. Everything is great.

But, has anyone solved the issue with IP renewal? I.e. when the ethernet cable is disconnected for a while and then re-connected.

I debuggded the source file to see if the code enters the related functions when an IP is received. But it newer does.

So, do anyone have an idea of how to make the application to start send "DHCP discover" packages to the router again after ethernet cable removal?

/Dee

RE: DHCP renewal in uIP

Posted by Dave on February 25, 2009
I would recommend asking your question on the uIP support mailing list. They are usually very helpful.

RE: DHCP renewal in uIP

Posted by incrediball on March 2, 2009
I can't agree. Getting on to the mailing list in the first place was a major pain and compared to forums such as this, it all seemed a bit strange. However when I finally was able to send what I wanted to send, I just got my email back with some spam rating plus another one in Chinese, which apparently says that they have received my mail.

Why Chinese? I thought uIP came from Sweden...?

RE: DHCP renewal in uIP

Posted by spreet on March 10, 2009
I am trying to add code to get the IP address for my 236x board which is running uIP stack. Can you share your DHCP code?
Thanks,

RE: DHCP renewal in uIP

Posted by incrediball on March 17, 2009
I am now also using the dhcp client in uIP. Did you have problems with the handle_dhcp protothread calling send_discover() at high speed in an endless loop? I found that adding a PT_YIELD(&s.pt) after send_discover() and after send_request() allowed the caller to actually send the packet so that the uip_newdata() in the following PT_WAIT_UNTIL statement actually had some meaning.

Anyway, regarding address renewal:

1. Is it necessary to renew the address if the cable has been disconnected? A lease for the address is granted and so is not the address "ours" until the end of the lease regardless of whether the cable is disconnected or not?

2. Otherwise we only need to handle the lease expiry, which sadly was not implemented. Perhaps it is sufficient to simply replace the:

while(1) {
PT_YIELD(&s.pt);
}

with:

timer_set (&s.timer, ntohs(s->lease_time[0])*65536ul + ntohs(s->lease_time[1]));
PT_WAIT_UNTIL(&s.pt, timer_expired(&s.timer));

The following PT_END should then restart the DHCP thread. Does anyone know if this is adequate? I don't really want to have to wait a week for my IP address to expire, only to find it hasn't worked...

Sorry, I know talking about DHCP on here is called hijacking but the uIP mailing list is a bit of a joke in my opinion...


RE: DHCP renewal in uIP

Posted by incrediball on March 18, 2009
I made some mistakes, I meant:

timer_start (&s.timer, (ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1])) * CLOCK_SECOND);

RE: DHCP renewal in uIP

Posted by spreet on March 19, 2009
I have the demo code working on the MCB 2360 with fixed IP address. Can someone guide me in writing the code for getting the IP address from the DHCP server on MCB 2360 board instaed of setting a fixed IP address.

Thanks


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists