Skip to content

Commit

Permalink
ipfix probe_ptree: guard against duplicate devices
Browse files Browse the repository at this point in the history
NB: pci bus address short form vs qualified form
  • Loading branch information
eugeneia committed Sep 6, 2022
1 parent f346467 commit 29dfa83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/program/ipfix/probe_ptree/probe_ptree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,23 @@ function setup_workers (config)

update_cpuset(rss.cpu_pool)

local function ensure_device_unique (device, interfaces)
for other in pairs(interfaces) do
if device ~= other then
if pci.qualified(device) == pci.qualified(other) then
error("Duplicate interfaces: "..device..", "..other..
"\nNot applying configuration. Remove one of them via"..
("\n snabb config remove <snabbflow> /snabbflow-config/interface[device=%q]")
:format(other))
end
end
end
end

for rss_group = 1, rss.hardware_scaling.rss_groups do
local inputs, outputs = {}, {}
for device, opt in pairs(interfaces) do
ensure_device_unique(device, interfaces)
local input = lib.deepcopy(opt)
input.device = device
input.rxq = rss_group - 1
Expand Down

0 comments on commit 29dfa83

Please sign in to comment.