Prefer IPv4 over IPv6 in Select Address functions #6338

Merged
merged 6 commits into from Sep 29, 2016

Conversation

Projects
None yet
4 participants

Prefer IPv4 addresses over IPv6 or hostnames in the select address functions. This means that unit dns-name (which comes from machine preferred public address) will always be an IPv4 address if one is available.

QA
Bootstrap to lxd.
Deploy ubuntu to >10 machines.
All machines should have IPv4 addresses rather than IPv6 ones.

A few questions, but otherwise looks OK.

@@ -398,7 +412,6 @@ var selectInternalTests = []selectTest{{
network.NewScopedAddress("2001:db8::1", network.ScopePublic),
network.NewScopedAddress("fc00::1", network.ScopeCloudLocal),
network.NewScopedAddress("8.8.8.8", network.ScopePublic),
- network.NewScopedAddress("10.0.0.1", network.ScopeCloudLocal),
@dimitern

dimitern Sep 28, 2016

Contributor

Why remove this?

@voidspace

voidspace Sep 28, 2016

Because otherwise it is selected in preference to the IPv6 one and its presence isn't relevant to that specific test.

@@ -407,7 +420,6 @@ var selectInternalTests = []selectTest{{
network.NewScopedAddress("8.8.8.8", network.ScopePublic),
network.NewScopedAddress("2001:db8::1", network.ScopePublic),
network.NewScopedAddress("fc00::1", network.ScopeCloudLocal),
- network.NewScopedAddress("10.0.0.1", network.ScopeCloudLocal),
@@ -458,9 +478,19 @@ var selectInternalMachineTests = []selectTest{{
network.NewScopedAddress("fe80::1", network.ScopeLinkLocal),
network.NewScopedAddress("127.0.0.2", network.ScopeMachineLocal),
},
+ 4,
+}, {
+ "first machine local non-IPv4 address is selected even with public/cloud hostnames",
@dimitern

dimitern Sep 28, 2016

Contributor

There are no IPv4 local-machine addresses here, so either the comment is wrong or something else?

@voidspace

voidspace Sep 28, 2016

There has to be no IPv4 addresses or they will be selected in preference - hence this is a test for "non IPv4 address" selection.

@dimitern

dimitern Sep 28, 2016

Contributor

Uhh sorry, I should've read more carefully.

👍

$$merge$$

Contributor

jujubot commented Sep 28, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Sep 28, 2016

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/9351

$$merge$$

Contributor

jujubot commented Sep 29, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Sep 29, 2016

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/9362

$$merge$$

Contributor

jujubot commented Sep 29, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 8f7ead3 into juju:master Sep 29, 2016

@voidspace voidspace deleted the voidspace:preferred-address-ipv6 branch Oct 6, 2016

Contributor

frobware commented Oct 12, 2016

For reference this fixed: https://launchpad.net/bugs/1624495

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