net/netutil: allow 16-bit 4via6 site IDs

The prefix has space for 32-bit site IDs, but the validateViaPrefix
function would previously have disallowed site IDs greater than 255.

Fixes tailscale/corp#16470

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I4cdb0711dafb577fae72d86c4014cf623fa538ef
This commit is contained in:
Andrew Dunham
2024-01-05 15:21:48 -05:00
parent 05093ea7d9
commit 20f3f706a4
3 changed files with 26 additions and 7 deletions
+2 -2
View File
@@ -693,8 +693,8 @@ func runVia(ctx context.Context, args []string) error {
if err != nil {
return fmt.Errorf("invalid site-id %q; must be decimal or hex with 0x prefix", args[0])
}
if siteID > 0xff {
return fmt.Errorf("site-id values over 255 are currently reserved")
if siteID > 0xffff {
return fmt.Errorf("site-id values over 65535 are currently reserved")
}
ipp, err := netip.ParsePrefix(args[1])
if err != nil {