[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] DHCP issues....problem found; how do I solve it?

From: Leon Woestenberg
Subject: Re: [lwip-users] DHCP issues....problem found; how do I solve it?
Date: Mon, 1 Dec 2003 23:49:26 +0100

Hello Tom,

> This has been set all the time. If I take out the
> memcpy, DHCP never gets a properly formed REQUEST out.
> #define MEM_ALIGNMENT           4
DHCP allocates memory for request packets in the following manner:

dhcp_create_request(struct netif *netif)
  dhcp->p_out = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcp_msg),

This in turn results in the following piece of code being executed:

pbuf_alloc(pbuf_layer l, u16_t length, pbuf_flag flag)
  case PBUF_RAM:
    /* If pbuf is to be allocated in RAM, allocate memory for it. */
    p = mem_malloc(MEM_ALIGN_SIZE(sizeof(struct pbuf) + length + offset));
    /* Set up internal structure of the pbuf. */
    p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf) +
    LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",
           ((u32_t)p->payload % MEM_ALIGNMENT) == 0);

There are MEM_ALIGN macro's and even an assertion to make sure the payload
is aligned

Please use any debugging means to see where your application fails aligning.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]