Rest-server listens only on IPv6

rest-server 0.10.0 (v0.10.0-8-gba581f2) compiled with go1.11.6 on linux/arm
rest-server 0.10.0 (v0.10.0-27-gc36ae5f) compiled with go1.13.7 on linux/amd64

Run as: rest-server --listen :8000 and rest-server --listen

rest-server only listens on tcp6 when using the --listen :8000 or --listen syntax, and when I try passing --listen twice it only uses the last instance. I have to pass a specific IPv4 address to have it listen on tcp4. Is this intended behaviour or should I report a bug? I’d like it to listen on v4 and v6.

Edit: this also seems to open up a can of worms: if restic resolves a host name that has IPv4 and v6 addresses, but it cannot connect to the v6 address, it fails, rather than attempting the v4 address; also might be a bug.

How did you check that rest-server is only accepting tcp6 connections? By default on Linux a IPv6 socket also accepts IPv4 connections (although there’s an option IPV6_V6ONLY to disable this behavior ipv6(7) - Linux manual page ).

Which backend did you use? I’d expect that most backends just use the standard golang dialer (net - The Go Programming Language) which is dual-stack capable and should automatically fallback to IPv4 if necessary. Your go version also seems to be quite old, at least Go 1.12 also seems to have enabled the dual-stack fallback by default.

1 Like

I think this was a fault with IPv4 on the host machine that sent me barking up the wrong tree. Thank you for the detailed reply and apologies for the noise.