go binaries use bind on startup, requiring network-bind
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snappy |
Fix Released
|
Medium
|
Unassigned |
Bug Description
This bug is here to investigate why spread, our test suite runner and a go binary uses bind() on startup, failing as it does not use the network-bind interface.
The strace log of "spread -list" is attached to the bug. The key parts seem to be:
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
close(3) = 0
Hmm? ^^ Perhaps just a test if "Can I haz socket?"
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
bind(3, {sa_family=
futex(0xb58cd0, FUTEX_WAKE, 1) = 1
futex(0xb58c10, FUTEX_WAKE, 1) = 1
We have a IPv6 TCP socket bound to ::1 as the fd 3
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 4
setsockopt(4, SOL_IPV6, IPV6_V6ONLY, [0], 4) = 0
bind(4, {sa_family=
futex(0xb58cd0, FUTEX_WAKE, 1) = 1
futex(0xb58c10, FUTEX_WAKE, 1) = 1
We have a IPv6 TCP socket bound to ::ffff:127.0.0.1 (aka IPv4 in IPv4 version of the ::1 above) as fd 4
close(4) = 0
close(3) = 0
Both sockets are closed here.
description: | updated |
description: | updated |
tags: |
added: snapd-interface removed: snapd-interfaces |
This seems to be go runtime startup:
// Should we try to use the IPv4 socket interface if we're ip6.v6only" .
// only dealing with IPv4 sockets? As long as the host system
// understands IPv6, it's okay to pass IPv4 addresses to the IPv6
// interface. That simplifies our code and is most general.
// Unfortunately, we need to run on kernels built without IPv6
// support too. So probe the kernel to figure it out.
//
// probeIPv6Stack probes both basic IPv6 capability and IPv6 IPv4-
// mapping capability which is controlled by IPV6_V6ONLY socket
// option and/or kernel state "net.inet6.
// It returns two boolean values. If the first boolean value is
// true, kernel supports basic IPv6 functionality. If the second
// boolean value is true, kernel supports IPv6 IPv4-mapping.
func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) {
...
}