mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-20 16:51:18 -08:00
* k8s-operator: stop PortRanges.All() at the last port in the range PortRanges.All() walks a range with a uint16 counter and a port <= end condition. When end is 65535 the increment wraps back to zero instead of ending the loop, so the iterator restarts at 0 and yields the whole port space again, and again. ClashesWith is the caller that drains All(), so it is where this shows. With one ProxyClass holding 40000-65535, validating a second one holding 30000-30100 walks up to 65535, wraps, and reaches 30000 on the next pass, where Contains returns true. The two ranges are disjoint, but the second ProxyClass is rejected as clashing and never goes valid. allocatePorts stops at the first free port so it returns, but once past 65535 the port it picks is outside the range that was configured. endPort is only bounded by the cluster's --service-node-port-range, so 65535 is reachable on a cluster configured up to it. Yield end and then stop. Also skip a range whose Port is above its EndPort, which the old condition did for free and the new one would not. Fixes #21304 Change-Id: I7d60b133a4a83678bc6aba76c5f9b6b6e9e4e984 Signed-off-by: leoca <[email protected]> * k8s-operator: fix copyright header on types_proxyclass_test.go TestLicenseHeaders wants "Tailscale Inc & contributors"; the new test file had the older "Tailscale Inc & AUTHORS" wording and failed the licenses check. Change-Id: I3217a0795d1c23aba5eb01b3b62ee825efa0f137 Signed-off-by: leoca <[email protected]> * k8s-operator: count PortRanges.All() with an int An int counter cannot wrap at 65535 and an inverted range still yields nothing, so the explicit guard and the break on end are not needed. Change-Id: Ia3de3c0e1336f821a6c99af4e23f221024582e53 Signed-off-by: leoca <[email protected]> --------- Signed-off-by: leoca <[email protected]>