f-81: watchdog: VRF sans route unreachable default signalée #81

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-25 11:53:45 +01:00
commit 45b226f0bc
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
2 changed files with 51 additions and 0 deletions

View file

@ -25,6 +25,7 @@ type l3Probe interface {
NeighborEstablished(peer net.IP) (bool, error)
VNI(vni uint32) (frr.VNIState, error)
ExportedRoutes(table uint32, iface string) ([]*net.IPNet, error)
UnreachableDefault(table uint32) (bool, error)
LinkProblem(ns, iface string) string
}
@ -44,6 +45,10 @@ func (systemProbe) ExportedRoutes(table uint32, iface string) ([]*net.IPNet, err
return netif.TableRoutesVia(int(table), iface)
}
func (systemProbe) UnreachableDefault(table uint32) (bool, error) {
return netif.HasUnreachableDefault(int(table), l3vni.UnreachableMetric)
}
func (systemProbe) LinkProblem(ns, iface string) string {
if ns == "" {
return linkProblem(iface)
@ -145,6 +150,14 @@ func checkL3VPC(db *badger.DB, name string, r l3vni.Routing, rmac string, p l3Pr
n.Notify(kindVPC, name, fmt.Sprintf("l3vni %d has router mac %q in frr, expected %s", r.VNI, s.RouterMAC, rmac))
}
present, err := p.UnreachableDefault(r.VNI)
switch {
case err != nil:
n.Notify(kindVPC, name, fmt.Sprintf("unreachable default of %s unreadable: %v", r.VRF, err))
case !present:
n.Notify(kindVPC, name, fmt.Sprintf("no unreachable default in %s: traffic to an unknown destination leaves through the host routing table", r.VRF))
}
actual, err := p.ExportedRoutes(r.VNI, r.VethHost)
if err != nil {
n.Notify(kindVPC, name, fmt.Sprintf("routes of %s unreadable: %v", r.VRF, err))