BUGFIX: We weren't correctly honouring requests to use a Linux bridge. This patch fixes it.

This commit is contained in:
Herbert Wolverson 2024-02-05 11:33:32 -06:00
parent 3ab165a591
commit 7180dd7950

View File

@ -207,26 +207,28 @@ pub fn attach_xdp_and_tc_to_interface(
// Attach to the ingress IF it is configured // Attach to the ingress IF it is configured
if let Ok(etc) = lqos_config::load_config() { if let Ok(etc) = lqos_config::load_config() {
if let Some(bridge) = &etc.bridge { if let Some(bridge) = &etc.bridge {
// Enable "promiscuous" mode on interfaces if bridge.use_xdp_bridge {
info!("Enabling promiscuous mode on {}", &bridge.to_internet); // Enable "promiscuous" mode on interfaces
std::process::Command::new("/bin/ip") info!("Enabling promiscuous mode on {}", &bridge.to_internet);
.args(["link", "set", &bridge.to_internet, "promisc", "on"]) std::process::Command::new("/bin/ip")
.output()?; .args(["link", "set", &bridge.to_internet, "promisc", "on"])
info!("Enabling promiscuous mode on {}", &bridge.to_network); .output()?;
std::process::Command::new("/bin/ip") info!("Enabling promiscuous mode on {}", &bridge.to_network);
.args(["link", "set", &bridge.to_network, "promisc", "on"]) std::process::Command::new("/bin/ip")
.output()?; .args(["link", "set", &bridge.to_network, "promisc", "on"])
.output()?;
// Build the interface and vlan map entries // Build the interface and vlan map entries
crate::bifrost_maps::clear_bifrost()?; crate::bifrost_maps::clear_bifrost()?;
crate::bifrost_maps::map_multi_interface_mode(&bridge.to_internet, &bridge.to_network)?; crate::bifrost_maps::map_multi_interface_mode(&bridge.to_internet, &bridge.to_network)?;
// Actually attach the TC ingress program // Actually attach the TC ingress program
let error = unsafe { let error = unsafe {
bpf::tc_attach_ingress(interface_index as i32, false, skeleton) bpf::tc_attach_ingress(interface_index as i32, false, skeleton)
}; };
if error != 0 { if error != 0 {
return Err(Error::msg("Unable to attach TC Ingress to interface")); return Err(Error::msg("Unable to attach TC Ingress to interface"));
}
} }
} }