Forward selected traffic to second NIC

40 views
Skip to first unread message

man...@gmail.com

unread,
Dec 25, 2016, 3:30:48 PM12/25/16
to Snabb Switch development
Dear All,

I'm new to snabb project and currently studying the possible QoS implementation for selected traffic.I would like to contribute to the project and share my work with community.

In my  POC project I'm doing selectively forward traffic to second NIC. However I'm getting below error while doing it. I'm currently using rawsocket. I use snabwall for this project.However snabbwall firewall section still under development. So I have to implement my own method to achieve the requirement.

Seeking advice to resolve below error.

core/main.lua:26: Message too long
stack traceback:
    core/main.lua:137: in function <core/main.lua:135>
    [C]: in function 'error'
    core/main.lua:26: in function 'assert'
    apps/socket/raw.lua:114: in function 'transmit'
    apps/socket/raw.lua:90: in function 'method'
    core/app.lua:87: in function 'with_restart'
    core/app.lua:335: in function 'thunk'
    core/histogram.lua:98: in function 'breathe'
    core/app.lua:273: in function 'main'
    program/wall/spy/spy.lua:343: in function 'run'
    program/wall/wall.lua:19: in function 'run'
    core/main.lua:56: in function <core/main.lua:43>
    [C]: in function 'xpcall'
    core/main.lua:179: in main chunk
    [C]: at 0x00452230
    [C]: in function 'pcall'
    core/startup.lua:3: in main chunk
    [C]: in function 'require'
    [string "require "core.startup""]:1: in main chunk

========================================================
Following is my wiring

      config.app(c, "nic2", raw.RawSocket, "veth0")
       config.link(c,last_app_name..".north -> qosfw.input")
       last_app_name = "qos"
       -- config.link(c, last_app_name..".south -> qosfw.input")
        config.link(c, "qosfw.output -> nic2.rx")

================================================

My code snapshot:

local nDPIQoSfw = setmetatable({}, util.SouthAndNorth)
nDPIQoSfw.__index = nDPIQoSfw

function nDPIQoSfw:new (scanner)
   return setmetatable({ scanner = scanner }, self)
end

function nDPIQoSfw:push()
     local i = assert(self.input.input, "input port not found")
   local o = assert(self.output.output, "output port not found")

   -- TODO: should establish one rule-set per destination IP (ie the target IP we are mitigation for)
   -- TODO: need to write ethernet headers on egress to match the MAC address of our "default gateway"

   while not link.empty(i) and not link.full(o) do
      self:process_packet(i, o)
   end
end

function nDPIQoSfw:process_packet(i, o)
local p = link.receive(i)

 
  link.transmit(o, p)
      return
end
----------------------------------------------------------------------------------------------------------------------------------------------------
Thank you,
Manoj M

Manoj Mallawaarachchi

unread,
Dec 31, 2016, 12:23:16 PM12/31/16
to snabb...@googlegroups.com, Katerina Barone-Adesi, Manoj Mallawaarachchi, mano...@yahoo.com
Reply all
Reply to author
Forward
0 new messages