Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Initial support for IPv6 #6620
Conversation
macgreagoir
changed the base branch from
staging
to
develop
Nov 28, 2016
|
!!retry!! |
jameinel
approved these changes
Nov 28, 2016
I have a couple of small tweaks, but I think the overall changes of switching to 'localhost' from '127.0.0.1' is all good.
I'm a little concerned still about machineLocal=true, and what actual addresses are getting filtered by the 'ip.IP4() == nil' check.
| + // We won't reconnect when there's an X509 | ||
| + // error because we're not going to succeed if | ||
| + // we retry in that case. | ||
| + logger.Errorf("certificate error dialing %q: %v", cfg.Location, err) |
macgreagoir
Nov 28, 2016
Contributor
It is, aye. It's something I added for clarity in my own testing and thought was worth keeping.
| - logger.Debugf("skipping observed IPv6 address %q on %q: not fully supported yet", ip, interfaceName) | ||
| - // TODO(dimitern): Treat IPv6 addresses as empty until we can handle | ||
| - // them reliably. | ||
| + if ip.To4() == nil && ip.IsLinkLocalUnicast() { |
jameinel
Nov 28, 2016
Owner
What do we do with the other IPv6 addresses?
Would it be more obvious if we did:
if ip.To6() != nil && ip.IsLinkLocalUnicast() ?
I almost wonder if for now we'd want to break this up into:
if ip.IP6() != nil {
if ip.IsLinkLocalUnicast() {
logger.Debugf("skipping observed IPv6 link-local...")
} else {
logger.Debugf("including ipv6 address %s")
}
}
macgreagoir
Nov 28, 2016
Contributor
The net package doesn't have a direct check for IPv6, that I can see. To4() will tell us that we have a valid 4-byte representation, therefore an IPv4 address, but To16() can return a valid 16-byte address of either version, hence the use in this case filter out link-local but allow usable IPv6 addresses.
I could add our own checks for non-link-local IPv6 addresses to filter, but this does seem like code to maintain where we needn't. What do you think?
| @@ -978,6 +978,8 @@ func (s *TypesSuite) TestGetObservedNetworkConfigLoopbackInfrerred(c *gc.C) { | ||
| ConfigType: "loopback", // since it is a loopback | ||
| }, { | ||
| DeviceIndex: 1, | ||
| + CIDR: "::1/128", |
jameinel
Nov 28, 2016
Owner
Should this be a new section, rather than just adding to this scenario?
I feel like we should handle IPv4-only loopback as well, shouldn't we?
macgreagoir
Nov 28, 2016
Contributor
I'm not sure this is still a likely use case. I see both versions everywhere.
| - return network.SelectMongoHostPortsByScope(hostPorts, true)[0] | ||
| + return network.SelectMongoHostPortsByScope( | ||
| + hostPorts, | ||
| + network.HostPortWithIPv4Address(hostPorts), |
jameinel
Nov 28, 2016
Owner
can you use a local variable so that the meaning of this makes more sense? When I read it at a glance it looks like we are only selecting IPv4 addresses.
allowMachineLocal := network.HostPortWithIPv4Address(hostPorts)
return network.SelectMongoHostPortsByScope(hostPorts, allowMachineLocal)
I'm still not 100% sold on using machine local. This feels more like "if we don't have a cloud-local then maybe we can fall back to localhost".
Given its the address we are putting into the replicaSet, it seems like it can't ever be right to give a link local address if you are ever actually in a peer group.
macgreagoir
Nov 28, 2016
Contributor
I'm inclined to agree with you about the original, and continuing IPv4, behaviour. Falling back to loopback/localhost can seem like a bad idea for the replicaset config, though it doesn't cause a problem if HA is never enabled.
Can I suggest that this is machine-local question is a separate bug to be considered outside this change, as a new behaviour?
| @@ -335,6 +335,20 @@ func SelectMongoHostPortsBySpaces(hostPorts []HostPort, spaces []SpaceName) ([]s | ||
| return HostPortsToStrings(filteredHostPorts), ok | ||
| } | ||
| +// HostPortWithIPv4Address returns true if the passed slice of HostPort | ||
| +// contains an IPv4 address that is not just a loopback address. | ||
| +func HostPortWithIPv4Address(hostPorts []HostPort) bool { |
jameinel
Nov 28, 2016
Owner
The name sounds like it is returning a HostPort, maybe:
HostPortsHaveIPv4Address()
Not sure what name, but something that makes it clearer the function is returning a boolean.
| +// contains an IPv4 address that is not just a loopback address. | ||
| +func HostPortWithIPv4Address(hostPorts []HostPort) bool { | ||
| + for _, hp := range hostPorts { | ||
| + logger.Debugf("found Address of Value %q, Type %q and Scope %q", |
| @@ -258,7 +258,7 @@ if [ $stopped -ne 1 ]; then | ||
| service %s stop | ||
| fi | ||
| rm -f /etc/init/juju* | ||
| -rm -f /etc/systemd/system/juju* | ||
| +rm -f /etc/systemd/system{,/multi-user.target.wants}/juju* |
jameinel
Nov 28, 2016
Owner
Does this have anything to do with IPv6 or is it just a drive by that you encountered. Should we be tagging a bug about this so people can know where/when it was fixed?
|
!!retry!! |
|
!!retry!! |
|
!!retry!! |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
@bz2 Thanks for the manual stop :-) I'll $$merge$$ with squash now. |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
macgreagoir commentedNov 25, 2016
Adds support for IPv6, but without requiring IPv6.
There are some known issues that should not break, or be broken by, this
commit:
IPv6 loopback addresses, is not always satisfied in Ubuntu builds
(lp:1644009), but
version specified for lo in ENI, so loopback will resolve to a usable
loopback address in any case
commented with
TODO(macgreagoir) IPv6. ...enabled-hausing existing machines (lp:1642618)requires a work-around for HA
QA steps: