emmericp / MoonGen

MoonGen is a fully scriptable high-speed packet generator built on DPDK and LuaJIT. It can saturate a 10 Gbit/s connection with 64 byte packets on a single CPU core while executing user-provided Lua scripts for each packet. Multi-core support allows for even higher rates. It also features precise and accurate timestamping and rate control.
MIT License
1.03k stars 234 forks source link

Vlan tagging doesn't work for me #315

Open sv3n-mu3ll3r opened 3 years ago

sv3n-mu3ll3r commented 3 years ago

Hello everybody,

I'm using MoonGen with Vmware and a Mellanox ConnectX-5 card. Untagged, I can send traffic though SR-IOV. But because I want other guests use the same card, I need to send the traffic tagged.

I added "buf:setVlan(3006)" to the code and hoped it would send traffic tagged with VlanID 3006. But it doesn't seem to be the case.

Do I miss anything?

Thanks a lot, sVen

while mg.running() do -- fill packets and set their size bufs:alloc(packetLen) for i, buf in ipairs(bufs) do buf:setVlan(3006) local pkt = buf:getTcpPacket(ipv4) --increment IP if ipv4 then pkt.ip4.src:set(minIP) pkt.ip4.src:add(counter) else pkt.ip6.src:set(minIP) pkt.ip6.src:add(counter) end counter = incAndWrap(counter, numIPs)

                    -- dump first 3 packets
                    if c < 1 then
                            buf:dump()
                            c = c + 1
                    end
            end
            --offload checksums to NIC
            bufs:offloadTcpChecksums(ipv4)
            queue:send(bufs)
            txStats:update()
    end