tailscale/net/interfaces
David Crawshaw 1c238cdce6 net/interfaces: use a uint32_t for ipv4 address
The code was using a C "int", which is a signed 32-bit integer.
That means some valid IP addresses were negative numbers.
(In particular, the default router address handed out by AT&T
fiber: 192.168.1.254. No I don't know why they do that.)
A negative number is < 255, and so was treated by the Go code
as an error.

This fixes the unit test failure:

	$ go test -v -run=TestLikelyHomeRouterIPSyscallExec ./net/interfaces
	=== RUN   TestLikelyHomeRouterIPSyscallExec
	    interfaces_darwin_cgo_test.go:15: syscall() = invalid IP, false, netstat = 192.168.1.254, true
	--- FAIL: TestLikelyHomeRouterIPSyscallExec (0.00s)

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
(cherry picked from commit d139fa9c92)
2021-02-02 14:58:45 -08:00
..
interfaces_darwin_cgo_test.go net/interfaces: use syscalls to find private gateway IP address 2020-08-04 15:45:56 -07:00
interfaces_darwin_cgo.go net/interfaces: use a uint32_t for ipv4 address 2021-02-02 14:58:45 -08:00
interfaces_darwin_nocgo.go net/interfaces: use syscalls to find private gateway IP address 2020-08-04 15:45:56 -07:00
interfaces_darwin.go go.mod: upgrade staticcheck to 0.1.0 2020-12-14 14:01:29 -08:00
interfaces_defaultrouteif_todo.go net/interfaces, net/netns: move default route interface code to interfaces 2020-09-22 19:02:17 -07:00
interfaces_linux_test.go net/netns, net/interfaces: move defaultRouteInterface, add Android fallback 2020-08-10 13:02:47 -07:00
interfaces_linux.go net/netns, net/interfaces: move defaultRouteInterface, add Android fallback 2020-08-10 13:02:47 -07:00
interfaces_test.go net/interfaces: remove IsTailscaleIP, make callers use tsaddr. 2021-01-26 15:10:51 -08:00
interfaces_windows_test.go net/interfaces: quiet PAC detection logging in no-PAC case, add benchmark 2020-10-01 22:02:39 -07:00
interfaces_windows.go net/interfaces: ignore bogus proxy URLs from winhttp [windows] 2020-11-10 11:30:18 -08:00
interfaces.go net/interfaces: don't send over zt* interfaces 2021-01-26 15:20:43 -08:00
route.h net/interfaces: use syscalls to find private gateway IP address 2020-08-04 15:45:56 -07:00