MCPcopy
hub / github.com/safing/portmaster / TestGetInterfaceByIP_LinkLocalIPv4

Function TestGetInterfaceByIP_LinkLocalIPv4

service/netenv/interfaces_test.go:280–288  ·  view source on GitHub ↗

TestGetInterfaceByIP_LinkLocalIPv4 verifies that IPv4 link-local addresses (APIPA range 169.254.x.x) are filtered out of the cache.

(t *testing.T)

Source from the content-addressed store, hash-verified

278// TestGetInterfaceByIP_LinkLocalIPv4 verifies that IPv4 link-local addresses
279// (APIPA range 169.254.x.x) are filtered out of the cache.
280func TestGetInterfaceByIP_LinkLocalIPv4(t *testing.T) {
281 t.Parallel()
282
283 ip := net.ParseIP("169.254.0.1")
284 _, err := GetInterfaceByIP(ip)
285 if err == nil {
286 t.Error("expected error for link-local IP 169.254.0.1, got nil")
287 }
288}
289
290// TestGetInterface_RepeatedCall verifies that repeated calls with the same
291// argument succeed consistently (exercises the list cache path).

Callers

nothing calls this directly

Calls 2

GetInterfaceByIPFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected