Skip to content

fix(pasta): assign a fixed IPv6 address, gateway, and DNS to the netns - #620

Merged
AkihiroSuda merged 1 commit into
rootless-containers:masterfrom
haytok:assign-fixed-ipv6
Sep 8, 2026
Merged

fix(pasta): assign a fixed IPv6 address, gateway, and DNS to the netns#620
AkihiroSuda merged 1 commit into
rootless-containers:masterfrom
haytok:assign-fixed-ipv6

Conversation

@haytok

@haytok haytok commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Currently, curl -fsSL http://[${parent_ipv6}]:8080 fails when running hack/integration-ipv6.sh with --net=pasta.

This is because pasta copies the destination address ${parent_ipv6} into the isolated netns and the destination becomes a local address inside the netns.

To begin with, the only interface on the host with an available IPv6 route is the dummy interface (dummy42), so it is selected as the template, and its address and route are duplicated into the netns by nl_addr_dup() and nl_route_dup() [1].

As a result, the route to ${parent_ipv6} becomes local, the packets never leave the netns, and they do not reach the httpd running on the host.

To resolve this error, pass --address, --gateway, and --dns-forward when running pasta, so that a fixed IPv6 configuration is assigned to tap0 inside the netns.

child: fd00::100
gateway: fd00::2
DNS: fd00::3

With these options, pasta executes nl_addr_set() and nl_route_set_def() [1] in pasta.c instead of nl_addr_dup() and nl_route_dup(), and assigns the specified address and route to tap0 inside the netns.

As a result, ${parent_ipv6} is no longer duplicated into the netns, and when running curl -fsSL http://[${parent_ipv6}]:8080 inside the netns, packets leave the netns through tap0.

On the host side, pasta relays the connection to the httpd, so the curl now succeeds.

[1] https://passt.top/passt/tree/pasta.c

Currently, `curl -fsSL http://[${parent_ipv6}]:8080` fails when running
`hack/integration-ipv6.sh` with `--net=pasta`.

This is because pasta copies the destination address `${parent_ipv6}` into
the isolated netns and the destination becomes a local address inside the
netns.

To begin with, the only interface on the host with an available IPv6 route
is the dummy interface (`dummy42`), so it is selected as the template, and
its address and route are duplicated into the netns by `nl_addr_dup()` and
`nl_route_dup()` [1].

As a result, the route to `${parent_ipv6}` becomes `local`, the packets
never leave the netns, and they do not reach the httpd running on the
host.

To resolve this error, pass `--address`, `--gateway`, and `--dns-forward`
when running pasta, so that a fixed IPv6 configuration is assigned to tap0
inside the netns.

  child:   fd00::100
  gateway: fd00::2
  DNS:     fd00::3

With these options, pasta executes `nl_addr_set()` and
`nl_route_set_def()` [1] in `pasta.c` instead of `nl_addr_dup()` and
`nl_route_dup()`, and assigns the specified address and route to tap0
inside the netns.

As a result, `${parent_ipv6}` is no longer duplicated into the netns, and
when running `curl -fsSL http://[${parent_ipv6}]:8080` inside the netns,
packets leave the netns through tap0.

On the host side, pasta relays the connection to the httpd, so the curl
now succeeds.

[1] https://passt.top/passt/tree/pasta.c

Signed-off-by: Hayato Kiwata <dev@haytok.jp>
@AkihiroSuda AkihiroSuda added this to the v3.2.0 milestone Aug 25, 2026
return res, nil
}

func AddIPInt6(ip net.IP, i int) (net.IP, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead you could call https://pkg.go.dev/net/netip#Addr.Next multiple times ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will fix on another PR.

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging anyway, thanks

@AkihiroSuda
AkihiroSuda merged commit d6eed84 into rootless-containers:master Sep 8, 2026
8 checks passed
@haytok

haytok commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review!!

By the way, what would it take for --net=pasta and --port-driver=pesto to no longer be marked as experimental?

@AkihiroSuda

Copy link
Copy Markdown
Member

By the way, what would it take for --net=pasta and --port-driver=pesto to no longer be marked as experimental?

Let's wait for a couple of months to confirm that nobody is experiencing a serious issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants