From 2329282c4a811335d09111b2f2af5e903598f338 Mon Sep 17 00:00:00 2001 From: Hayato Kiwata Date: Wed, 23 Sep 2026 00:38:59 +0900 Subject: [PATCH] fix: forward startup messages to logWriter Currently, the startup messages printed by pasta are discarded, because `logWriter` is passed to `pasta.NewParentDriver` but never used. This commit forwards them to `logWriter` so that they appear in the debug log, like the slirp4netns driver does. After applying this commit, the following log is shown with `--debug`: ```bash DEBU[0000] [rootlesskit:parent] network/pasta: UNIX domain socket bound at /tmp/haytok/.pasta.sock DEBU[0000] [rootlesskit:parent] network/pasta: Configuration socket: /tmp/haytok/.pasta.sock DEBU[0000] [rootlesskit:parent] network/pasta: Template interface: dummy42 (IPv4), dummy42 (IPv6) DEBU[0000] [rootlesskit:parent] network/pasta: Namespace interface: tap0 DEBU[0000] [rootlesskit:parent] network/pasta: MAC: DEBU[0000] [rootlesskit:parent] network/pasta: host: 9a:55:9a:55:9a:55 DEBU[0000] [rootlesskit:parent] network/pasta: DHCP: DEBU[0000] [rootlesskit:parent] network/pasta: assign: 10.0.2.100 DEBU[0000] [rootlesskit:parent] network/pasta: mask: 255.255.255.0 DEBU[0000] [rootlesskit:parent] network/pasta: router: 10.0.2.2 DEBU[0000] [rootlesskit:parent] network/pasta: DNS: DEBU[0000] [rootlesskit:parent] network/pasta: 10.0.2.3 DEBU[0000] [rootlesskit:parent] network/pasta: DNS search list: DEBU[0000] [rootlesskit:parent] network/pasta: . DEBU[0000] [rootlesskit:parent] network/pasta: NDP/DHCPv6: DEBU[0000] [rootlesskit:parent] network/pasta: assign: fd00::100 DEBU[0000] [rootlesskit:parent] network/pasta: router: fd00::2 DEBU[0000] [rootlesskit:parent] network/pasta: our link-local: fe80::9cca:6ff:fe87:1ae1 DEBU[0000] [rootlesskit:parent] network/pasta: DNS search list: DEBU[0000] [rootlesskit:parent] network/pasta: . DEBU[0000] [rootlesskit:parent] network/pasta: Inbound forwarding rules (HOST): DEBU[0000] [rootlesskit:parent] network/pasta: Outbound forwarding rules (SPLICE): ``` Signed-off-by: Hayato Kiwata --- pkg/network/pasta/pasta.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/network/pasta/pasta.go b/pkg/network/pasta/pasta.go index 3bb3a8c3..0dd7297e 100644 --- a/pkg/network/pasta/pasta.go +++ b/pkg/network/pasta/pasta.go @@ -1,6 +1,8 @@ package pasta import ( + "bufio" + "bytes" "context" "errors" "fmt" @@ -246,6 +248,10 @@ func (d *parentDriver) ConfigureNetwork(childPID int, stateDir, detachedNetNSPat } return nil, common.Seq(cleanups), fmt.Errorf("executing %v: %w", cmd, err) } + s := bufio.NewScanner(bytes.NewReader(out)) + for s.Scan() { + fmt.Fprintln(d.logWriter, s.Text()) + } netmsg := messages.ParentInitNetworkDriverCompleted{ Dev: tap,