You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/net/interfaces
Brad Fitzpatrick 2a67beaacf net/interfaces: bound Linux /proc/net/route parsing
tailscaled was using 100% CPU on a machine with ~1M lines, 100MB+
of /proc/net/route data.

Two problems: in likelyHomeRouterIPLinux, we didn't stop reading the
file once we found the default route (which is on the first non-header
line when present). Which meant it was finding the answer and then
parsing 100MB over 1M lines unnecessarily. Second was that if the
default route isn't present, it'd read to the end of the file looking
for it. If it's not in the first 1,000 lines, it ain't coming, or at
least isn't worth having. (it's only used for discovering a potential
UPnP/PMP/PCP server, which is very unlikely to be present in the
environment of a machine with a ton of routes)

Change-Id: I2c4a291ab7f26aedc13885d79237b8f05c2fd8e4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
3 years ago
..
interfaces.go net/interfaces: define DefaultRouteInterface and State.DefaultRouteInterface 3 years ago
interfaces_darwin.go net/interfaces: define DefaultRouteInterface and State.DefaultRouteInterface 3 years ago
interfaces_darwin_test.go net/{dnscache,interfaces}: use netaddr.IP.IsPrivate, delete copied code 3 years ago
interfaces_default_route_test.go all: gofmt with Go 1.17 3 years ago
interfaces_defaultrouteif_todo.go net/interfaces: define DefaultRouteInterface and State.DefaultRouteInterface 3 years ago
interfaces_linux.go net/interfaces: bound Linux /proc/net/route parsing 3 years ago
interfaces_linux_test.go net/interfaces: bound Linux /proc/net/route parsing 3 years ago
interfaces_test.go net/interfaces: define DefaultRouteInterface and State.DefaultRouteInterface 3 years ago
interfaces_windows.go net/interfaces: define DefaultRouteInterface and State.DefaultRouteInterface 3 years ago
interfaces_windows_test.go net/interfaces: quiet PAC detection logging in no-PAC case, add benchmark 4 years ago