[En-Nut-Discussion] DHCP

Joerg Wiegelmann wiegelj at gmx.de
Mon Apr 15 10:30:49 CEST 2013


Hi,
perhaps there is a DHCP Problem? After receiving an IP address from the
DHCP Server the DHCP Task is asking periodically if the IP Adress is
valid. If this fails the DHCP-Task goes to the IDLE state and stucks
there. The workaround is to restart the DHCP-Task from the application.
The NutOS-Version is 4.10.2.1
The DHCP-Code is from an example like this:

            if (NutDhcpIfConfig(DEV_ETHER_NAME, my_mac, K_DhcpWaitTime)
== 0)
            {
                /* DHCP success ! */
                strcpy(IP_buf, inet_ntoa(confnet.cdn_ip_addr));
                /* Wurde die IP mittels DHCP bezogen ?  */
                if(NutDhcpStatus(NULL) == DHCPST_BOUND)
                {
                    printf("DHCP connected!\n\rIP: %s ...\n\n\r", IP_buf);
                    ipLoad = TRUE;
                }
                else
                {
                    /* Kein DHCP: Prüfen, ob statische
                     * IP konfiguriert wurde.*/
                    if(confnet.cdn_cip_addr != 0)
                    {
                        /* Statische IP-Konfiguration erwünscht. */
                        printf("Static IP: %s ...\n\n\r", IP_buf);
                        ipLoad = TRUE;
                    }
                }
            }


Any ideas? Thank you.
Best regards Joerg


More information about the En-Nut-Discussion mailing list