[bug-n1wxwkrtcnds] add pod link-local NUD source
flock PR validation / validate (pull_request) Successful in 1m54s

Co-Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
Donavan Fritz
2026-08-26 18:44:19 -05:00
co-authored by Codex
parent 6b8ebd0aed
commit 5df592e2d1
4 changed files with 51 additions and 4 deletions
+25
View File
@@ -0,0 +1,25 @@
//go:build linux
package agent
import (
"testing"
"golang.org/x/sys/unix"
)
func TestPodLinkLocalAddr(t *testing.T) {
addr := podLinkLocalAddr()
if got, want := addr.IP.String(), "fe80::2"; got != want {
t.Fatalf("pod link-local IP = %s, want %s", got, want)
}
if ones, bits := addr.Mask.Size(); ones != 64 || bits != 128 {
t.Fatalf("pod link-local mask = %d/%d, want 64/128", ones, bits)
}
if addr.Flags&unix.IFA_F_NODAD == 0 {
t.Fatal("pod link-local address must disable DAD")
}
if addr.IP.Equal(linkLocalGW) {
t.Fatal("pod and gateway link-local addresses must differ")
}
}