gvisor-tap-vsock icon indicating copy to clipboard operation
gvisor-tap-vsock copied to clipboard

make code ipv6 safe

Open Luap99 opened this issue 4 years ago • 1 comments

In many places strings.Split(remote, ":") is used to split the ip and port. This does not work for ipv6 addresses.

https://github.com/containers/gvisor-tap-vsock/blob/9d8e7a5c6c5ac56290da3d78c5cd65cc59fff98a/pkg/services/forwarder/ports.go#L53-L56

To make this work with ipv6 addresses net.SplitHostPort should be used, https://pkg.go.dev/net#SplitHostPort. To combine a port with a ip address use net.JoinHostPort, https://pkg.go.dev/net#JoinHostPort

Luap99 avatar Sep 22 '21 16:09 Luap99

Very good point! ipv6 also deserves e2e tests I guess.

guillaumerose avatar Sep 23 '21 08:09 guillaumerose