IncludeOS icon indicating copy to clipboard operation
IncludeOS copied to clipboard

Unable to route packets between different drivers

Open AndreasAakesson opened this issue 5 years ago • 2 comments

It's currently not possible to route packets between two interfaces that uses different drivers. The reason is most likely different offsets in the driver.

Should this be possible?

This could easily be tested by using the test/net/integration/gateway service, by changing one of the first devices in vm.json to use a different device. With the combination

   {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"},
   {"device" : "vmxnet3", "mac" : "c0:01:0a:00:00:2f"},

I get this crash: IncludeOS/src/drivers/virtionet.cpp:358:enqueue_tx Expects failed: pckt->layer_begin() == pckt->buf() + sizeof(virtio_net_hdr)

AndreasAakesson avatar Oct 11 '18 10:10 AndreasAakesson

We can at least make a copy of the data and create a new packet for the different driver. As long as the packets size is within the MTU of the destination, that way small packets like TCP SYN and friends can work even when the MTUs differ. The driver offsets are not optional, and they also contribute to aligning the network layer to 32-bits which allows accessing many things like IPv4 addresses directly with aligned instructions. Any changes made to how the packets are laid out in memory needs to go through a battery of tests, with sanitizers enabled, in the linux platform.

fwsGonzo avatar Oct 11 '18 10:10 fwsGonzo

Did you solve the problem? Or do you find other simple methods to test it? I also wanna make a simple test for the function of Router but I dont have good idea. Thanks for helping.

ggbbr avatar Apr 27 '19 04:04 ggbbr