zerotier/terraform-provider-zerotier

6plane & rfc4193 addresses are flipped?

ethanjli opened this issue · 3 comments

v1.4.0 (and in particular #35) added rfc4193 and sixplane address calculations to member.go. As I understand it, this should expose the RFC4193 and 6PLANE addresses from the zerotier_member resource through the rfc4193 and sixplane properties, respectively. However, the addresses I'm getting from those properties are as follows:

  • the sixplane property seems to contain /128 addresses with format fd...9993... (which I'm pretty sure should actually be RFC4193 addresses?)
  • the rfc4193 property seems to contain /80 addresses with format fc...::1 (which I'm pretty sure should actually be 6PLANE addresses?)

These observations appear to be consistent with how the addresses are calculated in the code:

func sixPlaneAddress(nwid, nodeID string) string {
return buildIPV6("fd" + nwid + "9993" + nodeID)
}
func rfc4193Address(nwid, nodeID string) string {
nwidInt, _ := strconv.ParseUint(nwid, 16, 64)
networkMask := uint32((nwidInt >> 32) ^ nwidInt)
networkPrefix := strconv.FormatUint(uint64(networkMask), 16)
return buildIPV6("fc" + networkPrefix + nodeID + "000000000001")
}

I often get confused when troubleshooting whether I flipped something incorrectly - am I understanding the situation correctly as a bug in terraform-provider-zerotier@v1.4.0, or is this some other confusion on my part?

Hello!

Yes, this is absolutely a bug. I apologize for not catching it before merging.
-s

Sorry this took so long to get around to.
There's a fix released in v1.4.2
-s

No worries, and thanks!