[En-Nut-Discussion] DHCP renewal

Zheng Anding adzheng at yahoo.com
Wed Jun 16 04:40:38 CEST 2004


Hi Joe,
 
I've almost same codes like yours but mine is working. The differences are:
 
1.Add in NutNetLoadConfig("eth0"); memcpy(confnet.cdn_mac, mac, 6); before your code;
 
2. I reset confnet.cdn_ip_addr = confnet.cdn_cip_addr = confnet.cdn_ip_mask = confnet.cdn_gateway = 0;
 
3. You cann't pass mac to NutDhcpIfConfig or it won't read EEPROM configuration. Check this out: http://www.ethernut.de/api/group__xgDHCPC.html#ga19. Use 0 instead.
 
4. Use long enough DHCP_TIMEOUT. 10sec is good for me.
 
Regards,
Alex


Joe Doubek <jdoubek at control4.com> wrote:

  Can anyone guide me on how I might go about renewing the DHCP address on demand. It appears the NutDhcpIfConfig 

Function looks for both a valid mac and an ip address/mask of zero in EEPROM before it will start the DHCP thread. 

Currently I am attempting something like this, where mac is a valid mac addr:

 

    confnet.cdn_cip_addr = 0;

    confnet.cdn_ip_mask = 0; 

    NutNetSaveConfig();   /* store an invalid ip addr and mask in EEPROM */

    if (NutDhcpIfConfig("eth0", mac, DHCP_TIMEOUT)) 

    {

        printf("DHCP server not found...\n");

        return -1;

    }

 

   I do this after I have successfully received a DHCP address and I am just sitting in an idle state. When I do this the DHCP 

thread never appears to attempt to obtain an address (watching ethereal I never see a DHCP discover), and eventually DHCP 

times out. Any ideas?

 

-Joe

 

 

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

		
---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20040615/11f68d12/attachment-0001.html>


More information about the En-Nut-Discussion mailing list