> In the udp_send() of lwip 1.3, when there is not enought space to add an > UDP header, we allocated the pbuf with: > > p = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM)
This is wrong. A pbuf given to udp_send must be allocated with PBUF_TRANSPORT! This should look like: p = pbuf_alloc(PBUF_TRANSPORT, <your_data_len>, PBUF_RAM) This makes sure the pbuf has enough room for tcp or udp headers + IP headers and ETH headers. Also, before giving it to udp_send, you can put as much as <your_data_len> into the pbuf (from the application view). You would only use PBUF_IP if you don't use UDP, TCP, ICMP or any other transport layer protocol (or do it yourself) - but that's really rare! > > And in the previous version, we did: > > p = pbuf_alloc(PBUF_TRANSPORT, UDP_HLEN + 16, PBUF_RAM) You don't need to allocate space for UDP_HLEN in your app, this is implicitly taken care of by the PBUF_TRANSPORT flag. 16 would be the amount of data you are allowed to save into the pbuf yourself, here. Simon -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
