Skip to content

Commit 8159538

Browse files
committed
Remove passt networking mode support
Passt was an alternative networking backend that caused supervisor process leaks — passt processes were not cleaned up on VM stop/remove, accumulating zombie entries in the supervisor. Remove all passt support in favor of bridge and user networking modes.
1 parent fcbdf9b commit 8159538

7 files changed

Lines changed: 5 additions & 205 deletions

File tree

vmm/rpc/proto/vmm_rpc.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ message VmConfiguration {
105105

106106
// Per-VM networking configuration.
107107
message NetworkingConfig {
108-
// Networking mode: "passt", "bridge", "user"
108+
// Networking mode: "bridge", "user"
109109
string mode = 1;
110110
}
111111

vmm/src/app.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,6 @@ impl App {
228228
vm_state.config.clone()
229229
};
230230
if !is_running {
231-
// Try to stop passt if already running
232-
let networking = vm_config
233-
.manifest
234-
.networking
235-
.as_ref()
236-
.unwrap_or(&self.config.cvm.networking);
237-
if networking.is_passt() {
238-
self.supervisor.stop(&format!("passt-{}", id)).await.ok();
239-
}
240-
241231
let work_dir = self.work_dir(id);
242232
for path in [work_dir.serial_pty(), work_dir.qmp_socket()] {
243233
if path.symlink_metadata().is_ok() {
@@ -287,14 +277,6 @@ impl App {
287277
self.supervisor.stop(id).await?;
288278
}
289279
self.supervisor.remove(id).await?;
290-
// Try to clean up passt process if it exists (safe no-op if not passt mode)
291-
let passt_id = format!("passt-{}", id);
292-
if let Some(info) = self.supervisor.info(&passt_id).await.ok().flatten() {
293-
if info.state.status.is_running() {
294-
self.supervisor.stop(&passt_id).await?;
295-
}
296-
self.supervisor.remove(&passt_id).await?;
297-
}
298280
}
299281

300282
{

vmm/src/app/qemu.rs

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! QEMU related code
66
use crate::{
77
app::Manifest,
8-
config::{CvmConfig, GatewayConfig, Networking, NetworkingMode, ProcessAnnotation, Protocol},
8+
config::{CvmConfig, GatewayConfig, Networking, NetworkingMode, ProcessAnnotation},
99
};
1010
use std::{collections::HashMap, os::unix::fs::PermissionsExt};
1111
use std::{
@@ -63,7 +63,7 @@ fn networking_to_proto(n: &Networking) -> pb::NetworkingConfig {
6363
let mode = match n.mode {
6464
NetworkingMode::Bridge => "bridge",
6565
NetworkingMode::User => "user",
66-
NetworkingMode::Passt => "passt",
66+
6767
NetworkingMode::Custom => "custom",
6868
};
6969
pb::NetworkingConfig { mode: mode.into() }
@@ -351,113 +351,6 @@ impl VmState {
351351
}
352352

353353
impl VmConfig {
354-
fn config_passt(&self, workdir: &VmWorkDir, netcfg: &Networking) -> Result<ProcessConfig> {
355-
let Networking {
356-
passt_exec,
357-
interface,
358-
address,
359-
netmask,
360-
gateway,
361-
dns,
362-
map_host_loopback,
363-
map_guest_addr,
364-
no_map_gw,
365-
ipv4_only,
366-
..
367-
} = netcfg;
368-
369-
let passt_socket = workdir.passt_socket();
370-
if passt_socket.exists() {
371-
fs_err::remove_file(&passt_socket).context("Failed to remove passt socket")?;
372-
}
373-
let passt_exec = if passt_exec.is_empty() {
374-
"passt"
375-
} else {
376-
passt_exec
377-
};
378-
379-
let passt_log = workdir.passt_log();
380-
381-
let mut passt_cmd = Command::new(passt_exec);
382-
passt_cmd.arg("--socket").arg(&passt_socket);
383-
passt_cmd.arg("--log-file").arg(&passt_log);
384-
385-
if !interface.is_empty() {
386-
passt_cmd.arg("--interface").arg(interface);
387-
}
388-
if !address.is_empty() {
389-
passt_cmd.arg("--address").arg(address);
390-
}
391-
if !netmask.is_empty() {
392-
passt_cmd.arg("--netmask").arg(netmask);
393-
}
394-
if !gateway.is_empty() {
395-
passt_cmd.arg("--gateway").arg(gateway);
396-
}
397-
for dns in dns {
398-
passt_cmd.arg("--dns").arg(dns);
399-
}
400-
if !map_host_loopback.is_empty() {
401-
passt_cmd.arg("--map-host-loopback").arg(map_host_loopback);
402-
}
403-
if !map_guest_addr.is_empty() {
404-
passt_cmd.arg("--map-guest-addr").arg(map_guest_addr);
405-
}
406-
if *no_map_gw {
407-
passt_cmd.arg("--no-map-gw");
408-
}
409-
if *ipv4_only {
410-
passt_cmd.arg("--ipv4-only");
411-
}
412-
// Group port mappings by protocol
413-
let mut tcp_ports = Vec::new();
414-
let mut udp_ports = Vec::new();
415-
416-
for pm in &self.manifest.port_map {
417-
let port_spec = format!("{}/{}:{}", pm.address, pm.from, pm.to);
418-
match pm.protocol {
419-
Protocol::Tcp => tcp_ports.push(port_spec),
420-
Protocol::Udp => udp_ports.push(port_spec),
421-
}
422-
}
423-
// Add TCP port forwarding — one --tcp-ports per spec to avoid
424-
// exceeding passt's single-argument parser limit.
425-
for spec in &tcp_ports {
426-
passt_cmd.arg("--tcp-ports").arg(spec);
427-
}
428-
// Add UDP port forwarding
429-
for spec in &udp_ports {
430-
passt_cmd.arg("--udp-ports").arg(spec);
431-
}
432-
passt_cmd.arg("-f").arg("-1");
433-
434-
let args = passt_cmd
435-
.get_args()
436-
.map(|arg| arg.to_string_lossy().to_string())
437-
.collect::<Vec<_>>();
438-
let stdout_path = workdir.passt_stdout();
439-
let stderr_path = workdir.passt_stderr();
440-
let note = ProcessAnnotation {
441-
kind: "passt".to_string(),
442-
live_for: Some(self.manifest.id.clone()),
443-
};
444-
let note = serde_json::to_string(&note)?;
445-
let process_config = ProcessConfig {
446-
id: format!("passt-{}", self.manifest.id),
447-
args,
448-
name: format!("passt-{}", self.manifest.name),
449-
command: passt_exec.to_string(),
450-
env: Default::default(),
451-
cwd: workdir.to_string_lossy().to_string(),
452-
stdout: stdout_path.to_string_lossy().to_string(),
453-
stderr: stderr_path.to_string_lossy().to_string(),
454-
pidfile: Default::default(),
455-
cid: None,
456-
note,
457-
};
458-
Ok(process_config)
459-
}
460-
461354
pub fn config_qemu(
462355
&self,
463356
workdir: impl AsRef<Path>,
@@ -592,16 +485,6 @@ impl VmConfig {
592485
}
593486
netdev
594487
}
595-
NetworkingMode::Passt => {
596-
processes.push(
597-
self.config_passt(&workdir, networking)
598-
.context("Failed to configure passt")?,
599-
);
600-
format!(
601-
"stream,id=net0,server=off,addr.type=unix,addr.path={}",
602-
workdir.passt_socket().display()
603-
)
604-
}
605488
NetworkingMode::Bridge => {
606489
tracing::info!("bridge networking: mac={mac} bridge={}", networking.bridge);
607490
format!("bridge,id=net0,br={}", networking.bridge)
@@ -1183,22 +1066,6 @@ impl VmWorkDir {
11831066
self.workdir.join("qmp.sock")
11841067
}
11851068

1186-
pub fn passt_socket(&self) -> PathBuf {
1187-
self.workdir.join("passt.sock")
1188-
}
1189-
1190-
pub fn passt_stdout(&self) -> PathBuf {
1191-
self.workdir.join("passt.stdout")
1192-
}
1193-
1194-
pub fn passt_stderr(&self) -> PathBuf {
1195-
self.workdir.join("passt.stderr")
1196-
}
1197-
1198-
pub fn passt_log(&self) -> PathBuf {
1199-
self.workdir.join("passt.log")
1200-
}
1201-
12021069
pub fn path(&self) -> &Path {
12031070
&self.workdir
12041071
}

vmm/src/config.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ impl Config {
367367
#[serde(rename_all = "lowercase")]
368368
pub enum NetworkingMode {
369369
User,
370-
Passt,
371370
Bridge,
372371
Custom,
373372
}
@@ -401,38 +400,12 @@ pub struct Networking {
401400
#[serde(default)]
402401
pub restrict: bool,
403402

404-
// ── Passt fields ───────────────────────────────────────────────
405-
#[serde(default)]
406-
pub passt_exec: String,
407-
#[serde(default)]
408-
pub interface: String,
409-
#[serde(default)]
410-
pub address: String,
411-
#[serde(default)]
412-
pub netmask: String,
413-
#[serde(default)]
414-
pub gateway: String,
415-
#[serde(default)]
416-
pub dns: Vec<String>,
417-
#[serde(default)]
418-
pub map_host_loopback: String,
419-
#[serde(default)]
420-
pub map_guest_addr: String,
421-
#[serde(default)]
422-
pub no_map_gw: bool,
423-
#[serde(default)]
424-
pub ipv4_only: bool,
425-
426403
// ── Custom fields ──────────────────────────────────────────────
427404
#[serde(default)]
428405
pub netdev: String,
429406
}
430407

431408
impl Networking {
432-
pub fn is_passt(&self) -> bool {
433-
self.mode == NetworkingMode::Passt
434-
}
435-
436409
pub fn is_bridge(&self) -> bool {
437410
self.mode == NetworkingMode::Bridge
438411
}

vmm/src/main_service.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fn networking_from_proto(proto: &rpc::NetworkingConfig) -> Option<crate::config:
201201
use crate::config::NetworkingMode;
202202
let mode = match proto.mode.as_str() {
203203
"bridge" => NetworkingMode::Bridge,
204-
"passt" => NetworkingMode::Passt,
204+
205205
"user" => NetworkingMode::User,
206206
"custom" => NetworkingMode::Custom,
207207
"" => return None, // not set, use global default
@@ -218,16 +218,6 @@ fn networking_from_proto(proto: &rpc::NetworkingConfig) -> Option<crate::config:
218218
net: String::new(),
219219
dhcp_start: String::new(),
220220
restrict: false,
221-
passt_exec: String::new(),
222-
interface: String::new(),
223-
address: String::new(),
224-
netmask: String::new(),
225-
gateway: String::new(),
226-
dns: vec![],
227-
map_host_loopback: String::new(),
228-
map_guest_addr: String::new(),
229-
no_map_gw: false,
230-
ipv4_only: false,
231221
netdev: String::new(),
232222
forward_service_enabled: false,
233223
})

vmm/src/vmm-cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ def main():
13901390
deploy_parser.add_argument('--tee', dest='no_tee', action='store_false',
13911391
help='Force-enable Intel TDX (default)')
13921392
deploy_parser.set_defaults(no_tee=False)
1393-
deploy_parser.add_argument('--net', choices=['bridge', 'passt', 'user'],
1393+
deploy_parser.add_argument('--net', choices=['bridge', 'user'],
13941394
help='Networking mode (default: use global config)')
13951395

13961396

vmm/vmm.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,6 @@ net = "10.0.2.0/24"
8585
dhcp_start = "10.0.2.10"
8686
restrict = false
8787

88-
# for mode = "passt"
89-
passt_exec = ""
90-
interface = ""
91-
address = "10.0.2.10"
92-
netmask = "255.255.255.0"
93-
gateway = "10.0.2.2"
94-
dns = ["1.1.1.1", "1.0.0.1"]
95-
map_host_loopback = "none"
96-
map_guest_addr = "none"
97-
no_map_gw = true
98-
ipv4_only = true
99-
10088
# for mode = "bridge"
10189
# bridge = "virbr0"
10290
forward_service_enabled = false

0 commit comments

Comments
 (0)