appc: add test to ensure that individual IPs are not removed during route updates

If control advised the connector to advertise a route that had already
been discovered by DNS it would be incorrectly removed. Now those routes
are preserved.

Updates tailscale/corp#16833

Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
James Tucker
2024-01-22 16:18:57 -08:00
committed by James Tucker
parent ce4553b988
commit 0e2cb76abe
3 changed files with 45 additions and 4 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ nextRoute:
for _, r := range routes {
for _, addr := range e.domains {
for _, a := range addr {
if r.Contains(a) {
if r.Contains(a) && netip.PrefixFrom(a, a.BitLen()) != r {
pfx := netip.PrefixFrom(a, a.BitLen())
toRemove = append(toRemove, pfx)
continue nextRoute