So my quandary is this, I have a breakpoint set in low_level_output. When I send a ping I hit the breakpoint and the pbuf lwip is trying to send is an ARP response packet, the pbuf has len == tot_len = 1518 although the ARP response packet is actually only 60 bytes?
________________________________________ John Kennedy Idaho Technology Inc. 390 Wakara Way Salt Lake City, UT 84108, USA USA: 1-800-735-6544 Bus:+1 (801)736-6354 x448 Fax:+1 (801)588-0507 http://www.idahotech.com/ -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Friday, May 08, 2009 11:51 AM To: Mailing list for lwIP users Subject: Re: [lwip-users] low level output question When allocating a pbuf, the end of it is defined by the length passed to pbuf_alloc, while the start is defined by the layer: pbuf_alloc allocates a pbuf (or a chain) of length + layer offset. E.g. if you call pbuf_alloc(PBUF_IP, 10, PBUF_RAM), a pbuf with a total length of 10 + 20 + 16 = 46 bytes (your length + IP header + ethernet header), while the initial payload pointer points to 36 bytes after the actual reserved memory. This can later be adjusted by calling pbuf_header. However, a pbuf cannot be lengthend at the end*: you have to allocate a new pbuf and chain the two to one packet. Doing that, tot_len of all pbufs in the chain will grow by 'len' of the newly chained pbuf. Theoretically, this could of course result in chains with tot_len > MTU + ethernet header, but a driver is not required to send this: the core code makes sure this does not happen! Simon John Kennedy wrote: > Ok, so what determines the length of a pbuf when it's allocated and what > determines if pbufs are chained or not, and if chained will tot_len ever > exceed the max Ethernet frame size? > Specifically, when sending an IP packet does lwip allocate a pbuf big enough > for a max Ethernet frame then set tot_len to the actual packet length? _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users ________________________________________ CONFIDENTIALITY NOTICE: This E-mail and any attachments are confidential information of the sender and are for the exclusive use of the intended recipient. If you are not the intended recipient, be aware that any disclosure, copying, distribution, or use of this E-mail or any attachment is prohibited. If you have received this E-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you for your cooperation. _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
