Skip to content

Commit

Permalink
Keep routing state when disabling/stopping firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs authored and mchf committed Aug 17, 2015
1 parent dbceace commit 6e1e482
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/network/src/modules/SuSEFirewall.rb
Expand Up @@ -90,6 +90,7 @@ def main
"FW_LOG_DROP_CRIT" => "yes",
"FW_PROTECT_FROM_INT" => "no",
"FW_ROUTE" => "no",
"FW_STOP_KEEP_ROUTING_STATE" => "no",
"FW_MASQUERADE" => "no",
"FW_ALLOW_FW_TRACEROUTE" => "yes",
"FW_ALLOW_PING_FW" => "yes",
Expand Down Expand Up @@ -1185,8 +1186,10 @@ def SetSupportRoute(set_route)
SetModified()

if set_route
Ops.set(@SETTINGS, "FW_STOP_KEEP_ROUTING_STATE", "yes")
Ops.set(@SETTINGS, "FW_ROUTE", "yes")
else
Ops.set(@SETTINGS, "FW_STOP_KEEP_ROUTING_STATE", "no")
Ops.set(@SETTINGS, "FW_ROUTE", "no")
end

Expand Down
20 changes: 20 additions & 0 deletions library/network/test/susefirewall_test.rb
Expand Up @@ -85,4 +85,24 @@ def reset_SuSEFirewallIsInstalled_cache
expect(Yast::SuSEFirewall.GetModified()).to eq(true)
end
end

describe "#SetSupportRoute" do
context "when enabling routing" do
it "sets FW_ROUTE and FW_STOP_KEEP_ROUTING_STATE to 'yes'" do
subject.SetSupportRoute(true)
settings = subject.Export
expect(settings["FW_ROUTE"]).to eq("yes")
expect(settings["FW_STOP_KEEP_ROUTING_STATE"]).to eq("yes")
end
end

context "when disabling routing" do
it "sets FW_ROUTE and FW_STOP_KEEP_ROUTING_STATE to 'no'" do
subject.SetSupportRoute(false)
settings = subject.Export
expect(settings["FW_ROUTE"]).to eq("no")
expect(settings["FW_STOP_KEEP_ROUTING_STATE"]).to eq("no")
end
end
end
end

0 comments on commit 6e1e482

Please sign in to comment.