Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wan address isn't used by peering token #15065

Merged
merged 4 commits into from
Oct 20, 2022
Merged

Conversation

huikang
Copy link
Collaborator

@huikang huikang commented Oct 19, 2022

Description

Use wan address in the peering token.

Testing & Reproduction steps

With the following agent config,

{
   bind_addr =  “172.16.1.10”
   advertise_addr_wan = “192.168.1.10"
}
ports {
  grpc_tls = 8502
  serf_wan = 8302
},

the generated token always has the private bind address in "ServerAddresses":["172.16.1.10:8502"]," , which prevents the peering cluster from reaching the acceptor cluster.

Links

fix #15051

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

@huikang huikang requested a review from freddygv October 19, 2022 20:35
@@ -205,23 +205,38 @@ func meshGatewayAdresses(state *state.Store, ws memdb.WatchSet, wan bool) ([]str
return addrs, nil
}

func parseNodeAddr(node *structs.ServiceNode) string {
// Prefer the wan address
if v, ok := node.TaggedAddresses[structs.TaggedAddressWANIPv4]; ok {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note - I don't make use of advertise_addr_wan_ipv6 (ipv6.disable=1), but others may; what should the preference/priority be between advertise_addr_wan, advertise_addr_wan_ipv4, and advertise_addr_wan_ipv6?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question, will see about how that preference could be communicated in a follow-up PR.

For now will defer to the parsed TaggedAddressWAN, which could be IPv6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster peering disregards advertise_addr_wan and advertise_addr_wan_ipv4
3 participants