[bug #54546] RAW API ethernet_input does not support pbuf chains

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
URL:
  <http://savannah.nongnu.org/bugs/?54546>

                 Summary: RAW API ethernet_input does not support pbuf chains
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yonatans
            Submitted on: Tue 21 Aug 2018 02:36:54 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.3

    _______________________________________________________

Details:

Passing a pbuf chain to ethernet_input (src/netif/ethernet.c) will not work as
the function assumes the packet is stored in one pbuf (for example, checks
(p->len <= SIZEOF_ETH_HDR) instead of comparing p->tot_len, and assuming that
the next header offsets are on the same pbuf.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Update of bug #54546 (project lwip):

                Category:                    None => pbufs                  
                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #1:

As per lwIP design to reduce code footprint, Ethernet, IP, and UDP/TCP headers
must fit into the first pbuf. Should we close the bug then ?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #2, bug #54546 (project lwip):

Even when there are 2 pbufs where 1 contains the L2/L3/L4 header and the
second conatins the payload, the code will still not work as expected since
the next functions (icmp_input for example) never uses p->next, and thus,
thinks they receive no payload.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #3, bug #54546 (project lwip):

ICMP headers must fit into the first pbuf as well.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #4, bug #54546 (project lwip):

As I said, even when all of the headers of the packet are in the same pbuf, it
still doesn't function. If you take the simplest example, ARP packet, then you
can clearly see that it immediately fails since the header packet is
immediately compared to ethernet header size and fails (since ethernet header
is not bigger than ethernet header size). These functions never use p->next
anyway, so they can never reach any of the pbufs besides the first one.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #5, bug #54546 (project lwip):

Well, ARP packet must fit into the first pbuf then, this is always the case if
IP, UDP/TCP/ICMP headers fit isn't it ?

If your PBUF_POOL_BUFSIZE is less than the default one, you will for sure trip
some "too short packet" drop conditions.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #6, bug #54546 (project lwip):

So if my hardware splits the header/data into separate buffers, I am doomed to
copy them into one pbuf before using ethernet_input?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #7, bug #54546 (project lwip):

Yes. AFAIK lwIP does not support highly fragmented scatter-gather packet
input.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #8, bug #54546 (project lwip):

OK, thanks for the quick response. You should close the bug.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Update of bug #54546 (project lwip):

                  Status:               Need Info => Wont Fix              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #9:

Note that you don't need to copy everything into one pbuf, only the first pbuf
must be filled with continuous data at least to the default value of
PBUF_POOL_BUFSIZE.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #10, bug #54546 (project lwip):

I don't think we will change anything around here in the near future. But to
know what the requirements could be, could you tell us where your hardware
splits packets? Optimizing for (zero copy) hardware is on the list, though not
at all cost...

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54546] RAW API ethernet_input does not support pbuf chains

Simon Goldschmidt
Follow-up Comment #11, bug #54546 (project lwip):

The hardware split the header/payload of the packets for Ethernet/IP/TCP/UDP
meaning the an ARP packet would have 1 buffer of Ethernet header and 1 buffer
for Ethernet payload. An ICMP packet would have 1 buffer containing
Ethernet/IP header and 1 buffer for IP payload. A UDP packet would have 1
buffer containing Ethernet/IP/UDP header and 1 buffer containing UDP payload.

I hope the explanation makes sense.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54546>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel