patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Yureka Lilian <yureka@cyberchaos.dev>
To: devel@spectrum-os.org
Cc: Yureka Lilian <yureka@cyberchaos.dev>
Subject: [PATCH v2 5/7] host: integrate router
Date: Fri, 28 Nov 2025 23:30:27 +0100	[thread overview]
Message-ID: <20251128223038.97536-6-yureka@cyberchaos.dev> (raw)
In-Reply-To: <20251128223038.97536-1-yureka@cyberchaos.dev>

This removes the old host bridge + taps glue, and instead connects the
apps to their net provider's router instance.

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
 host/rootfs/default.nix                       |  4 +-
 host/rootfs/file-list.mk                      |  3 +
 .../data/service/spectrum-router/down         |  0
 .../template/data/service/spectrum-router/run | 13 ++++
 .../image/usr/bin/assign-driver-router-iface  | 11 +++
 host/rootfs/image/usr/bin/run-vmm             | 12 +--
 host/rootfs/image/usr/bin/vm-import           | 13 ----
 pkgs/overlay.nix                              |  1 +
 tools/start-vmm/ch.rs                         | 38 ++--------
 tools/start-vmm/lib.rs                        | 76 +++++++++++++------
 tools/start-vmm/meson.build                   |  2 +-
 tools/start-vmm/net-util.c                    | 39 ----------
 tools/start-vmm/net-util.h                    |  6 --
 tools/start-vmm/net.c                         | 55 --------------
 tools/start-vmm/net.rs                        | 11 ---
 tools/start-vmm/tests/meson.build             |  5 --
 .../start-vmm/tests/tap_open-name-too-long.c  | 20 -----
 tools/start-vmm/tests/tap_open.c              | 28 -------
 18 files changed, 89 insertions(+), 248 deletions(-)
 create mode 100644 host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/down
 create mode 100755 host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
 create mode 100755 host/rootfs/image/usr/bin/assign-driver-router-iface
 delete mode 100644 tools/start-vmm/net-util.c
 delete mode 100644 tools/start-vmm/net-util.h
 delete mode 100644 tools/start-vmm/net.c
 delete mode 100644 tools/start-vmm/tests/tap_open-name-too-long.c
 delete mode 100644 tools/start-vmm/tests/tap_open.c

diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 4bbbe23..3b8557c 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -8,7 +8,7 @@ import ../../lib/call-package.nix (
 }:
 pkgsMusl.callPackage (
 
-{ spectrum-host-tools
+{ spectrum-host-tools, spectrum-router
 , lib, stdenvNoCC, nixos, runCommand, writeClosure, erofs-utils, s6-rc
 , busybox, cloud-hypervisor, cosmic-files, crosvm, cryptsetup
 , dejavu_fonts, dbus, execline, foot, fuse3, iproute2, inotify-tools
@@ -27,7 +27,7 @@ let
     cloud-hypervisor cosmic-files crosvm cryptsetup dbus execline
     fuse3 inotify-tools iproute2 jq kmod mdevd s6 s6-linux-init s6-rc
     socat spectrum-host-tools systemd util-linuxMinimal virtiofsd
-    xdg-desktop-portal-spectrum-host
+    xdg-desktop-portal-spectrum-host spectrum-router
 
     (foot.override { allowPgo = false; })
 
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
index 613a9e7..95fb291 100644
--- a/host/rootfs/file-list.mk
+++ b/host/rootfs/file-list.mk
@@ -27,6 +27,8 @@ FILES = \
 	image/etc/s6-linux-init/run-image/service/vm-services/run \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/run \
+	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/down \
+	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-fs/notification-fd \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-fs/run \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/notification-fd \
@@ -45,6 +47,7 @@ FILES = \
 	image/etc/xdg/weston/autolaunch \
 	image/etc/xdg/weston/weston.ini \
 	image/usr/bin/assign-devices \
+	image/usr/bin/assign-driver-router-iface \
 	image/usr/bin/create-vm-dependencies \
 	image/usr/bin/run-appimage \
 	image/usr/bin/run-vmm \
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/down b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/down
new file mode 100644
index 0000000..e69de29
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
new file mode 100755
index 0000000..fae9d9d
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
@@ -0,0 +1,13 @@
+#!/bin/execlineb -P
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
+
+importas -i VM VM
+
+background {
+  assign-driver-router-iface ${VM}
+}
+
+export RUST_LOG debug
+spectrum-router --app-listen-path ${VM}/router-app.sock --driver-listen-path ${VM}/router-driver.sock
+
diff --git a/host/rootfs/image/usr/bin/assign-driver-router-iface b/host/rootfs/image/usr/bin/assign-driver-router-iface
new file mode 100755
index 0000000..c555fb6
--- /dev/null
+++ b/host/rootfs/image/usr/bin/assign-driver-router-iface
@@ -0,0 +1,11 @@
+#!/bin/execlineb -S1
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
+
+# This script is to be called once it is known that this VM is a driver VM
+# (net provider) AND the vmm endpoint is ready.
+# It add the interface between the router and the driver VM.
+# Note: This script is designed to be re-entrant
+redirfd -w 2 /dev/null
+ch-remote --api-socket ${1}/vmm add-net id=router,vhost_user=on,socket=${1}/router-driver.sock,mac=02:01:00:00:00:01
diff --git a/host/rootfs/image/usr/bin/run-vmm b/host/rootfs/image/usr/bin/run-vmm
index 5649674..b3865ff 100755
--- a/host/rootfs/image/usr/bin/run-vmm
+++ b/host/rootfs/image/usr/bin/run-vmm
@@ -37,17 +37,7 @@ background -d {
     test $router_id != $1
   }
 
-  backtick -E mac {
-    pipeline { ip -j link show client-${client_id} }
-    pipeline { jq -r ".[].ifindex" }
-    awk "{
-      printf \"02:01:%02X:%02X:%02X:%02X\", $0 / 256 ^ 3 % 256,
-	$0 / 256 ^ 2 % 256, $0 / 256 % 256, $0 % 256
-    }"
-  }
-
-  ch-remote --api-socket /run/vm/by-id/${router_id}/vmm add-net
-    id=router-${client_id},tap=router-${client_id},mac=${mac}
+  assign-driver-router-iface /run/vm/by-id/${router_id}
 }
 unexport !
 fdmove -c 3 0
diff --git a/host/rootfs/image/usr/bin/vm-import b/host/rootfs/image/usr/bin/vm-import
index de88f08..c1d1bbc 100755
--- a/host/rootfs/image/usr/bin/vm-import
+++ b/host/rootfs/image/usr/bin/vm-import
@@ -14,19 +14,6 @@ if { ln -s -- ${dir} /run/vm/by-name/${1}.${name} }
 if { ln -s -- ${2}/${name} ${dir}/config }
 if { ln -s -- /run/service/vmm/instance/${id} ${dir}/service }
 
-if {
-  if -t { elglob -0d " " providers ${name}/providers/net test -n $providers }
-
-  if { ip link add br-${id} type bridge }
-  if { ip link set br-${id} up }
-
-  if { ip tuntap add client-${id} mode tap }
-  if { ip link set client-${id} master br-${id} up }
-
-  if { ip tuntap add router-${id} mode tap }
-  ip link set router-${id} master br-${id} up
-}
-
 if { create-vm-dependencies $id }
 
 s6-instance-create -- /run/service/vmm $id
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
index fdddae0..f894864 100644
--- a/pkgs/overlay.nix
+++ b/pkgs/overlay.nix
@@ -11,4 +11,5 @@
   );
 
   skawarePackages = import ./skaware-packages { inherit final super; };
+  mailutils = super.mailutils.overrideAttrs (_: { doCheck = false; });
 })
diff --git a/tools/start-vmm/ch.rs b/tools/start-vmm/ch.rs
index abe1742..56b18f4 100644
--- a/tools/start-vmm/ch.rs
+++ b/tools/start-vmm/ch.rs
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: EUPL-1.2+
 // SPDX-FileCopyrightText: 2022-2024 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
 
