f-57: subnet: entrée FDB locale pour la MAC anycast, route du subnet émise depuis la gateway, contrôle watchdog #57
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
efad4efc13
commit
3ce390cb40
8 changed files with 133 additions and 3 deletions
|
|
@ -16,6 +16,7 @@ import (
|
|||
|
||||
type gatewayState struct {
|
||||
MAC string
|
||||
LocalFDB bool
|
||||
GatewayAddrs []string
|
||||
BridgeAddrs []string
|
||||
}
|
||||
|
|
@ -34,6 +35,9 @@ func gatewayProblems(gw, bridge string, got gatewayState, wantMAC, gatewayIP, re
|
|||
if got.MAC != wantMAC {
|
||||
problems = append(problems, fmt.Sprintf("interface %s has mac %q, expected anycast %s", gw, got.MAC, wantMAC))
|
||||
}
|
||||
if !got.LocalFDB {
|
||||
problems = append(problems, fmt.Sprintf("bridge %s has no local fdb entry for %s, frames to the gateway are flooded", bridge, wantMAC))
|
||||
}
|
||||
if !hasAddr(got.GatewayAddrs, gatewayIP) {
|
||||
problems = append(problems, fmt.Sprintf("interface %s lacks the gateway address %s", gw, gatewayIP))
|
||||
}
|
||||
|
|
@ -46,13 +50,16 @@ func gatewayProblems(gw, bridge string, got gatewayState, wantMAC, gatewayIP, re
|
|||
return problems
|
||||
}
|
||||
|
||||
func readGatewayState(gw, bridge string) (gatewayState, error) {
|
||||
func readGatewayState(gw, bridge string, anycast net.HardwareAddr) (gatewayState, error) {
|
||||
var st gatewayState
|
||||
mac, err := netif.LinkMAC(gw)
|
||||
if err != nil {
|
||||
return st, err
|
||||
}
|
||||
st.MAC = mac.String()
|
||||
if st.LocalFDB, err = netif.BridgeHasLocalMAC(bridge, anycast); err != nil {
|
||||
return st, err
|
||||
}
|
||||
for _, side := range []struct {
|
||||
iface string
|
||||
dst *[]string
|
||||
|
|
@ -106,7 +113,7 @@ func checkAnycastGateway(db *badger.DB, name, vpc, bridge string, n notify.Notif
|
|||
n.Notify(kindSubnet, name, p+" (in netns "+vpc+")")
|
||||
return nil
|
||||
}
|
||||
st, err := readGatewayState(gw, bridge)
|
||||
st, err := readGatewayState(gw, bridge, wantMAC)
|
||||
if err != nil {
|
||||
n.Notify(kindSubnet, name, fmt.Sprintf("anycast gateway unreadable in netns %s: %v", vpc, err))
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
func TestGatewayProblems_Healthy(t *testing.T) {
|
||||
st := gatewayState{
|
||||
MAC: "02:01:00:00:0b:5f",
|
||||
LocalFDB: true,
|
||||
GatewayAddrs: []string{"10.0.0.254"},
|
||||
BridgeAddrs: []string{"10.0.0.253"},
|
||||
}
|
||||
|
|
@ -20,6 +21,7 @@ func TestGatewayProblems_EachDefectIsReported(t *testing.T) {
|
|||
healthy := func() gatewayState {
|
||||
return gatewayState{
|
||||
MAC: "02:01:00:00:0b:5f",
|
||||
LocalFDB: true,
|
||||
GatewayAddrs: []string{"10.0.0.254"},
|
||||
BridgeAddrs: []string{"10.0.0.253"},
|
||||
}
|
||||
|
|
@ -30,6 +32,7 @@ func TestGatewayProblems_EachDefectIsReported(t *testing.T) {
|
|||
want string
|
||||
}{
|
||||
{"MAC du macvlan changée", func(s *gatewayState) { s.MAC = "02:03:c0:a8:0e:0b" }, "expected anycast 02:01:00:00:0b:5f"},
|
||||
{"entrée FDB locale absente du bridge", func(s *gatewayState) { s.LocalFDB = false }, "no local fdb entry for 02:01:00:00:0b:5f"},
|
||||
{"gateway absente du macvlan", func(s *gatewayState) { s.GatewayAddrs = nil }, "lacks the gateway address 10.0.0.254"},
|
||||
{"adresse d'émission absente du bridge", func(s *gatewayState) { s.BridgeAddrs = nil }, "lacks the relay address 10.0.0.253"},
|
||||
{"gateway posée sur le bridge", func(s *gatewayState) { s.BridgeAddrs = append(s.BridgeAddrs, "10.0.0.254") }, "bypass the anycast mac"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue