Commit Graph

1 Commits (90f47bbf5bde446c67cab2ed8849abe744515c20)

Author SHA1 Message Date
kari-ts 94f2829e7c
android: fix local endpoint parsing and add regression ifaceparse_test (#728)
Android reports interface addresses in CIDR form. Recent changes
(see 9c933a08a2 (diff-1d627686c31972e04ef60d7d301e8a2a93714c60096a50055a6bbe9aa041ca8fL105),  9c933a08a2 (diff-1d627686c31972e04ef60d7d301e8a2a93714c60096a50055a6bbe9aa041ca8fL105)) parsed addresses as CIDR prefixes, resulting in prefix base being advertised as a local endpoint.
This change:
-instead of parsing CIDR prefixes, the parser strips the /NN portion and uses netip.ParseAddr to parse the host IP only
-extracts the interface parsing into a helper in a new package to make it testable on non-Android platforms
-adds a unit test to verify that host addresses are present and prefix-base ones are not

Fixes tailscale/tailscale#16836

Signed-off-by: kari-ts <kari@tailscale.com>
3 weeks ago