You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this doesn't work when Medium::Ip is passed to phy::RawSocket and to RawSocketDesc, since the incoming packets have an L2 frame prepended but Interface expects packets to start from the IP header
According to PACKET(7) man page
The socket_type is either SOCK_RAW for raw packets including the link-level header or SOCK_DGRAM for cooked packets with the link-level header removed.
For Medium::Ip we should set socket_type = libc::SOCK_DGRAM | libc::SOCK_NONBLOCK and protocol = libc::ETH_P_IP so the resulting packets start with the IP header
The text was updated successfully, but these errors were encountered:
I guess it's unclear if this is expected or desired to work, since the docs for Medium::Ip suggest that Medium::Ip is an abstraction designed for TUN devices...
If this is not intended to work it may make sense to assert_ne!(medium, Medium::Ip)
This may be harder to fix than how I initially thought. When sending a packet on a socket created with AF_PACKET + SOCK_DGRAM it looks like you need to specify the L2 destination address in a struct sockaddr_ll to sendto(). This doesn't work well with the Medium::Ip abstraction/design
RawSocketDesc
creates an AF_PACKET socket with libc::SOCK_RAW socket type in case of any mediumsmoltcp/src/phy/sys/raw_socket.rs
Lines 21 to 40 in fa7fd3c
However, this doesn't work when Medium::Ip is passed to phy::RawSocket and to RawSocketDesc, since the incoming packets have an L2 frame prepended but Interface expects packets to start from the IP header
According to PACKET(7) man page
For Medium::Ip we should set socket_type = libc::SOCK_DGRAM | libc::SOCK_NONBLOCK and protocol = libc::ETH_P_IP so the resulting packets start with the IP header
The text was updated successfully, but these errors were encountered: