Skip to content

Commit

Permalink
apps.tap: overwrite_dst_mac not overwrite_src_mac
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed May 25, 2022
1 parent 97bba23 commit 2d61cfb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/apps/tap/tap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Tap._config = {
mtu_fixup = { default = true },
mtu_offset = { default = 14 },
mtu_set = { default = nil },
overwrite_src_mac = { default = false },
overwrite_dst_mac = { default = false },
forwarding = { default = false }
}

Expand Down Expand Up @@ -158,7 +158,7 @@ function Tap:new (conf)
status_timer = lib.throttle(0.1),
pkt = packet.allocate(),
eth = ethernet:new{},
overwrite_src_mac = conf.overwrite_src_mac,
overwrite_dst_mac = conf.overwrite_dst_mac,
shm = { rxbytes = {counter},
rxpackets = {counter},
rxmcast = {counter},
Expand Down Expand Up @@ -213,9 +213,9 @@ function Tap:pull ()
end
end

function Tap:set_src_mac (p)
function Tap:set_dst_mac (p)
local eth = self.eth:new_from_mem(p.data, p.length)
eth:src(self.mac.bytes)
eth:dst(self.mac.bytes)
end

function Tap:push ()
Expand All @@ -224,8 +224,8 @@ function Tap:push ()
-- The write might have blocked so don't dequeue the packet from the link
-- until the write has completed.
local p = link.front(l)
if self.overwrite_src_mac then
self:set_src_mac(p)
if self.overwrite_dst_mac then
self:set_dst_mac(p)
end
local len, err = S.write(self.fd, p.data, p.length)
-- errno == EAGAIN indicates that the write would of blocked
Expand Down
2 changes: 1 addition & 1 deletion src/program/ipfix/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function configure_graph (arg, in_graph)
if config.output_type == "tap_routed" then
local tap_config = out_app[2]
tap_config.mtu = config.mtu
tap_config.overwrite_src_mac = true
tap_config.overwrite_dst_mac = true
tap_config.forwarding = true
end

Expand Down

0 comments on commit 2d61cfb

Please sign in to comment.