Let the host choose where a guest's listening sockets bind

Abierto
#255 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@NopeCharon ya está trabajando en esto.

Desde el 19/11/2026.

  • #291 de @NopeCharon — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start by reading the SandboxBuilder, AppSandbox, socket bind/listen handling, and restore paths; the issue does not name specific files or tests. Work out how redirected host addresses should be reported and translated by net_getsockname, including port-zero binds and restored listeners. Done means the host can choose distinct listener addresses for each sandbox while guests see their requested addresses; the TCP-versus-listen decision and port-zero naming question need resolution first.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

A guest's listening socket is a host socket, bound at exactly the address and port the guest asks for. For a host that runs many sandboxes in one process and puts its own front end in front of each, that causes four problems:

  • A guest that binds 0.0.0.0, as most servers do, is reachable on every host interface, not only through the host's front end.
  • A restored guest re-binds the port it had at snapshot time. If another process or sandbox holds that port by then, the re-bind fails: the guest kernel logs hostsock: cannot re-create a listening socket after restore, the listener is dead (accept returns EIO, poll reports it hung up), and restore() still returns Ok, so the host is not told.
  • Two sandboxes restored from one snapshot both try the same port, so only one of them can listen. If the guest set SO_REUSEPORT, both bind, and the host kernel splits connections between them.
  • A guest that bound port 0 is silently given a different port on restore.

ListenPorts limits which ports a guest may bind, not where they are bound (#184 is related).

Proposal: a SandboxBuilder option that redirects listens. Whatever address and port a guest's listening socket asks for, the host socket is bound to an address the host chooses (for example 127.0.0.1:0), and AppSandbox reports the real address for each guest port, e.g. listen_addr(guest_port) -> Option<SocketAddr>. net_getsockname translates back to the guest's address, for listeners and the connections they accept. A restore re-establishes listeners through the same redirect, so each restored sandbox gets a port of its own.

Open questions:

  • Bind comes before listen, so the host cannot yet tell a listener from a UDP server or a client choosing its source port. Should the redirect apply to TCP sockets only, or be decided at listen?
  • How should listen_addr name a guest listener that bound port 0?
Lenguaje dominante
Rust
Estrellas
72
Forks
14
Merge medio
15 h 29 min
PR fusionados (30 d)
40

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hyperlight-dev/hyperlight-unikraft

Todos los issues de hyperlight-dev/hyperlight-unikraft

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.