Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit from VirtioNet:pull if link is nil #787

Closed
wants to merge 1 commit into from

Conversation

dpino
Copy link
Contributor

@dpino dpino commented Feb 26, 2016

Consider the following script that forwards packets from one nic to another one. NICs use VirtioNet driver (Snabb Switch running within a guest):

module(..., package.seeall)

local VirtioNet = require("apps.virtio_net.virtio_net").VirtioNet
function run(args)
   local pci1, pci2 = unpack(args)
   local c = config.new()
   config.app(c, "eth0", VirtioNet, {
      pciaddr=pci1,
   })
   config.app(c, "eth1", VirtioNet, {
      pciaddr=pci2,
   })
   config.link(c, "eth0.tx -> eth1.rx")
   engine.configure(c)
   engine.main()

The program breaks due to an error in core/link.lua:

core/link.lua:80: attempt to index local 'r' (a nil value)
stack traceback:
        core/main.lua:126: in function '__index'
        core/link.lua:80: in function 'nreadable'
        core/link.lua:88: in function 'nwritable'

The problem is that although there's only one link configured, the engine executes VirtioNet:pull in eth1, and the output link is nil, so a checking that exits pull in that case should be added. I noticed the same checking is present in intel_app.lua, and there's a another one for the push case. I couldn't reproduce a similar test for push, so I didn't add it.

In my opinion, a pull in eth1 should never be executed as it's not present on the left side of a link, but maybe I'm missing other reasons while it's being called.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @nnikolaev-virtualopensystems to be a potential reviewer

@eugeneia eugeneia self-assigned this Feb 29, 2016
@eugeneia
Copy link
Member

LGTM. @nnikolaev-virtualopensystems any objections?

@ghost
Copy link

ghost commented Feb 29, 2016

I'm OK with this.

eugeneia added a commit to eugeneia/snabb that referenced this pull request Feb 29, 2016
@dpino dpino closed this Mar 10, 2016
@dpino dpino deleted the virtio-net-fix branch March 10, 2016 16:30
@wingo wingo mentioned this pull request May 3, 2016
dpino added a commit to dpino/snabb that referenced this pull request Apr 7, 2017
Reintroduce NDP secondary address test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants