> It looks like you're trying to send the pbuf that you've just received, > and that the problem arises because the address you've been given > points > to the received header that then is changed by the sendto operation. > Is > that correct?
Yes, both the pbuf and the address pointer are passed directly to the udp_sendto() function. I was having problems doing in-place operations on the received pbuf, so I made the simple UDP echo server to show the problem. It must have worked at some point in the past, because it is almost identical to the one described in a thread in 2007. > If that's the case, then I think your fix of copying the address out of > the received pbuf is the right thing to do. The only alternative would > be for lwIP to do this operation all the time, when usually it would > not be necessary. I'm okay copying the address to save overhead on more "typical" uses, but it should probably be documented somewhere that addr is just a pointer to the pbuf header, and could be affected if the pbuf is used for something else. On a side note, what happens if the pbuf is freed before the end of the callback? Does that also free the memory that the address pointer points to? Ben Hastings _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