-use std::convert::TryFrom;
 use std::ffi::OsStr;
 use std::fs::File;
 use std::io::Write;
@@ -10,7 +10,6 @@ use std::num::NonZeroI32;
 use std::os::unix::prelude::*;
 use std::path::Path;
 use std::process::{Command, Stdio};
-use std::string::FromUtf8Error;
 
 use miniserde::{Serialize, json};
 
@@ -46,7 +45,7 @@ pub struct GpuConfig {
 
 #[derive(Serialize)]
 pub struct NetConfig {
-    pub fd: RawFd,
+    pub vhost_user_sock: String,
     pub id: String,
     pub mac: MacAddress,
 }
@@ -137,7 +136,10 @@ pub fn create_vm(vm_dir: &Path, ready_fd: File, mut config: VmConfig) -> Result<
 
 pub fn add_net(vm_dir: &Path, net: &NetConfig) -> Result<(), NonZeroI32> {
     let mut ch_remote = command(vm_dir, "add-net")
-        .arg(format!("fd={},id={},mac={}", net.fd, net.id, net.mac))
+        .arg(format!(
+            "vhost_user=on,socket={},id={},mac={}",
+            net.vhost_user_sock, net.id, net.mac
+        ))
         .stdout(Stdio::piped())
         .spawn()
         .or(Err(EPERM))?;
@@ -150,31 +152,3 @@ pub fn add_net(vm_dir: &Path, net: &NetConfig) -> Result<(), NonZeroI32> {
 
     Err(EPROTO)
 }
-
-#[repr(C)]
-pub struct NetConfigC {
-    pub fd: RawFd,
-    pub id: [u8; 18],
-    pub mac: MacAddress,
-}
-
-impl<'a> TryFrom<&'a NetConfigC> for NetConfig {
-    type Error = FromUtf8Error;
-
-    fn try_from(c: &'a NetConfigC) -> Result<NetConfig, Self::Error> {
-        let nul_index = c.id.iter().position(|&c| c == 0).unwrap_or(c.id.len());
-        Ok(NetConfig {
-            fd: c.fd,
-            id: String::from_utf8(c.id[..nul_index].to_vec())?,
-            mac: c.mac,
-        })
-    }
-}
-
-impl TryFrom<NetConfigC> for NetConfig {
-    type Error = FromUtf8Error;
-
-    fn try_from(c: NetConfigC) -> Result<NetConfig, Self::Error> {
-        Self::try_from(&c)
-    }
-}
diff --git a/tools/start-vmm/lib.rs b/tools/start-vmm/lib.rs
index 0422d85..246dd6d 100644
--- a/tools/start-vmm/lib.rs
+++ b/tools/start-vmm/lib.rs
@@ -1,23 +1,24 @@
 // SPDX-License-Identifier: EUPL-1.2+
 // SPDX-FileCopyrightText: 2022-2024 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
 
 mod ch;
 mod net;
 mod s6;
 
 use std::borrow::Cow;
-use std::convert::TryInto;
 use std::env::args_os;
 use std::ffi::OsStr;
 use std::fs::File;
-use std::io::{self, ErrorKind};
+use std::hash::{Hash, Hasher};
+use std::io::ErrorKind;
 use std::path::Path;
 
 use ch::{
-    ConsoleConfig, DiskConfig, FsConfig, GpuConfig, LandlockConfig, MemoryConfig, PayloadConfig,
-    VmConfig, VsockConfig,
+    ConsoleConfig, DiskConfig, FsConfig, GpuConfig, LandlockConfig, MemoryConfig, NetConfig,
+    PayloadConfig, VmConfig, VsockConfig,
 };
-use net::net_setup;
+use net::MacAddress;
 
 pub fn prog_name() -> String {
     args_os()
@@ -40,8 +41,6 @@ pub fn vm_config(vm_dir: &Path) -> Result<VmConfig, String> {
         return Err(format!("VM name may not contain a colon: {vm_name:?}"));
     }
 
-    let name_bytes = vm_name.as_bytes();
-
     let config_dir = vm_dir.join("config");
     let blk_dir = config_dir.join("blk");
     let kernel_path = config_dir.join("vmlinux");
@@ -97,24 +96,51 @@ pub fn vm_config(vm_dir: &Path) -> Result<VmConfig, String> {
             shared: true,
         },
         net: match net_providers_dir.read_dir() {
-            Ok(_) => {
-                // SAFETY: we check the result.
-                let net = unsafe {
-                    net_setup(
-                        name_bytes.as_ptr().cast(),
-                        name_bytes
-                            .len()
-                            .try_into()
-                            .map_err(|e| format!("VM name too long: {e}"))?,
-                    )
-                };
-                if net.fd == -1 {
-                    let e = io::Error::last_os_error();
-                    return Err(format!("setting up networking failed: {e}"));
-                }
-
-                vec![net.try_into().unwrap()]
-            }
+            Ok(entries) => entries
+                .into_iter()
+                .map(|result| {
+                    Ok(result
+                        .map_err(|e| format!("examining directory entry: {e}"))?
+                        .path())
+                })
+                .map(|result: Result<_, String>| {
+                    let provider_name = result?.file_name().ok_or("unable to get net provider name".to_string())?.to_str().unwrap().to_string();
+
+                    if provider_name.contains(',') {
+                        return Err(format!("illegal ',' character in net provider name {provider_name:?}"));
+                    }
+
+                    let mut hasher = std::hash::DefaultHasher::new();
+                    vm_name.hash(&mut hasher);
+                    let id_hashed = hasher.finish();
+
+                    let mac = MacAddress::new([
+                        0x02, // IEEE 802c administratively assigned
+                        0x00, // Spectrum client
+                        (id_hashed >> 24) as u8,
+                        (id_hashed >> 16) as u8,
+                        (id_hashed >> 8) as u8,
+                        id_hashed as u8,
+                    ]);
+
+                    let provider_id = std::fs::read_link(format!("/run/vm/by-name/{provider_name}")).map_err(|e| format!("unable to get net provider id: {e}"))?.file_name().ok_or("unable to get net provider id".to_string())?.to_str().unwrap().to_string();
+
+                    let svc_dir = format!("/run/service/vm-services/instance/{provider_id}/data/service/spectrum-router");
+                    let svc_status = std::process::Command::new("s6-svc")
+                        .args(["-U", &svc_dir])
+                        .status()
+                        .expect("setting up the upstream router via s6-svc failed");
+                    if !svc_status.success() {
+                        return Err(format!("setting up the upstream router via s6-svc failed with exit code {svc_status}"));
+                    }
+
+                    Ok(NetConfig {
+                        vhost_user_sock: format!("/run/vm/by-name/{provider_name}/router-app.sock"),
+                        id: provider_name,
+                        mac,
+                    })
+                })
+                .collect::<Result<_, _>>()?,
             Err(e) if e.kind() == ErrorKind::NotFound => Default::default(),
             Err(e) => return Err(format!("reading directory {net_providers_dir:?}: {e}")),
         },
diff --git a/tools/start-vmm/meson.build b/tools/start-vmm/meson.build
index d07c5a0..aa9f6f3 100644
--- a/tools/start-vmm/meson.build
+++ b/tools/start-vmm/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: EUPL-1.2+
 # SPDX-FileCopyrightText: 2022-2024 Alyssa Ross <hi@alyssa.is>
 
-c_lib = static_library('start-vmm', 'net.c', 'net-util.c',
+c_lib = static_library('start-vmm',
   c_args : '-D_GNU_SOURCE')
 
 rust_lib = static_library('start_vmm', 'lib.rs',
diff --git a/tools/start-vmm/net-util.c b/tools/start-vmm/net-util.c
deleted file mode 100644
index 49003e9..0000000
--- a/tools/start-vmm/net-util.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2+
-// SPDX-FileCopyrightText: 2022, 2024 Alyssa Ross <hi@alyssa.is>
-
-#include "net-util.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/ioctl.h>
-
-#include <linux/if_tun.h>
-
-int tap_open(char name[static IFNAMSIZ], int flags)
-{
-	struct ifreq ifr;
-	int fd, e;
-
-	if (strnlen(name, IFNAMSIZ) == IFNAMSIZ) {
-		errno = ENAMETOOLONG;
-		return -1;
-	}
-
-	strncpy(ifr.ifr_name, name, IFNAMSIZ - 1);
-	ifr.ifr_flags = IFF_TAP|flags;
-
-	if ((fd = open("/dev/net/tun", O_RDWR)) == -1)
-		return -1;
-	if (ioctl(fd, TUNSETIFF, &ifr) == -1) {
-		e = errno;
-		close(fd);
-		errno = e;
-		return -1;
-	}
-
-	strncpy(name, ifr.ifr_name, IFNAMSIZ);
-	return fd;
-}
diff --git a/tools/start-vmm/net-util.h b/tools/start-vmm/net-util.h
deleted file mode 100644
index 8f55206..0000000
--- a/tools/start-vmm/net-util.h
+++ /dev/null
@@ -1,6 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2+
-// SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
-
-#include <net/if.h>
-
-int tap_open(char name[static IFNAMSIZ], int flags);
diff --git a/tools/start-vmm/net.c b/tools/start-vmm/net.c
deleted file mode 100644
index 78fe7f6..0000000
--- a/tools/start-vmm/net.c
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2+
-// SPDX-FileCopyrightText: 2022-2024 Alyssa Ross <hi@alyssa.is>
-
-#include "ch.h"
-#include "net-util.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <arpa/inet.h>
-
-#include <linux/if_tun.h>
-
-static int get_tap_name(char tap_name[static IFNAMSIZ],
-                        const char tap_prefix[static 1],
-                        const char name[static 1], int name_len)
-{
-	int r = snprintf(tap_name, IFNAMSIZ, "%s-%*s", tap_prefix, name_len, name);
-	if (r >= IFNAMSIZ)
-		errno = ENAMETOOLONG;
-	return r < 0 || r >= IFNAMSIZ ? -1 : 0;
-}
-
-struct net_config net_setup(const char name[static 1], int name_len)
-{
-	int e;
-	unsigned int client_index;
-	struct net_config r = { .fd = -1, .mac = { 0 } };
-
-	if ((get_tap_name(r.id, "client", name, name_len)) == -1)
-		return r;
-
-	if (!(client_index = htonl(if_nametoindex(r.id))))
-		return r;
-
-	if ((r.fd = tap_open(r.id, IFF_NO_PI|IFF_VNET_HDR)) == -1)
-		goto fail_close;
-
-	r.mac[0] = 0x02; // IEEE 802c administratively assigned
-	r.mac[1] = 0x00; // Spectrum client
-	memcpy(&r.mac[2], &client_index, 4);
-
-	return r;
-
-fail_close:
-	e = errno;
-	close(r.fd);
-	errno = e;
-	r.fd = -1;
-	return r;
-}
diff --git a/tools/start-vmm/net.rs b/tools/start-vmm/net.rs
index ebfef7a..7b237df 100644
--- a/tools/start-vmm/net.rs
+++ b/tools/start-vmm/net.rs
@@ -2,14 +2,11 @@
 // SPDX-FileCopyrightText: 2022-2025 Alyssa Ross <hi@alyssa.is>
 
 use std::borrow::Cow;
-use std::ffi::{c_char, c_int};
 use std::fmt::{self, Display, Formatter};
 
 use miniserde::Serialize;
 use miniserde::ser::Fragment;
 
-use crate::ch::NetConfigC;
-
 #[repr(transparent)]
 #[derive(Copy, Clone)]
 pub struct MacAddress([u8; 6]);
@@ -36,14 +33,6 @@ impl Serialize for MacAddress {
     }
 }
 
-// SAFETY: declaration is compatible with C.
-unsafe extern "C" {
-    /// # Safety
-    ///
-    /// The rest of the result is only valid if the returned fd is not -1.
-    pub fn net_setup(name: *const c_char, len: c_int) -> NetConfigC;
-}
-
 #[cfg(test)]
 mod tests {
     use super::*;
diff --git a/tools/start-vmm/tests/meson.build b/tools/start-vmm/tests/meson.build
index bfdfc46..5538822 100644
--- a/tools/start-vmm/tests/meson.build
+++ b/tools/start-vmm/tests/meson.build
@@ -4,11 +4,6 @@
 rust_helper = static_library('test_helper', 'helper.rs',
   dependencies : rust_lib_dep)
 
-test('tap_open', executable('tap_open', 'tap_open.c', '../net-util.c',
-  c_args : '-D_GNU_SOURCE'))
-test('tap_open (name too long)', executable('tap_open-name-too-long',
-  'tap_open-name-too-long.c', '../net-util.c', c_args : '-D_GNU_SOURCE'))
-
 test('vm_command-basic', executable('vm_command-basic',
   'vm_command-basic.rs',
   dependencies : rust_lib_dep,
diff --git a/tools/start-vmm/tests/tap_open-name-too-long.c b/tools/start-vmm/tests/tap_open-name-too-long.c
deleted file mode 100644
index ba4ebd6..0000000
--- a/tools/start-vmm/tests/tap_open-name-too-long.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2+
-// SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
-
-#include "../net-util.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <net/if.h>
-#include <string.h>
-
-int main(void)
-{
-	char name[IFNAMSIZ];
-	int fd;
-
-	memset(name, 'a', sizeof name);
-	fd = tap_open(name, 0);
-	assert(fd == -1);
-	assert(errno == ENAMETOOLONG);
-}
diff --git a/tools/start-vmm/tests/tap_open.c b/tools/start-vmm/tests/tap_open.c
deleted file mode 100644
index bf5d00c..0000000
--- a/tools/start-vmm/tests/tap_open.c
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2+
-// SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
-
-#include "../net-util.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <sched.h>
-#include <string.h>
-
-#include <sys/ioctl.h>
-
-#include <linux/if_tun.h>
-
-int main(void)
-{
-	char name[IFNAMSIZ] = "tap%d";
-	struct ifreq ifr;
-	int fd;
-
-	unshare(CLONE_NEWUSER|CLONE_NEWNET);
-
-	fd = tap_open(name, 0);
-	if (fd == -1 && (errno == EPERM || errno == ENOENT))
-		return 77;
-	assert(!ioctl(fd, (unsigned)TUNGETIFF, &ifr));
-	assert(!strcmp(name, ifr.ifr_name));
-}
-- 
2.51.2


  parent reply	other threads:[~2025-11-28 22:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 22:30 [PATCH v2 0/7] spectrum-router Yureka Lilian
2025-11-28 22:30 ` [PATCH v2 1/7] vm/sys/net: remove connman Yureka Lilian
2025-11-29 13:06   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 2/7] vm/sys/net: integrate xdp-forwarder Yureka Lilian
2025-11-29 13:08   ` Alyssa Ross
2025-11-29 13:15     ` Yureka
2025-11-29 13:17       ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 3/7] vm/sys/net: add iwd Yureka Lilian
2025-11-29 13:09   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 4/7] tools: add spectrum-router Yureka Lilian
2025-11-29 13:18   ` Alyssa Ross
2025-11-28 22:30 ` Yureka Lilian [this message]
2025-11-29 13:46   ` [PATCH v2 5/7] host: integrate router Alyssa Ross
2025-11-29 14:28     ` Yureka
2025-11-29 14:44       ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 6/7] img/app: change to ipv6 nameserver Yureka Lilian
2025-11-29 13:20   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 7/7] checks/integration: Adapt networking test for ipv6 Yureka Lilian
2025-11-29 13:26   ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251128223038.97536-6-yureka@cyberchaos.dev \
    --to=yureka@cyberchaos.dev \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).