lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] two logical ethernet interfaces on the same, physical p


From: address@hidden
Subject: Re: [lwip-users] two logical ethernet interfaces on the same, physical port?
Date: Fri, 15 Jun 2018 19:58:51 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 15.06.2018 09:45, Kamil Khoury wrote:
Hi,

I was able to find something on the internet which allows to implement layer 2 protocols in a socket using the SOCK_RAW. Unfortunately, this is a linux library which is described here:
http://man7.org/linux/man-pages/man7/packet.7.html

Packet sockets are used to receive or send raw packets at the device
       driver (OSI Layer 2) level.  They allow the user to implement
       protocol modules in user space on top of the physical layer.
I know that the SOCK_RAW option is also available in LWIP but I think it only allows a socket over IPv4 not layer 2. Am I correct?

SOCK_RAW is the socket type here, which is a sub-type of the domain. We do support SOCK_RAW, but only at the domains AF_INET and AF_INET6. We don't support the (very linux specific) AF_PACKET domain.

For an embedded system of the size lwIP targets, it would just be wrong to copy *all* packets into an AF_PACKET socket buffer just to have the application thread throw away most of it. You should implement this at a much lower level instead to prevent waisting resources.

 Do you think I can use this library in LWIP to do a layer 2 socket?

"This library" is the Linux kernel, effectively. These things are implemented directly in the kernel with just a very small layer around it to form a system call.

And no, you cannot use the Linux kernel as a library in lwIP to implement a layer 2 socket :-)

Simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]