-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from oskarirauta/fwnone-wrapper
Support none parameter on NETAVARK_FW
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::firewall; | ||
use crate::firewall::NetavarkResult; | ||
use crate::network::internal_types::{ | ||
PortForwardConfig, SetupNetwork, TearDownNetwork, TeardownPortForward, | ||
}; | ||
|
||
// Iptables driver - uses direct iptables commands via the iptables crate. | ||
pub struct Fwnone {} | ||
|
||
pub fn new() -> NetavarkResult<Box<dyn firewall::FirewallDriver>> { | ||
Ok(Box::new(Fwnone {})) | ||
} | ||
|
||
impl firewall::FirewallDriver for Fwnone { | ||
fn setup_network(&self, _network_setup: SetupNetwork) -> NetavarkResult<()> { | ||
Ok(()) | ||
} | ||
|
||
// teardown_network should only be called in the case of | ||
// a complete teardown. | ||
fn teardown_network(&self, _tear: TearDownNetwork) -> NetavarkResult<()> { | ||
Ok(()) | ||
} | ||
|
||
fn setup_port_forward(&self, _setup_portfw: PortForwardConfig) -> NetavarkResult<()> { | ||
Ok(()) | ||
} | ||
|
||
fn teardown_port_forward(&self, _tear: TeardownPortForward) -> NetavarkResult<()> { | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bats -*- bats -*- | ||
# | ||
# bridge driver tests with none firewall driver | ||
# | ||
|
||
load helpers | ||
|
||
fw_driver=none | ||
|
||
@test "check none firewall driver is in use" { | ||
RUST_LOG=netavark=info NETAVARK_FW="none" run_netavark --file ${TESTSDIR}/testfiles/simplebridge.json setup $(get_container_netns_path) | ||
assert "${lines[0]}" "==" "[INFO netavark::firewall] Not using firewall" "none firewall driver is in use" | ||
} |