Allow :: as a bind address (binds to first public IPv6 address) #1219

Merged
merged 1 commit into from Mar 19, 2016

Conversation

Projects
None yet
3 participants
@42wim
Contributor

42wim commented Sep 5, 2015

This patch allows "::" to -bind (as the IPv6 counterpart for the IPv4 0.0.0.0)
The behaviour is opposite of the IPv4 though, it will look for the first public accessible IPv6 address to bind to. (instead of the first private accessible address with IPv4).

As IPv6 does not really have private addresses (not including ULA), if you want to use IPv6 you probably want to bind to the Global Unicast Address.

With these modifications, you can run IPv6-only containers with consul without knowing the IPv6 address beforehand. And thus can setup a complete IPv6-only consul environment.

If you're interested in merging this I'll add tests too.

Impacts #725
Fixes #529 if -bind :: is used

@ryanbreen

This comment has been minimized.

Show comment
Hide comment
@ryanbreen

ryanbreen Sep 12, 2015

Contributor

This looks cool. Personally, I don't see any reason not to merge (with tests, though).

Contributor

ryanbreen commented Sep 12, 2015

This looks cool. Personally, I don't see any reason not to merge (with tests, though).

@42wim

This comment has been minimized.

Show comment
Hide comment
@42wim

42wim Sep 12, 2015

Contributor

Added tests (based on the ipv4 ones) and rebased

Contributor

42wim commented Sep 12, 2015

Added tests (based on the ipv4 ones) and rebased

@ryanbreen

This comment has been minimized.

Show comment
Hide comment
@ryanbreen

ryanbreen Sep 12, 2015

Contributor

Cool, this LGTM. Only question is whether @armon, @ryanuber, or @slackpad have philosophical objections to "first public IPv6" being a supported config when we've only ever offered first available private IP binding for IPv4.

I know there are systemic differences between IPv6 and IPv4 that make public IPs more appropriate in IPv6, but this is enough of a difference that I'm not comfortable merging without one of the project owners weighing in.

Contributor

ryanbreen commented Sep 12, 2015

Cool, this LGTM. Only question is whether @armon, @ryanuber, or @slackpad have philosophical objections to "first public IPv6" being a supported config when we've only ever offered first available private IP binding for IPv4.

I know there are systemic differences between IPv6 and IPv4 that make public IPs more appropriate in IPv6, but this is enough of a difference that I'm not comfortable merging without one of the project owners weighing in.

@42wim

This comment has been minimized.

Show comment
Hide comment
@42wim

42wim Sep 12, 2015

Contributor

Ok, also maybe I should rename it to the "first Global Unicast Address" instead of "first public IPv6" address.

Contributor

42wim commented Sep 12, 2015

Ok, also maybe I should rename it to the "first Global Unicast Address" instead of "first public IPv6" address.

@42wim

This comment has been minimized.

Show comment
Hide comment
@42wim

42wim Nov 9, 2015

Contributor

ping @armon, @ryanuber, @slackpad
Any comments ?

Contributor

42wim commented Nov 9, 2015

ping @armon, @ryanuber, @slackpad
Any comments ?

@slackpad slackpad self-assigned this Jan 8, 2016

@slackpad

This comment has been minimized.

Show comment
Hide comment
@slackpad

slackpad Mar 18, 2016

Contributor

Hi @42wim wow sorry for the delay on this one! I think we can take this if you can to a rebase and use [::] instead of :: so that it doesn't break any port number parsing on this in the future.

Contributor

slackpad commented Mar 18, 2016

Hi @42wim wow sorry for the delay on this one! I think we can take this if you can to a rebase and use [::] instead of :: so that it doesn't break any port number parsing on this in the future.

@slackpad slackpad removed the thinking label Mar 18, 2016

@42wim

This comment has been minimized.

Show comment
Hide comment
@42wim

42wim Mar 18, 2016

Contributor

Ok, I changed it to [::] and rebased

Contributor

42wim commented Mar 18, 2016

Ok, I changed it to [::] and rebased

+ if ip.To4() != nil {
+ continue
+ }
+ // do not bind link-local (fe80::/10) / ULA (fc00::/7) / loopback (::1)

This comment has been minimized.

@slackpad

slackpad Mar 18, 2016

Contributor

@42wim I had one other question for you - this will catch the cases you care about - will it knock out any useful addresses? It looks like it's blocking a superset of what you want to avoid.

@slackpad

slackpad Mar 18, 2016

Contributor

@42wim I had one other question for you - this will catch the cases you care about - will it knock out any useful addresses? It looks like it's blocking a superset of what you want to avoid.

This comment has been minimized.

@42wim

42wim Mar 19, 2016

Contributor

@slackpad Those FX::/yy ranges are reserved for specials. Never say never, but the chance that a new global unicast address range will be allocated from that range is very slim.

@42wim

42wim Mar 19, 2016

Contributor

@slackpad Those FX::/yy ranges are reserved for specials. Never say never, but the chance that a new global unicast address range will be allocated from that range is very slim.

This comment has been minimized.

@slackpad

slackpad Mar 19, 2016

Contributor

I noticed Go's net library had support for a couple of these so I tweaked this a little to be more specific.

@slackpad

slackpad Mar 19, 2016

Contributor

I noticed Go's net library had support for a couple of these so I tweaked this a little to be more specific.

This comment has been minimized.

@42wim

42wim Mar 20, 2016

Contributor

Oh nice! That's much better.

@42wim

42wim Mar 20, 2016

Contributor

Oh nice! That's much better.

@slackpad slackpad merged commit b5d4532 into hashicorp:master Mar 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@slackpad

This comment has been minimized.

Show comment
Hide comment
@slackpad

slackpad Mar 19, 2016

Contributor

Thanks!

Contributor

slackpad commented Mar 19, 2016

Thanks!

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