Another alternative (for me and maybe others) would be to have a standard way to hook packets direct from the virtio interface. Especially if we could ensure that we don't dhcp on that interface.
For instance, setup 2 interfaces from the host - 1 for OSv-y stuff, and one just for an application which takes over the interface at a very low level. Rick On Mon, 2020-07-20 at 21:32 -0700, Waldek Kozaczuk wrote: > Honestly, I am not familiar enough in this subject domain so I cannot > give any authoritative advice. But it seems to me that the latter > idea of introducing and supporting LINUX_AF_PACKET may be less effort > and more in line with what Charles did. I am not familiar with BPF so > I do not know if it would even make sense for OSv nor how much effort > it would be to support it. > > Waldek > > On Thursday, July 16, 2020 at 9:43:14 AM UTC-4 [email protected] > wrote: > > Hi, > > > > I think that the type of raw sockets (SOCK_RAW) works well in OSv, > > it is possible to hook L3 packets (assuming an INET domain) with no > > problems. I guess that BSD does not support the PACKET domain, thus > > the OSv does not support too. If I remember well, we can hook > > frames in BSD by using libpcap, which in turn uses bpf > > (alternatively, we can use bpf directly). However, the bsd/sys/net > > in OSv does not have the FreeBSD's bpf implementation. Maybe one > > interesting way to enable L2 packet hooking is by migrating the bpf > > from sys/net of FreeBSD to the bsd/sys/net of OSv (what do you > > think about that guys?). Another possibility is to create a kind of > > PACKET domain support (similar to NETLINK support provided by > > Charles Meyers in the Spirent fork), but in that case, we will need > > to hook the bytes of frames straightforward from the mbuffs. > > > > Regards, > > Vinicius > > > > Em quinta-feira, 16 de julho de 2020 às 02:57:52 UTC-3, Pekka > > Enberg escreveu: > > > Hi, > > > > > > On Wed, Jul 15, 2020 at 6:13 PM Waldek Kozaczuk < > > > [email protected]> wrote: > > > > Hi, > > > > > > > > Unfortunately, I have no idea what it would take to add raw > > > > sockets support. Please be aware that we maintain another IPV6 > > > > branch - https://github.com/cloudius-systems/osv/tree/ipv6 - > > > > which besides IPV6 might have better networking support but I > > > > doubt it supports raw sockets. > > > > > > > > I am also adding Charles Meyers from Spirent who wrote original > > > > IPV6 support to this thread. He may have some thoughts on this > > > > matter. Also, Spirent has also its own OSv fork - > > > > https://github.com/SpirentOrion/osv - which has extra > > > > stuff/fixes to networking stack (I would like to port some of > > > > those to the mainline OSv at some point). > > > > > > > > > > The TCP/IP stack supports raw sockets (it's the FreeBSD stack > > > after all). > > > > > > One potential issue is that the Linux socket() > > > compatibility layer is incorrect. I see that linux_socket() > > > (called by socket() function) has some support for raw sockets: > > > > > > https://github.com/cloudius-systems/osv/blob/master/bsd/sys/compat/linux/linux_socket.cc#L619 > > > > > > > > > However, it's bit picky on the "domain" and "protocol" and will > > > ignore what Frederic attempted to do: > > > > > > fd=socket(AF_PACKET,SOCK_RAW,htons(ETH_P_ALL)); > > > > > > I assume if you fix up linux_socket() to do what Linux does, > > > things will work fine. > > > > > > - Pekka > > -- > You received this message because you are subscribed to the Google > Groups "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/osv-dev/397b053e-b06b-467e-89b8-75d9dd6d117an%40googlegroups.com > . -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/6a3ce5daecbcb84bcdee0738242937e11d2f9d33.camel%40rossfell.co.uk.
