m-lab / uuid-annotator

Produces metadata locally for every connection on each server.
Apache License 2.0
0 stars 0 forks source link

Append IPv6 address to localIPs #63

Closed nkinkade closed 9 months ago

nkinkade commented 9 months ago

GCP VMs do not have their public IP addresses configured on local interfaces. uuid-annotator need to be able to identify whether the server or client was the source of a particular TCP flow, and uses the addresses it finds on the local interface to help determine this. There was already a bit of code to append the IPv4 address of a VM to the localIPs variable, and this PR just adds the IPv6 address too.

Additionally, instead of calling net.ParseCIDR() a second time, just use the net.IPNet values already provided by parseCIDR earlier in the same function.

Fixes a unit test to expect an IPv6 address, and converts the appended IPv4 address to a 4-byte representation to match was is actually appended to localIPs.


This change is Reviewable