mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 20:54:26 +00:00
agent-ctl: introduce handle for iptables get/set
Add support for the updated agent API for iptables Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
parent
65f0cef16c
commit
af2ef3f7a5
@ -161,6 +161,11 @@ static AGENT_CMDS: &[AgentCmd] = &[
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_get_guest_details,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "GetIptables",
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_get_ip_tables,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "GetMetrics",
|
||||
st: ServiceType::Agent,
|
||||
@ -231,6 +236,11 @@ static AGENT_CMDS: &[AgentCmd] = &[
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_set_guest_date_time,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "SetIptables",
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_set_ip_tables,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "SignalProcess",
|
||||
st: ServiceType::Agent,
|
||||
@ -1219,6 +1229,29 @@ fn agent_cmd_sandbox_get_guest_details(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_sandbox_get_ip_tables(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
_health: &HealthClient,
|
||||
_options: &mut Options,
|
||||
args: &str,
|
||||
) -> Result<()> {
|
||||
let req: GetIPTablesRequest = utils::make_request(args)?;
|
||||
|
||||
let ctx = clone_context(ctx);
|
||||
|
||||
debug!(sl!(), "sending request"; "request" => format!("{:?}", req));
|
||||
|
||||
let reply = client
|
||||
.get_ip_tables(ctx, &req)
|
||||
.map_err(|e| anyhow!("{:?}", e).context(ERR_API_FAILED))?;
|
||||
|
||||
info!(sl!(), "response received";
|
||||
"response" => format!("{:?}", reply));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_container_wait_process(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
@ -1899,6 +1932,29 @@ fn agent_cmd_sandbox_set_guest_date_time(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_sandbox_set_ip_tables(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
_health: &HealthClient,
|
||||
_options: &mut Options,
|
||||
args: &str,
|
||||
) -> Result<()> {
|
||||
let req: SetIPTablesRequest = utils::make_request(args)?;
|
||||
|
||||
let ctx = clone_context(ctx);
|
||||
|
||||
debug!(sl!(), "sending request"; "request" => format!("{:?}", req));
|
||||
|
||||
let reply = client
|
||||
.set_ip_tables(ctx, &req)
|
||||
.map_err(|e| anyhow!(e).context(ERR_API_FAILED))?;
|
||||
|
||||
info!(sl!(), "response received";
|
||||
"response" => format!("{:?}", reply));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_sandbox_add_arp_neighbors(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
|
Loading…
Reference in New Issue
Block a user