mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
Merge pull request #4727 from openanolis/anolis-fix-network
fix network failed for kata ci
This commit is contained in:
commit
129335714b
@ -163,7 +163,7 @@ fn generate_route(name: &str, route: &RouteMessage) -> Result<Option<Route>> {
|
|||||||
Ok(Some(Route {
|
Ok(Some(Route {
|
||||||
dest: route
|
dest: route
|
||||||
.destination_prefix()
|
.destination_prefix()
|
||||||
.map(|(addr, _)| addr.to_string())
|
.map(|(addr, prefix)| format!("{}/{}", addr, prefix))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
gateway: route.gateway().map(|v| v.to_string()).unwrap_or_default(),
|
gateway: route.gateway().map(|v| v.to_string()).unwrap_or_default(),
|
||||||
device: name.to_string(),
|
device: name.to_string(),
|
||||||
|
@ -20,6 +20,7 @@ impl TcFilterModel {
|
|||||||
Ok(Self {})
|
Ok(Self {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl NetworkModel for TcFilterModel {
|
impl NetworkModel for TcFilterModel {
|
||||||
fn model_type(&self) -> NetworkModelType {
|
fn model_type(&self) -> NetworkModelType {
|
||||||
@ -60,22 +61,25 @@ impl NetworkModel for TcFilterModel {
|
|||||||
handle
|
handle
|
||||||
.traffic_filter(tap_index as i32)
|
.traffic_filter(tap_index as i32)
|
||||||
.add()
|
.add()
|
||||||
.protocol(0x0003)
|
.parent(0xffff0000)
|
||||||
.egress()
|
// get protocol with network byte order
|
||||||
|
.protocol(0x0003_u16.to_be())
|
||||||
.redirect(virt_index)
|
.redirect(virt_index)
|
||||||
.execute()
|
.execute()
|
||||||
.await
|
.await
|
||||||
.context("add tap egress")?;
|
.context("add redirect for tap")?;
|
||||||
|
|
||||||
handle
|
handle
|
||||||
.traffic_filter(virt_index as i32)
|
.traffic_filter(virt_index as i32)
|
||||||
.add()
|
.add()
|
||||||
.protocol(0x0003)
|
.parent(0xffff0000)
|
||||||
.egress()
|
// get protocol with network byte order
|
||||||
|
.protocol(0x0003_u16.to_be())
|
||||||
.redirect(tap_index)
|
.redirect(tap_index)
|
||||||
.execute()
|
.execute()
|
||||||
.await
|
.await
|
||||||
.context("add virt egress")?;
|
.context("add redirect for virt")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user