Below is more debug information and hope it's helpful for fixing the problem.
Regarding the code stalled at early stage, that's hardware related. I am using ARM7 (AT91SAM7 to be specific), so the data alignment is 4 and PBUF_LINK_HLEN is 14 by default, so I replaced all PBUF_LINK_HLEN in the patch with (PBUF_LINK_HLEN + 2). It fixed the run-time problem which keep the code running fine. Now I can build-up the PPP connection. However, the patch seems fix the pbuf issue but it actually breaks the traffic from Ethernet to PPP side which was fine before the patch. If you need me do any test, please let me know. etharp_timer etharp_timer ethernet_input: dest:00:bd:33:06:68:22, src:c8:d7:19:ee:1f:fc, type:800 ip_input: iphdr->dest 0x6901a8c0 netif->ip_addr 0x3200a8c0 (0x1a8c0, 0xa8c0, 0x69000000) ip_input: iphdr->dest 0x6901a8c0 netif->ip_addr 0x6901a8c0 (0x6901a8c0, 0x6901a8c0, 0x0) ip_input: packet accepted on interface pp ip_input: IP header: +-------------------------------+ | 4 | 5 | 0x00 | 60 | (v, hl, tos, len) +-------------------------------+ | 3897 |000| 0 | (id, flags, offset) +-------------------------------+ | 128 | 1 | 0xa7fb | (ttl, proto, chksum) +-------------------------------+ | 192 | 168 | 0 | 211 | (src) +-------------------------------+ | 192 | 168 | 1 | 105 | (dest) +-------------------------------+ ip_input: p->len 60 p->tot_len 60 ip_output_if: em0 IP header: +-------------------------------+ | 4 | 5 | 0x00 | 60 | (v, hl, tos, len) +-------------------------------+ | 3897 |000| 0 | (id, flags, offset) +-------------------------------+ | 255 | 1 | 0x28fb | (ttl, proto, chksum) +-------------------------------+ | 192 | 168 | 1 | 105 | (src) +-------------------------------+ | 192 | 168 | 0 | 211 | (dest) +-------------------------------+ netif->output() etharp_send_ip: sending packet 0020d520 etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer ethernet_input: dest:00:bd:33:06:68:22, src:c8:d7:19:ee:1f:fc, type:800 ip_input: iphdr->dest 0x6a01a8c0 netif->ip_addr 0x3200a8c0 (0x1a8c0, 0xa8c0, 0x6a000000) ip_input: iphdr->dest 0x6a01a8c0 netif->ip_addr 0x6901a8c0 (0x6a01a8c0, 0x6901a8c0, 0x0) ip_input: packet not for us. ip_forward: forward packets to interface.pp ip_forward: forwarding packet to 192.168.1.106 etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer ethernet_input: dest:00:bd:33:06:68:22, src:c8:d7:19:ee:1f:fc, type:800 ip_input: iphdr->dest 0x6a01a8c0 netif->ip_addr 0x3200a8c0 (0x1a8c0, 0xa8c0, 0x6a000000) ip_input: iphdr->dest 0x6a01a8c0 netif->ip_addr 0x6901a8c0 (0x6a01a8c0, 0x6901a8c0, 0x0) ip_input: packet not for us. ip_forward: forward packets to interface.pp ip_forward: forwarding packet to 192.168.1.106 etharp_timer etharp_timer Thanks, Charles -----Original Message----- From: lwip-users-bounces+cmao=moog....@nongnu.org [mailto:lwip-users-bounces+cmao=moog....@nongnu.org] On Behalf Of l...@moog.com Sent: Thursday, April 10, 2014 2:30 PM To: lwip-users@nongnu.org Subject: Re: [lwip-users] ppp-new IP forwarding only works one direction (Ethernet to PPP) Sylvain, It seems the patch makes things worse - PPP connection couldn’t build-up anymore. Below is the complete log message after applying the patch. It seems the code stalled at very early stage. *** FreeRTOS Demo Started! *** netif_set_ipaddr: netif addrnetif: IP address of interface set to 0.0.0.0 netif: netmask of interface set to 0.0.0.0 eteif: GW sasd dbreeissn go fc hinatnegrefdace snete ttiof 0.0.0.0: nIePti fa:d darddeesds iontfe rifnatcee pp IP addr 0.0.0.r0 netfmask 0.0.0.0 gw 0.0.0.0 ace set to 192.168.0.50 netif: netif: setting default interface pp netmask of interface set to 255.255.255.0 netif: GW address of interface set to 192.168.0.1 etharp_timer etharp_timer etharp_timer etharp_timer etharp_timer netif: added interface em IP addr 192.168.0.50 netmask 255.255.255.0 gw 192.168.0.1 ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:c8:d7:19:ee:1f:fc, type:806 etharp_update_arp_entry: 0.0.0.0 - c8:d7:19:ee:1f:fc etharp_update_arp_entry: will not add non-unicast IP address to ARP cache etharp_arp_input: incoming ARP request etharp_arp_input: ARP request was not for us. etharp_timer etharp_timer Regarding the patch, my compiler complains the following statement u8_t *payload = next_pbuf->payload + PBUF_LINK_HLEN; so I made a small change to make it work with my compiler u8_t *payload = (u8_t*)next_pbuf->payload + PBUF_LINK_HLEN; Thanks again, Charels >Oh dear, now I see what is happening. >PPP header is smaller than Ethernet header, plus PPPoS needs to reallocate a >new PPP to do HDLC encoding, so Ethernet to PPPoS forwarding will always works. >But, PPPoS to Ethernet will not work, because there is not enough header space >in the pbuf to put Ethernet header in place of the PPP header. >This is actually a lwIP design issue, the only way we can fix that is by >adding a configuration option so pbuf from PPP are allocated with enough extra >space so a Ethernet header will fit in place of a PPP header. >So, let's try that with a stupid patch, at least it will confirm what I >thought is happening. _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users