Hello Charles,

On Thu, Apr 10, 2014 at 08:03:13PM +0000, l...@moog.com wrote:
> Hi Sylvain,
> 
> Good news, I got it work with your patch

Yeah, happy to hear that.

Here is another patch, which should fix the issue in a way that can be 
pushed to the repository, would you test it ?


> plus the replacement of (PBUF_LINK_HLEN +2), however, set ETH_PAD_SIZE 
> to 2 actually doesn't work. It seems fail at ARP and infinitely repeat 
> with the following debug messages:

Humm, this is strange, using ETH_PAD_SIZE should work.


Sylvain
diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c
index 594d18c..ccb4bcb 100644
--- a/src/netif/ppp/ppp.c
+++ b/src/netif/ppp/ppp.c
@@ -1704,7 +1704,7 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l)
               }
             }
             /* If we haven't started a packet, we need a packet header. */
-            next_pbuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
+            next_pbuf = pbuf_alloc(PBUF_LINK, 0, PBUF_POOL);
             if (next_pbuf == NULL) {
               /* No free buffers.  Drop the input packet and let the
                * higher layers deal with it.  Continue processing
@@ -1716,15 +1716,27 @@ pppos_input(ppp_pcb *pcb, u_char *s, int l)
               break;
             }
             if (pcrx->in_head == NULL) {
-              u8_t *payload = next_pbuf->payload;
+              u8_t *payload;
+              /* pbuf_header() used below is only trying to put PPP headers
+               * before the current payload pointer if there is enought space
+               * in the pbuf to allow that. Therefore we don't care if it fails,
+               * but if it fail we have to set len to the size used by PPP headers.
+               */
 #if PPP_INPROC_MULTITHREADED
+              if (pbuf_header(next_pbuf, +sizeof(ppp_pcb*) +sizeof(pcrx->in_protocol))) {
+                next_pbuf->len += sizeof(ppp_pcb*) + sizeof(pcrx->in_protocol);
+              }
+              payload = next_pbuf->payload;
               *((ppp_pcb**)payload) = pcb;
               payload += sizeof(ppp_pcb*);
-              next_pbuf->len += sizeof(ppp_pcb*);
+#else /* PPP_INPROC_MULTITHREADED */
+              if (pbuf_header(next_pbuf, +sizeof(pcrx->in_protocol))) {
+                next_pbuf->len += sizeof(pcrx->in_protocol);
+              }
+              payload = next_pbuf->payload;
 #endif /* PPP_INPROC_MULTITHREADED */
               *(payload++) = pcrx->in_protocol >> 8;
               *(payload) = pcrx->in_protocol & 0xFF;
-              next_pbuf->len += sizeof(pcrx->in_protocol);
               pcrx->in_head = next_pbuf;
             }
             pcrx->in_tail = next_pbuf;

Attachment: signature.asc
Description: Digital signature

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to