Don't delete static host mappings for non-primary IPs #1464
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1447
The config of Nebula included a static host mapping for one IP of the host. The host's certificate includes multiple IPs. Spelunking through the code, the function DeleteVpnAddrs is updated in master to support a host with multiple IPs. However, that function will only skip address deletion if the first IP in the certificate is recorded as having a static host mapping entry. We believe that in the user's reported case, the first IP in the host cert was not the IP listed in the config's static host mapping.
Reading through the code to investigate this issue, I noticed that unlockedGetRemoteList may also overwrite a static mapping if it receives a list of IP's and if the first IP in the slice is not in the addrMap but any subsequent IP is in the map. In that case, the subsequent IP entries will be overwritten by the newly created entry.
To close this issue, investigate the lighthouse addrMap to cover the scenario in which a given host's secondary IP appears in the static host map.
Add tests to prove this is fixed!