Skip to content

Commit

Permalink
PrivateRouter: work around snabbco#1238
Browse files Browse the repository at this point in the history
Works around snabbco#1238 (lib.lpm requires a default entry "0.0.0.0/0") by
adding a default entry that maps to nil.
  • Loading branch information
eugeneia committed Feb 12, 2018
1 parent 1541234 commit 94ec867
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/program/vita/route.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ end

function PrivateRouter:link ()
self.routing_table4 = lpm:new()
-- NB: need to add default LPM entry until #1238 is fixed, see
-- https://github.com/snabbco/snabb/issues/1238#issuecomment-345362030
-- Zero maps to nil in self.routes (which is indexed starting at one), hence
-- packets that match the default entry will be dropped (and route_errors
-- incremented.)
self.routing_table4:add_string("0.0.0.0/0", 0)
for key, route in ipairs(self.routes) do
route.link = self.output[config.link_name(route.net_cidr4)]
self.routing_table4:add_string(route.net_cidr4, key)
Expand Down

0 comments on commit 94ec867

Please sign in to comment.