[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Problems with DHCP hostname len
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-devel] Problems with DHCP hostname len |
Date: |
Tue, 27 Sep 2011 07:51:05 +0200 |
Fixed, thanks for reporting this.
Simon
-> https://savannah.nongnu.org/bugs/index.php?34406
Juan Jose Schiavoni <address@hidden> wrote:
> Hi, my application hang when I enable the hostname for dhcp, that use lwip
> by default.
> I found two problems: 1) the macro LWIP_MAX always set len in 255.
> 2) the loop while(len--) do not count of options bytes available.
>
> #if LWIP_NETIF_HOSTNAME
> static void
> dhcp_option_hostname(struct dhcp *dhcp, struct netif *netif)
> {
> if (netif->hostname != NULL) {
> size_t namelen = strlen(netif->hostname);
> if (namelen > 0) {
> u8_t len;
> const char *p = netif->hostname;
>
> LWIP_ASSERT("DHCP: hostname is too long!", namelen <= 255);
> //len = LWIP_MAX(namelen, 255);
> len = LWIP_MIN(namelen, 255);
>
> // Shrink len to available bytes.
> if(((dhcp->options_out_len + 2) + len) > DHCP_OPTIONS_LEN){
> len = DHCP_OPTIONS_LEN - (dhcp->options_out_len + 2);
> }
>
> dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, len);
>
> while (len--) {
> dhcp_option_byte(dhcp, *p++);
> }
> }
> }
> }
> #endif /* LWIP_NETIF_HOSTNAME */
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone